diff options
author | David S. Miller <davem@davemloft.net> | 2008-10-11 15:39:35 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-10-11 15:39:35 -0400 |
commit | 56c5d900dbb8e042bfad035d18433476931d8f93 (patch) | |
tree | 00b793965beeef10db03e0ff021d2d965c410759 /sound/pci/hda | |
parent | 4dd95b63ae25c5cad6986829b5e8788e9faa0330 (diff) | |
parent | ead9d23d803ea3a73766c3cb27bf7563ac8d7266 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts:
sound/core/memalloc.c
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 | 164 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 1816 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 960 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 1407 |
16 files changed, 4628 insertions, 446 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..1a65775d28e --- /dev/null +++ b/sound/pci/hda/patch_nvhdmi.c | |||
@@ -0,0 +1,164 @@ | |||
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->stream[SNDRV_PCM_STREAM_PLAYBACK] = nvhdmi_pcm_digital_playback; | ||
120 | |||
121 | return 0; | ||
122 | } | ||
123 | |||
124 | static void nvhdmi_free(struct hda_codec *codec) | ||
125 | { | ||
126 | kfree(codec->spec); | ||
127 | } | ||
128 | |||
129 | static struct hda_codec_ops nvhdmi_patch_ops = { | ||
130 | .build_controls = nvhdmi_build_controls, | ||
131 | .build_pcms = nvhdmi_build_pcms, | ||
132 | .init = nvhdmi_init, | ||
133 | .free = nvhdmi_free, | ||
134 | }; | ||
135 | |||
136 | static int patch_nvhdmi(struct hda_codec *codec) | ||
137 | { | ||
138 | struct nvhdmi_spec *spec; | ||
139 | |||
140 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
141 | if (spec == NULL) | ||
142 | return -ENOMEM; | ||
143 | |||
144 | codec->spec = spec; | ||
145 | |||
146 | spec->multiout.num_dacs = 0; /* no analog */ | ||
147 | spec->multiout.max_channels = 2; | ||
148 | spec->multiout.dig_out_nid = 0x4; /* NID for copying analog to digital, | ||
149 | * seems to be unused in pure-digital | ||
150 | * case. */ | ||
151 | |||
152 | codec->patch_ops = nvhdmi_patch_ops; | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | /* | ||
158 | * patch entries | ||
159 | */ | ||
160 | struct hda_codec_preset snd_hda_preset_nvhdmi[] = { | ||
161 | { .id = 0x10de0002, .name = "NVIDIA MCP78 HDMI", .patch = patch_nvhdmi }, | ||
162 | { .id = 0x10de0007, .name = "NVIDIA MCP7A HDMI", .patch = patch_nvhdmi }, | ||
163 | {} /* terminator */ | ||
164 | }; | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 66025161bd6..0b6e682c46d 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; |
@@ -855,7 +871,7 @@ static void alc_subsystem_id(struct hda_codec *codec, | |||
855 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) | 871 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
856 | goto do_sku; | 872 | goto do_sku; |
857 | 873 | ||
858 | /* | 874 | /* |
859 | * 31~30 : port conetcivity | 875 | * 31~30 : port conetcivity |
860 | * 29~21 : reserve | 876 | * 29~21 : reserve |
861 | * 20 : PCBEEP input | 877 | * 20 : PCBEEP input |
@@ -946,7 +962,7 @@ do_sku: | |||
946 | tmp = snd_hda_codec_read(codec, 0x20, 0, | 962 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
947 | AC_VERB_GET_PROC_COEF, 0); | 963 | AC_VERB_GET_PROC_COEF, 0); |
948 | snd_hda_codec_write(codec, 0x20, 0, | 964 | snd_hda_codec_write(codec, 0x20, 0, |
949 | AC_VERB_SET_COEF_INDEX, 7); | 965 | AC_VERB_SET_COEF_INDEX, 7); |
950 | snd_hda_codec_write(codec, 0x20, 0, | 966 | snd_hda_codec_write(codec, 0x20, 0, |
951 | AC_VERB_SET_PROC_COEF, | 967 | AC_VERB_SET_PROC_COEF, |
952 | tmp | 0x2010); | 968 | tmp | 0x2010); |
@@ -961,7 +977,7 @@ do_sku: | |||
961 | tmp = snd_hda_codec_read(codec, 0x20, 0, | 977 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
962 | AC_VERB_GET_PROC_COEF, 0); | 978 | AC_VERB_GET_PROC_COEF, 0); |
963 | snd_hda_codec_write(codec, 0x20, 0, | 979 | snd_hda_codec_write(codec, 0x20, 0, |
964 | AC_VERB_SET_COEF_INDEX, 7); | 980 | AC_VERB_SET_COEF_INDEX, 7); |
965 | snd_hda_codec_write(codec, 0x20, 0, | 981 | snd_hda_codec_write(codec, 0x20, 0, |
966 | AC_VERB_SET_PROC_COEF, | 982 | AC_VERB_SET_PROC_COEF, |
967 | tmp | 0x3000); | 983 | tmp | 0x3000); |
@@ -970,7 +986,7 @@ do_sku: | |||
970 | default: | 986 | default: |
971 | break; | 987 | break; |
972 | } | 988 | } |
973 | 989 | ||
974 | /* is laptop or Desktop and enable the function "Mute internal speaker | 990 | /* is laptop or Desktop and enable the function "Mute internal speaker |
975 | * when the external headphone out jack is plugged" | 991 | * when the external headphone out jack is plugged" |
976 | */ | 992 | */ |
@@ -1006,6 +1022,7 @@ do_sku: | |||
1006 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, | 1022 | snd_hda_codec_write(codec, spec->autocfg.hp_pins[0], 0, |
1007 | AC_VERB_SET_UNSOLICITED_ENABLE, | 1023 | AC_VERB_SET_UNSOLICITED_ENABLE, |
1008 | AC_USRSP_EN | ALC880_HP_EVENT); | 1024 | AC_USRSP_EN | ALC880_HP_EVENT); |
1025 | |||
1009 | spec->unsol_event = alc_sku_unsol_event; | 1026 | spec->unsol_event = alc_sku_unsol_event; |
1010 | } | 1027 | } |
1011 | 1028 | ||
@@ -1296,7 +1313,7 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |||
1296 | * | 1313 | * |
1297 | * The system also has a pair of internal speakers, and a headphone jack. | 1314 | * 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. | 1315 | * These are both connected to Line2 on the codec, hence to DAC 02. |
1299 | * | 1316 | * |
1300 | * There is a variable resistor to control the speaker or headphone | 1317 | * There is a variable resistor to control the speaker or headphone |
1301 | * volume. This is a hardware-only device without a software API. | 1318 | * volume. This is a hardware-only device without a software API. |
1302 | * | 1319 | * |
@@ -1824,7 +1841,7 @@ static struct hda_verb alc880_pin_6stack_init_verbs[] = { | |||
1824 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 1841 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
1825 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 1842 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
1826 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 1843 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
1827 | 1844 | ||
1828 | { } | 1845 | { } |
1829 | }; | 1846 | }; |
1830 | 1847 | ||
@@ -1869,7 +1886,7 @@ static struct hda_verb alc880_uniwill_init_verbs[] = { | |||
1869 | 1886 | ||
1870 | /* | 1887 | /* |
1871 | * Uniwill P53 | 1888 | * Uniwill P53 |
1872 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, | 1889 | * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, |
1873 | */ | 1890 | */ |
1874 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { | 1891 | static struct hda_verb alc880_uniwill_p53_init_verbs[] = { |
1875 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 1892 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -1968,7 +1985,7 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) | |||
1968 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) | 1985 | static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) |
1969 | { | 1986 | { |
1970 | unsigned int present; | 1987 | unsigned int present; |
1971 | 1988 | ||
1972 | present = snd_hda_codec_read(codec, 0x21, 0, | 1989 | present = snd_hda_codec_read(codec, 0x21, 0, |
1973 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); | 1990 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
1974 | present &= HDA_AMP_VOLMASK; | 1991 | present &= HDA_AMP_VOLMASK; |
@@ -2050,7 +2067,7 @@ static struct hda_verb alc880_pin_asus_init_verbs[] = { | |||
2050 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 2067 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
2051 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 2068 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
2052 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 2069 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
2053 | 2070 | ||
2054 | { } | 2071 | { } |
2055 | }; | 2072 | }; |
2056 | 2073 | ||
@@ -2632,12 +2649,14 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2632 | 2649 | ||
2633 | info->name = spec->stream_name_analog; | 2650 | info->name = spec->stream_name_analog; |
2634 | if (spec->stream_analog_playback) { | 2651 | if (spec->stream_analog_playback) { |
2635 | snd_assert(spec->multiout.dac_nids, return -EINVAL); | 2652 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
2653 | return -EINVAL; | ||
2636 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); | 2654 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); |
2637 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; | 2655 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; |
2638 | } | 2656 | } |
2639 | if (spec->stream_analog_capture) { | 2657 | if (spec->stream_analog_capture) { |
2640 | snd_assert(spec->adc_nids, return -EINVAL); | 2658 | if (snd_BUG_ON(!spec->adc_nids)) |
2659 | return -EINVAL; | ||
2641 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); | 2660 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); |
2642 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; | 2661 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; |
2643 | } | 2662 | } |
@@ -2667,6 +2686,8 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
2667 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); | 2686 | info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); |
2668 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; | 2687 | info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; |
2669 | } | 2688 | } |
2689 | /* FIXME: do we need this for all Realtek codec models? */ | ||
2690 | codec->spdif_status_reset = 1; | ||
2670 | } | 2691 | } |
2671 | 2692 | ||
2672 | /* If the use of more than one ADC is requested for the current | 2693 | /* If the use of more than one ADC is requested for the current |
@@ -3683,7 +3704,7 @@ static void alc880_auto_init_multi_out(struct hda_codec *codec) | |||
3683 | { | 3704 | { |
3684 | struct alc_spec *spec = codec->spec; | 3705 | struct alc_spec *spec = codec->spec; |
3685 | int i; | 3706 | int i; |
3686 | 3707 | ||
3687 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); | 3708 | alc_subsystem_id(codec, 0x15, 0x1b, 0x14); |
3688 | for (i = 0; i < spec->autocfg.line_outs; i++) { | 3709 | for (i = 0; i < spec->autocfg.line_outs; i++) { |
3689 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; | 3710 | hda_nid_t nid = spec->autocfg.line_out_pins[i]; |
@@ -4124,6 +4145,33 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { | |||
4124 | { } /* end */ | 4145 | { } /* end */ |
4125 | }; | 4146 | }; |
4126 | 4147 | ||
4148 | static struct hda_bind_ctls alc260_dc7600_bind_master_vol = { | ||
4149 | .ops = &snd_hda_bind_vol, | ||
4150 | .values = { | ||
4151 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_OUTPUT), | ||
4152 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_OUTPUT), | ||
4153 | HDA_COMPOSE_AMP_VAL(0x0a, 3, 0, HDA_OUTPUT), | ||
4154 | 0 | ||
4155 | }, | ||
4156 | }; | ||
4157 | |||
4158 | static struct hda_bind_ctls alc260_dc7600_bind_switch = { | ||
4159 | .ops = &snd_hda_bind_sw, | ||
4160 | .values = { | ||
4161 | HDA_COMPOSE_AMP_VAL(0x11, 3, 0, HDA_OUTPUT), | ||
4162 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
4163 | 0 | ||
4164 | }, | ||
4165 | }; | ||
4166 | |||
4167 | static struct snd_kcontrol_new alc260_hp_dc7600_mixer[] = { | ||
4168 | HDA_BIND_VOL("Master Playback Volume", &alc260_dc7600_bind_master_vol), | ||
4169 | HDA_BIND_SW("LineOut Playback Switch", &alc260_dc7600_bind_switch), | ||
4170 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x0f, 0x0, HDA_OUTPUT), | ||
4171 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
4172 | { } /* end */ | ||
4173 | }; | ||
4174 | |||
4127 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { | 4175 | static struct hda_verb alc260_hp_3013_unsol_verbs[] = { |
4128 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 4176 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
4129 | {}, | 4177 | {}, |
@@ -4147,7 +4195,30 @@ static void alc260_hp_3013_unsol_event(struct hda_codec *codec, | |||
4147 | alc260_hp_3013_automute(codec); | 4195 | alc260_hp_3013_automute(codec); |
4148 | } | 4196 | } |
4149 | 4197 | ||
4150 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | 4198 | static void alc260_hp_3012_automute(struct hda_codec *codec) |
4199 | { | ||
4200 | unsigned int present, bits; | ||
4201 | |||
4202 | present = snd_hda_codec_read(codec, 0x10, 0, | ||
4203 | AC_VERB_GET_PIN_SENSE, 0) & AC_PINSENSE_PRESENCE; | ||
4204 | |||
4205 | bits = present ? 0 : PIN_OUT; | ||
4206 | snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4207 | bits); | ||
4208 | snd_hda_codec_write(codec, 0x11, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4209 | bits); | ||
4210 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4211 | bits); | ||
4212 | } | ||
4213 | |||
4214 | static void alc260_hp_3012_unsol_event(struct hda_codec *codec, | ||
4215 | unsigned int res) | ||
4216 | { | ||
4217 | if ((res >> 26) == ALC880_HP_EVENT) | ||
4218 | alc260_hp_3012_automute(codec); | ||
4219 | } | ||
4220 | |||
4221 | /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, | ||
4151 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. | 4222 | * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. |
4152 | */ | 4223 | */ |
4153 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | 4224 | static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { |
@@ -4478,7 +4549,7 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { | |||
4478 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4549 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4479 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4550 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4480 | 4551 | ||
4481 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus | 4552 | /* Ensure Line1 pin widget takes its input from the OUT1 sum bus |
4482 | * when acting as an output. | 4553 | * when acting as an output. |
4483 | */ | 4554 | */ |
4484 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | 4555 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4503,14 +4574,14 @@ static struct hda_verb alc260_fujitsu_init_verbs[] = { | |||
4503 | * stage. | 4574 | * stage. |
4504 | */ | 4575 | */ |
4505 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 4576 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
4506 | /* Unmute input buffer of pin widget used for Line-in (no equiv | 4577 | /* Unmute input buffer of pin widget used for Line-in (no equiv |
4507 | * mixer ctrl) | 4578 | * mixer ctrl) |
4508 | */ | 4579 | */ |
4509 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 4580 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
4510 | 4581 | ||
4511 | /* Mute capture amp left and right */ | 4582 | /* Mute capture amp left and right */ |
4512 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 4583 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
4513 | /* Set ADC connection select to match default mixer setting - line | 4584 | /* Set ADC connection select to match default mixer setting - line |
4514 | * in (on mic1 pin) | 4585 | * in (on mic1 pin) |
4515 | */ | 4586 | */ |
4516 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | 4587 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -4564,7 +4635,7 @@ static struct hda_verb alc260_acer_init_verbs[] = { | |||
4564 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4635 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4565 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4636 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4566 | 4637 | ||
4567 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | 4638 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum |
4568 | * bus when acting as outputs. | 4639 | * bus when acting as outputs. |
4569 | */ | 4640 | */ |
4570 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | 4641 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4675,6 +4746,20 @@ static void alc260_replacer_672v_unsol_event(struct hda_codec *codec, | |||
4675 | alc260_replacer_672v_automute(codec); | 4746 | alc260_replacer_672v_automute(codec); |
4676 | } | 4747 | } |
4677 | 4748 | ||
4749 | static struct hda_verb alc260_hp_dc7600_verbs[] = { | ||
4750 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
4751 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
4752 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4753 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
4754 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4755 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
4756 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
4757 | {0x10, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4758 | {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4759 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
4760 | {} | ||
4761 | }; | ||
4762 | |||
4678 | /* Test configuration for debugging, modelled after the ALC880 test | 4763 | /* Test configuration for debugging, modelled after the ALC880 test |
4679 | * configuration. | 4764 | * configuration. |
4680 | */ | 4765 | */ |
@@ -4686,7 +4771,7 @@ static hda_nid_t alc260_test_adc_nids[2] = { | |||
4686 | 0x04, 0x05, | 4771 | 0x04, 0x05, |
4687 | }; | 4772 | }; |
4688 | /* For testing the ALC260, each input MUX needs its own definition since | 4773 | /* For testing the ALC260, each input MUX needs its own definition since |
4689 | * the signal assignments are different. This assumes that the first ADC | 4774 | * the signal assignments are different. This assumes that the first ADC |
4690 | * is NID 0x04. | 4775 | * is NID 0x04. |
4691 | */ | 4776 | */ |
4692 | static struct hda_input_mux alc260_test_capture_sources[2] = { | 4777 | static struct hda_input_mux alc260_test_capture_sources[2] = { |
@@ -4769,7 +4854,7 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { | |||
4769 | 4854 | ||
4770 | /* Switches to allow the digital IO pins to be enabled. The datasheet | 4855 | /* 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 | 4856 | * is ambigious as to which NID is which; testing on laptops which |
4772 | * make this output available should provide clarification. | 4857 | * make this output available should provide clarification. |
4773 | */ | 4858 | */ |
4774 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), | 4859 | ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), |
4775 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), | 4860 | ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), |
@@ -4805,7 +4890,7 @@ static struct hda_verb alc260_test_init_verbs[] = { | |||
4805 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4890 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4806 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | 4891 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, |
4807 | 4892 | ||
4808 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the | 4893 | /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the |
4809 | * OUT1 sum bus when acting as an output. | 4894 | * OUT1 sum bus when acting as an output. |
4810 | */ | 4895 | */ |
4811 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | 4896 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, |
@@ -4897,7 +4982,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); | 4982 | sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); |
4898 | } else | 4983 | } else |
4899 | return 0; /* N/A */ | 4984 | return 0; /* N/A */ |
4900 | 4985 | ||
4901 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); | 4986 | snprintf(name, sizeof(name), "%s Playback Volume", pfx); |
4902 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); | 4987 | err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val); |
4903 | if (err < 0) | 4988 | if (err < 0) |
@@ -5003,7 +5088,7 @@ static void alc260_auto_init_multi_out(struct hda_codec *codec) | |||
5003 | int pin_type = get_pin_type(spec->autocfg.line_out_type); | 5088 | int pin_type = get_pin_type(spec->autocfg.line_out_type); |
5004 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); | 5089 | alc260_auto_set_output_and_unmute(codec, nid, pin_type, 0); |
5005 | } | 5090 | } |
5006 | 5091 | ||
5007 | nid = spec->autocfg.speaker_pins[0]; | 5092 | nid = spec->autocfg.speaker_pins[0]; |
5008 | if (nid) | 5093 | if (nid) |
5009 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); | 5094 | alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); |
@@ -5045,7 +5130,7 @@ static struct hda_verb alc260_volume_init_verbs[] = { | |||
5045 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5130 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5046 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | 5131 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, |
5047 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5132 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5048 | 5133 | ||
5049 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback | 5134 | /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback |
5050 | * mixer widget | 5135 | * mixer widget |
5051 | * Note: PASD motherboards uses the Line In 2 as the input for | 5136 | * Note: PASD motherboards uses the Line In 2 as the input for |
@@ -5074,7 +5159,7 @@ static struct hda_verb alc260_volume_init_verbs[] = { | |||
5074 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 5159 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
5075 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 5160 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
5076 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 5161 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
5077 | 5162 | ||
5078 | { } | 5163 | { } |
5079 | }; | 5164 | }; |
5080 | 5165 | ||
@@ -5155,6 +5240,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
5155 | [ALC260_BASIC] = "basic", | 5240 | [ALC260_BASIC] = "basic", |
5156 | [ALC260_HP] = "hp", | 5241 | [ALC260_HP] = "hp", |
5157 | [ALC260_HP_3013] = "hp-3013", | 5242 | [ALC260_HP_3013] = "hp-3013", |
5243 | [ALC260_HP_DC7600] = "hp-dc7600", | ||
5158 | [ALC260_FUJITSU_S702X] = "fujitsu", | 5244 | [ALC260_FUJITSU_S702X] = "fujitsu", |
5159 | [ALC260_ACER] = "acer", | 5245 | [ALC260_ACER] = "acer", |
5160 | [ALC260_WILL] = "will", | 5246 | [ALC260_WILL] = "will", |
@@ -5172,7 +5258,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = { | |||
5172 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), | 5258 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
5173 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | 5259 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
5174 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), | 5260 | SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP_3013), |
5175 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), | 5261 | SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_DC7600), |
5176 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), | 5262 | SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), |
5177 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), | 5263 | SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), |
5178 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), | 5264 | SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), |
@@ -5218,6 +5304,22 @@ static struct alc_config_preset alc260_presets[] = { | |||
5218 | .unsol_event = alc260_hp_unsol_event, | 5304 | .unsol_event = alc260_hp_unsol_event, |
5219 | .init_hook = alc260_hp_automute, | 5305 | .init_hook = alc260_hp_automute, |
5220 | }, | 5306 | }, |
5307 | [ALC260_HP_DC7600] = { | ||
5308 | .mixers = { alc260_hp_dc7600_mixer, | ||
5309 | alc260_input_mixer, | ||
5310 | alc260_capture_alt_mixer }, | ||
5311 | .init_verbs = { alc260_init_verbs, | ||
5312 | alc260_hp_dc7600_verbs }, | ||
5313 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
5314 | .dac_nids = alc260_dac_nids, | ||
5315 | .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), | ||
5316 | .adc_nids = alc260_hp_adc_nids, | ||
5317 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
5318 | .channel_mode = alc260_modes, | ||
5319 | .input_mux = &alc260_capture_source, | ||
5320 | .unsol_event = alc260_hp_3012_unsol_event, | ||
5321 | .init_hook = alc260_hp_3012_automute, | ||
5322 | }, | ||
5221 | [ALC260_HP_3013] = { | 5323 | [ALC260_HP_3013] = { |
5222 | .mixers = { alc260_hp_3013_mixer, | 5324 | .mixers = { alc260_hp_3013_mixer, |
5223 | alc260_input_mixer, | 5325 | alc260_input_mixer, |
@@ -5933,7 +6035,7 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
5933 | 6035 | ||
5934 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6036 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5935 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6037 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5936 | 6038 | ||
5937 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | 6039 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
5938 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | 6040 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
5939 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6041 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -5949,7 +6051,7 @@ static struct hda_verb alc882_targa_verbs[] = { | |||
5949 | static void alc882_targa_automute(struct hda_codec *codec) | 6051 | static void alc882_targa_automute(struct hda_codec *codec) |
5950 | { | 6052 | { |
5951 | unsigned int present; | 6053 | unsigned int present; |
5952 | 6054 | ||
5953 | present = snd_hda_codec_read(codec, 0x14, 0, | 6055 | present = snd_hda_codec_read(codec, 0x14, 0, |
5954 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 6056 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
5955 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 6057 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
@@ -5975,7 +6077,7 @@ static struct hda_verb alc882_asus_a7j_verbs[] = { | |||
5975 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6077 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5976 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6078 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5977 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6079 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5978 | 6080 | ||
5979 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6081 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
5980 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6082 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
5981 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6083 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
@@ -5993,7 +6095,7 @@ static struct hda_verb alc882_asus_a7m_verbs[] = { | |||
5993 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 6095 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5994 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6096 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5995 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 6097 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
5996 | 6098 | ||
5997 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6099 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
5998 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 6100 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
5999 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ | 6101 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */ |
@@ -6319,7 +6421,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
6319 | .channel_mode = alc882_3ST_6ch_modes, | 6421 | .channel_mode = alc882_3ST_6ch_modes, |
6320 | .need_dac_fix = 1, | 6422 | .need_dac_fix = 1, |
6321 | .input_mux = &alc882_capture_source, | 6423 | .input_mux = &alc882_capture_source, |
6322 | }, | 6424 | }, |
6323 | [ALC882_ASUS_A7M] = { | 6425 | [ALC882_ASUS_A7M] = { |
6324 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, | 6426 | .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer }, |
6325 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, | 6427 | .init_verbs = { alc882_init_verbs, alc882_eapd_verbs, |
@@ -6332,14 +6434,14 @@ static struct alc_config_preset alc882_presets[] = { | |||
6332 | .channel_mode = alc880_threestack_modes, | 6434 | .channel_mode = alc880_threestack_modes, |
6333 | .need_dac_fix = 1, | 6435 | .need_dac_fix = 1, |
6334 | .input_mux = &alc882_capture_source, | 6436 | .input_mux = &alc882_capture_source, |
6335 | }, | 6437 | }, |
6336 | }; | 6438 | }; |
6337 | 6439 | ||
6338 | 6440 | ||
6339 | /* | 6441 | /* |
6340 | * Pin config fixes | 6442 | * Pin config fixes |
6341 | */ | 6443 | */ |
6342 | enum { | 6444 | enum { |
6343 | PINFIX_ABIT_AW9D_MAX | 6445 | PINFIX_ABIT_AW9D_MAX |
6344 | }; | 6446 | }; |
6345 | 6447 | ||
@@ -6554,16 +6656,19 @@ static int patch_alc882(struct hda_codec *codec) | |||
6554 | board_config = ALC885_MACPRO; | 6656 | board_config = ALC885_MACPRO; |
6555 | break; | 6657 | break; |
6556 | case 0x106b1000: /* iMac 24 */ | 6658 | case 0x106b1000: /* iMac 24 */ |
6659 | case 0x106b2800: /* AppleTV */ | ||
6557 | board_config = ALC885_IMAC24; | 6660 | board_config = ALC885_IMAC24; |
6558 | break; | 6661 | break; |
6559 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ | 6662 | case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ |
6663 | case 0x106b00a4: /* MacbookPro4,1 */ | ||
6560 | case 0x106b2c00: /* Macbook Pro rev3 */ | 6664 | case 0x106b2c00: /* Macbook Pro rev3 */ |
6561 | case 0x106b3600: /* Macbook 3.1 */ | 6665 | case 0x106b3600: /* Macbook 3.1 */ |
6562 | board_config = ALC885_MBP3; | 6666 | board_config = ALC885_MBP3; |
6563 | break; | 6667 | break; |
6564 | default: | 6668 | default: |
6565 | /* ALC889A is handled better as ALC888-compatible */ | 6669 | /* ALC889A is handled better as ALC888-compatible */ |
6566 | if (codec->revision_id == 0x100103) { | 6670 | if (codec->revision_id == 0x100101 || |
6671 | codec->revision_id == 0x100103) { | ||
6567 | alc_free(codec); | 6672 | alc_free(codec); |
6568 | return patch_alc883(codec); | 6673 | return patch_alc883(codec); |
6569 | } | 6674 | } |
@@ -6718,6 +6823,23 @@ static struct hda_input_mux alc883_fujitsu_pi2515_capture_source = { | |||
6718 | }, | 6823 | }, |
6719 | }; | 6824 | }; |
6720 | 6825 | ||
6826 | static struct hda_input_mux alc883_lenovo_sky_capture_source = { | ||
6827 | .num_items = 3, | ||
6828 | .items = { | ||
6829 | { "Mic", 0x0 }, | ||
6830 | { "Front Mic", 0x1 }, | ||
6831 | { "Line", 0x4 }, | ||
6832 | }, | ||
6833 | }; | ||
6834 | |||
6835 | static struct hda_input_mux alc883_asus_eee1601_capture_source = { | ||
6836 | .num_items = 2, | ||
6837 | .items = { | ||
6838 | { "Mic", 0x0 }, | ||
6839 | { "Line", 0x2 }, | ||
6840 | }, | ||
6841 | }; | ||
6842 | |||
6721 | #define alc883_mux_enum_info alc_mux_enum_info | 6843 | #define alc883_mux_enum_info alc_mux_enum_info |
6722 | #define alc883_mux_enum_get alc_mux_enum_get | 6844 | #define alc883_mux_enum_get alc_mux_enum_get |
6723 | /* ALC883 has the ALC882-type input selection */ | 6845 | /* ALC883 has the ALC882-type input selection */ |
@@ -7032,13 +7154,11 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |||
7032 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | 7154 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), |
7033 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | 7155 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
7034 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | 7156 | 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 | { | 7157 | { |
7038 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 7158 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
7039 | /* .name = "Capture Source", */ | 7159 | /* .name = "Capture Source", */ |
7040 | .name = "Input Source", | 7160 | .name = "Input Source", |
7041 | .count = 2, | 7161 | .count = 1, |
7042 | .info = alc883_mux_enum_info, | 7162 | .info = alc883_mux_enum_info, |
7043 | .get = alc883_mux_enum_get, | 7163 | .get = alc883_mux_enum_get, |
7044 | .put = alc883_mux_enum_put, | 7164 | .put = alc883_mux_enum_put, |
@@ -7256,7 +7376,7 @@ static struct snd_kcontrol_new alc883_medion_md2_mixer[] = { | |||
7256 | .put = alc883_mux_enum_put, | 7376 | .put = alc883_mux_enum_put, |
7257 | }, | 7377 | }, |
7258 | { } /* end */ | 7378 | { } /* end */ |
7259 | }; | 7379 | }; |
7260 | 7380 | ||
7261 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | 7381 | static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { |
7262 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7382 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -7283,6 +7403,87 @@ static struct snd_kcontrol_new alc883_acer_aspire_mixer[] = { | |||
7283 | { } /* end */ | 7403 | { } /* end */ |
7284 | }; | 7404 | }; |
7285 | 7405 | ||
7406 | static struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = { | ||
7407 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7408 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7409 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT), | ||
7410 | HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT), | ||
7411 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", | ||
7412 | 0x0d, 1, 0x0, HDA_OUTPUT), | ||
7413 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), | ||
7414 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), | ||
7415 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), | ||
7416 | HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), | ||
7417 | HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), | ||
7418 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
7419 | HDA_CODEC_MUTE("iSpeaker Playback Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
7420 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
7421 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
7422 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7423 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7425 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7426 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7427 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
7428 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
7429 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
7430 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | ||
7431 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | ||
7432 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), | ||
7433 | HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), | ||
7434 | { | ||
7435 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7436 | /* .name = "Capture Source", */ | ||
7437 | .name = "Input Source", | ||
7438 | .count = 2, | ||
7439 | .info = alc883_mux_enum_info, | ||
7440 | .get = alc883_mux_enum_get, | ||
7441 | .put = alc883_mux_enum_put, | ||
7442 | }, | ||
7443 | { } /* end */ | ||
7444 | }; | ||
7445 | |||
7446 | static struct hda_bind_ctls alc883_bind_cap_vol = { | ||
7447 | .ops = &snd_hda_bind_vol, | ||
7448 | .values = { | ||
7449 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
7450 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
7451 | 0 | ||
7452 | }, | ||
7453 | }; | ||
7454 | |||
7455 | static struct hda_bind_ctls alc883_bind_cap_switch = { | ||
7456 | .ops = &snd_hda_bind_sw, | ||
7457 | .values = { | ||
7458 | HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT), | ||
7459 | HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT), | ||
7460 | 0 | ||
7461 | }, | ||
7462 | }; | ||
7463 | |||
7464 | static struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = { | ||
7465 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
7466 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
7467 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
7468 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
7469 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
7470 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
7471 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
7472 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
7473 | HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol), | ||
7474 | HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch), | ||
7475 | { | ||
7476 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7477 | /* .name = "Capture Source", */ | ||
7478 | .name = "Input Source", | ||
7479 | .count = 1, | ||
7480 | .info = alc883_mux_enum_info, | ||
7481 | .get = alc883_mux_enum_get, | ||
7482 | .put = alc883_mux_enum_put, | ||
7483 | }, | ||
7484 | { } /* end */ | ||
7485 | }; | ||
7486 | |||
7286 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { | 7487 | static struct snd_kcontrol_new alc883_chmode_mixer[] = { |
7287 | { | 7488 | { |
7288 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 7489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -7296,7 +7497,7 @@ static struct snd_kcontrol_new alc883_chmode_mixer[] = { | |||
7296 | 7497 | ||
7297 | static struct hda_verb alc883_init_verbs[] = { | 7498 | static struct hda_verb alc883_init_verbs[] = { |
7298 | /* ADC1: mute amp left and right */ | 7499 | /* ADC1: mute amp left and right */ |
7299 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7500 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7300 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 7501 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
7301 | /* ADC2: mute amp left and right */ | 7502 | /* ADC2: mute amp left and right */ |
7302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 7503 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
@@ -7361,14 +7562,14 @@ static struct hda_verb alc883_init_verbs[] = { | |||
7361 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 7562 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
7362 | /* Input mixer2 */ | 7563 | /* Input mixer2 */ |
7363 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7564 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7364 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 7565 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 7566 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
7366 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | 7567 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
7367 | /* Input mixer3 */ | 7568 | /* Input mixer3 */ |
7368 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 7569 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
7369 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 7570 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
7370 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, | 7571 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, |
7371 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, | 7572 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
7372 | { } | 7573 | { } |
7373 | }; | 7574 | }; |
7374 | 7575 | ||
@@ -7468,7 +7669,7 @@ static struct hda_verb alc883_tagra_verbs[] = { | |||
7468 | 7669 | ||
7469 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 7670 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
7470 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 7671 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
7471 | 7672 | ||
7472 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ | 7673 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ |
7473 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ | 7674 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ |
7474 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ | 7675 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ |
@@ -7518,6 +7719,18 @@ static struct hda_verb alc883_haier_w66_verbs[] = { | |||
7518 | { } /* end */ | 7719 | { } /* end */ |
7519 | }; | 7720 | }; |
7520 | 7721 | ||
7722 | static struct hda_verb alc888_lenovo_sky_verbs[] = { | ||
7723 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7724 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
7725 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7726 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7727 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
7728 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
7729 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
7730 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
7731 | { } /* end */ | ||
7732 | }; | ||
7733 | |||
7521 | static struct hda_verb alc888_3st_hp_verbs[] = { | 7734 | static struct hda_verb alc888_3st_hp_verbs[] = { |
7522 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | 7735 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
7523 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | 7736 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
@@ -7555,7 +7768,7 @@ static struct hda_channel_mode alc888_3st_hp_modes[2] = { | |||
7555 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | 7768 | static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) |
7556 | { | 7769 | { |
7557 | unsigned int present; | 7770 | unsigned int present; |
7558 | 7771 | ||
7559 | present = snd_hda_codec_read(codec, 0x1b, 0, | 7772 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7560 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7773 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7561 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 7774 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
@@ -7568,7 +7781,7 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec) | |||
7568 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) | 7781 | static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec) |
7569 | { | 7782 | { |
7570 | unsigned int present; | 7783 | unsigned int present; |
7571 | 7784 | ||
7572 | present = snd_hda_codec_read(codec, 0x14, 0, | 7785 | present = snd_hda_codec_read(codec, 0x14, 0, |
7573 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7786 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7574 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 7787 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7598,7 +7811,7 @@ static struct hda_verb alc883_medion_md2_verbs[] = { | |||
7598 | static void alc883_medion_md2_automute(struct hda_codec *codec) | 7811 | static void alc883_medion_md2_automute(struct hda_codec *codec) |
7599 | { | 7812 | { |
7600 | unsigned int present; | 7813 | unsigned int present; |
7601 | 7814 | ||
7602 | present = snd_hda_codec_read(codec, 0x14, 0, | 7815 | present = snd_hda_codec_read(codec, 0x14, 0, |
7603 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7816 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7604 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 7817 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7753,7 +7966,7 @@ static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, | |||
7753 | static void alc883_acer_aspire_automute(struct hda_codec *codec) | 7966 | static void alc883_acer_aspire_automute(struct hda_codec *codec) |
7754 | { | 7967 | { |
7755 | unsigned int present; | 7968 | unsigned int present; |
7756 | 7969 | ||
7757 | present = snd_hda_codec_read(codec, 0x14, 0, | 7970 | present = snd_hda_codec_read(codec, 0x14, 0, |
7758 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 7971 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7759 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | 7972 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, |
@@ -7790,7 +8003,7 @@ static struct hda_verb alc883_acer_eapd_verbs[] = { | |||
7790 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) | 8003 | static void alc888_6st_dell_front_automute(struct hda_codec *codec) |
7791 | { | 8004 | { |
7792 | unsigned int present; | 8005 | unsigned int present; |
7793 | 8006 | ||
7794 | present = snd_hda_codec_read(codec, 0x1b, 0, | 8007 | present = snd_hda_codec_read(codec, 0x1b, 0, |
7795 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 8008 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
7796 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 8009 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, |
@@ -7814,6 +8027,50 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |||
7814 | } | 8027 | } |
7815 | } | 8028 | } |
7816 | 8029 | ||
8030 | static void alc888_lenovo_sky_front_automute(struct hda_codec *codec) | ||
8031 | { | ||
8032 | unsigned int mute; | ||
8033 | unsigned int present; | ||
8034 | |||
8035 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
8036 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
8037 | AC_VERB_GET_PIN_SENSE, 0); | ||
8038 | present = (present & 0x80000000) != 0; | ||
8039 | if (present) { | ||
8040 | /* mute internal speaker */ | ||
8041 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8042 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8043 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
8044 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8045 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8046 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8047 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | ||
8048 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8049 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
8050 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
8051 | } else { | ||
8052 | /* unmute internal speaker if necessary */ | ||
8053 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | ||
8054 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8055 | HDA_AMP_MUTE, mute); | ||
8056 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
8057 | HDA_AMP_MUTE, mute); | ||
8058 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8059 | HDA_AMP_MUTE, mute); | ||
8060 | snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0, | ||
8061 | HDA_AMP_MUTE, mute); | ||
8062 | snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, | ||
8063 | HDA_AMP_MUTE, mute); | ||
8064 | } | ||
8065 | } | ||
8066 | |||
8067 | static void alc883_lenovo_sky_unsol_event(struct hda_codec *codec, | ||
8068 | unsigned int res) | ||
8069 | { | ||
8070 | if ((res >> 26) == ALC880_HP_EVENT) | ||
8071 | alc888_lenovo_sky_front_automute(codec); | ||
8072 | } | ||
8073 | |||
7817 | /* | 8074 | /* |
7818 | * generic initialization of ADC, input mixers and output mixers | 8075 | * generic initialization of ADC, input mixers and output mixers |
7819 | */ | 8076 | */ |
@@ -7898,6 +8155,105 @@ static struct snd_kcontrol_new alc883_capture_mixer[] = { | |||
7898 | { } /* end */ | 8155 | { } /* end */ |
7899 | }; | 8156 | }; |
7900 | 8157 | ||
8158 | static struct hda_verb alc888_asus_m90v_verbs[] = { | ||
8159 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8160 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8161 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
8162 | /* enable unsolicited event */ | ||
8163 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8164 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_MIC_EVENT | AC_USRSP_EN}, | ||
8165 | { } /* end */ | ||
8166 | }; | ||
8167 | |||
8168 | static void alc883_nb_mic_automute(struct hda_codec *codec) | ||
8169 | { | ||
8170 | unsigned int present; | ||
8171 | |||
8172 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
8173 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8174 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8175 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | ||
8176 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | ||
8177 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); | ||
8178 | } | ||
8179 | |||
8180 | static void alc883_M90V_speaker_automute(struct hda_codec *codec) | ||
8181 | { | ||
8182 | unsigned int present; | ||
8183 | unsigned char bits; | ||
8184 | |||
8185 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
8186 | AC_VERB_GET_PIN_SENSE, 0) | ||
8187 | & AC_PINSENSE_PRESENCE; | ||
8188 | bits = present ? 0 : PIN_OUT; | ||
8189 | snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8190 | bits); | ||
8191 | snd_hda_codec_write(codec, 0x15, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8192 | bits); | ||
8193 | snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8194 | bits); | ||
8195 | } | ||
8196 | |||
8197 | static void alc883_mode2_unsol_event(struct hda_codec *codec, | ||
8198 | unsigned int res) | ||
8199 | { | ||
8200 | switch (res >> 26) { | ||
8201 | case ALC880_HP_EVENT: | ||
8202 | alc883_M90V_speaker_automute(codec); | ||
8203 | break; | ||
8204 | case ALC880_MIC_EVENT: | ||
8205 | alc883_nb_mic_automute(codec); | ||
8206 | break; | ||
8207 | } | ||
8208 | } | ||
8209 | |||
8210 | static void alc883_mode2_inithook(struct hda_codec *codec) | ||
8211 | { | ||
8212 | alc883_M90V_speaker_automute(codec); | ||
8213 | alc883_nb_mic_automute(codec); | ||
8214 | } | ||
8215 | |||
8216 | static struct hda_verb alc888_asus_eee1601_verbs[] = { | ||
8217 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
8218 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
8219 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
8220 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
8221 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
8222 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0b}, | ||
8223 | {0x20, AC_VERB_SET_PROC_COEF, 0x0838}, | ||
8224 | /* enable unsolicited event */ | ||
8225 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8226 | { } /* end */ | ||
8227 | }; | ||
8228 | |||
8229 | static void alc883_eee1601_speaker_automute(struct hda_codec *codec) | ||
8230 | { | ||
8231 | unsigned int present; | ||
8232 | unsigned char bits; | ||
8233 | |||
8234 | present = snd_hda_codec_read(codec, 0x14, 0, | ||
8235 | AC_VERB_GET_PIN_SENSE, 0) | ||
8236 | & AC_PINSENSE_PRESENCE; | ||
8237 | bits = present ? 0 : PIN_OUT; | ||
8238 | snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
8239 | bits); | ||
8240 | } | ||
8241 | |||
8242 | static void alc883_eee1601_unsol_event(struct hda_codec *codec, | ||
8243 | unsigned int res) | ||
8244 | { | ||
8245 | switch (res >> 26) { | ||
8246 | case ALC880_HP_EVENT: | ||
8247 | alc883_eee1601_speaker_automute(codec); | ||
8248 | break; | ||
8249 | } | ||
8250 | } | ||
8251 | |||
8252 | static void alc883_eee1601_inithook(struct hda_codec *codec) | ||
8253 | { | ||
8254 | alc883_eee1601_speaker_automute(codec); | ||
8255 | } | ||
8256 | |||
7901 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 8257 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
7902 | #define alc883_loopbacks alc880_loopbacks | 8258 | #define alc883_loopbacks alc880_loopbacks |
7903 | #endif | 8259 | #endif |
@@ -7927,6 +8283,7 @@ static const char *alc883_models[ALC883_MODEL_LAST] = { | |||
7927 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", | 8283 | [ALC883_LENOVO_101E_2ch] = "lenovo-101e", |
7928 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", | 8284 | [ALC883_LENOVO_NB0763] = "lenovo-nb0763", |
7929 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", | 8285 | [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig", |
8286 | [ALC888_LENOVO_SKY] = "lenovo-sky", | ||
7930 | [ALC883_HAIER_W66] = "haier-w66", | 8287 | [ALC883_HAIER_W66] = "haier-w66", |
7931 | [ALC888_3ST_HP] = "3stack-hp", | 8288 | [ALC888_3ST_HP] = "3stack-hp", |
7932 | [ALC888_6ST_DELL] = "6stack-dell", | 8289 | [ALC888_6ST_DELL] = "6stack-dell", |
@@ -7942,7 +8299,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7942 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8299 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
7943 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | 8300 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
7944 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | 8301 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
7945 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | 8302 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
7946 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | 8303 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ |
7947 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8304 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
7948 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8305 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
@@ -7950,10 +8307,13 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7950 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8307 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
7951 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8308 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
7952 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8309 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8310 | SND_PCI_QUIRK(0x1043, 0x8317, "Asus M90V", ALC888_ASUS_M90V), | ||
8311 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), | ||
7953 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), | 8312 | SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), |
7954 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), | 8313 | SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), |
7955 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), | 8314 | SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), |
7956 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), | 8315 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), |
8316 | SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL), | ||
7957 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), | 8317 | SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), |
7958 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), | 8318 | SND_PCI_QUIRK(0x1458, 0xa002, "MSI", ALC883_6ST_DIG), |
7959 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), | 8319 | SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG), |
@@ -7989,6 +8349,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
7989 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8349 | SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7990 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8350 | SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
7991 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), | 8351 | SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763), |
8352 | SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY), | ||
7992 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), | 8353 | SND_PCI_QUIRK(0x17c0, 0x4071, "MEDION MD2", ALC883_MEDION_MD2), |
7993 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), | 8354 | SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG), |
7994 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), | 8355 | SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66), |
@@ -8128,7 +8489,7 @@ static struct alc_config_preset alc883_presets[] = { | |||
8128 | .input_mux = &alc883_capture_source, | 8489 | .input_mux = &alc883_capture_source, |
8129 | .unsol_event = alc883_medion_md2_unsol_event, | 8490 | .unsol_event = alc883_medion_md2_unsol_event, |
8130 | .init_hook = alc883_medion_md2_automute, | 8491 | .init_hook = alc883_medion_md2_automute, |
8131 | }, | 8492 | }, |
8132 | [ALC883_LAPTOP_EAPD] = { | 8493 | [ALC883_LAPTOP_EAPD] = { |
8133 | .mixers = { alc883_base_mixer }, | 8494 | .mixers = { alc883_base_mixer }, |
8134 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, | 8495 | .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, |
@@ -8245,6 +8606,49 @@ static struct alc_config_preset alc883_presets[] = { | |||
8245 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, | 8606 | .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, |
8246 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, | 8607 | .init_hook = alc883_2ch_fujitsu_pi2515_automute, |
8247 | }, | 8608 | }, |
8609 | [ALC888_LENOVO_SKY] = { | ||
8610 | .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer }, | ||
8611 | .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs}, | ||
8612 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8613 | .dac_nids = alc883_dac_nids, | ||
8614 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8615 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | ||
8616 | .adc_nids = alc883_adc_nids, | ||
8617 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | ||
8618 | .channel_mode = alc883_sixstack_modes, | ||
8619 | .need_dac_fix = 1, | ||
8620 | .input_mux = &alc883_lenovo_sky_capture_source, | ||
8621 | .unsol_event = alc883_lenovo_sky_unsol_event, | ||
8622 | .init_hook = alc888_lenovo_sky_front_automute, | ||
8623 | }, | ||
8624 | [ALC888_ASUS_M90V] = { | ||
8625 | .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, | ||
8626 | .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs }, | ||
8627 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8628 | .dac_nids = alc883_dac_nids, | ||
8629 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8630 | .dig_in_nid = ALC883_DIGIN_NID, | ||
8631 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), | ||
8632 | .channel_mode = alc883_3ST_6ch_modes, | ||
8633 | .need_dac_fix = 1, | ||
8634 | .input_mux = &alc883_fujitsu_pi2515_capture_source, | ||
8635 | .unsol_event = alc883_mode2_unsol_event, | ||
8636 | .init_hook = alc883_mode2_inithook, | ||
8637 | }, | ||
8638 | [ALC888_ASUS_EEE1601] = { | ||
8639 | .mixers = { alc883_asus_eee1601_mixer }, | ||
8640 | .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs }, | ||
8641 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | ||
8642 | .dac_nids = alc883_dac_nids, | ||
8643 | .dig_out_nid = ALC883_DIGOUT_NID, | ||
8644 | .dig_in_nid = ALC883_DIGIN_NID, | ||
8645 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | ||
8646 | .channel_mode = alc883_3ST_2ch_modes, | ||
8647 | .need_dac_fix = 1, | ||
8648 | .input_mux = &alc883_asus_eee1601_capture_source, | ||
8649 | .unsol_event = alc883_eee1601_unsol_event, | ||
8650 | .init_hook = alc883_eee1601_inithook, | ||
8651 | }, | ||
8248 | }; | 8652 | }; |
8249 | 8653 | ||
8250 | 8654 | ||
@@ -8452,6 +8856,13 @@ static int patch_alc883(struct hda_codec *codec) | |||
8452 | #define alc262_modes alc260_modes | 8856 | #define alc262_modes alc260_modes |
8453 | #define alc262_capture_source alc882_capture_source | 8857 | #define alc262_capture_source alc882_capture_source |
8454 | 8858 | ||
8859 | static hda_nid_t alc262_dmic_adc_nids[1] = { | ||
8860 | /* ADC0 */ | ||
8861 | 0x09 | ||
8862 | }; | ||
8863 | |||
8864 | static hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 }; | ||
8865 | |||
8455 | static struct snd_kcontrol_new alc262_base_mixer[] = { | 8866 | static struct snd_kcontrol_new alc262_base_mixer[] = { |
8456 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 8867 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
8457 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 8868 | HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
@@ -8833,10 +9244,10 @@ static struct hda_verb alc262_init_verbs[] = { | |||
8833 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9244 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8834 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9245 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8835 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, | 9246 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, |
8836 | 9247 | ||
8837 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | 9248 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, |
8838 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 9249 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
8839 | 9250 | ||
8840 | /* FIXME: use matrix-type input source selection */ | 9251 | /* FIXME: use matrix-type input source selection */ |
8841 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ | 9252 | /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ |
8842 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | 9253 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ |
@@ -8858,6 +9269,12 @@ static struct hda_verb alc262_init_verbs[] = { | |||
8858 | { } | 9269 | { } |
8859 | }; | 9270 | }; |
8860 | 9271 | ||
9272 | static struct hda_verb alc262_eapd_verbs[] = { | ||
9273 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
9274 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
9275 | { } | ||
9276 | }; | ||
9277 | |||
8861 | static struct hda_verb alc262_hippo_unsol_verbs[] = { | 9278 | static struct hda_verb alc262_hippo_unsol_verbs[] = { |
8862 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 9279 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
8863 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 9280 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
@@ -8884,6 +9301,91 @@ static struct hda_verb alc262_sony_unsol_verbs[] = { | |||
8884 | {} | 9301 | {} |
8885 | }; | 9302 | }; |
8886 | 9303 | ||
9304 | static struct hda_input_mux alc262_dmic_capture_source = { | ||
9305 | .num_items = 2, | ||
9306 | .items = { | ||
9307 | { "Int DMic", 0x9 }, | ||
9308 | { "Mic", 0x0 }, | ||
9309 | }, | ||
9310 | }; | ||
9311 | |||
9312 | static struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = { | ||
9313 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
9314 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | ||
9315 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9316 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9317 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9318 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
9319 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
9320 | { | ||
9321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
9322 | /* The multiple "Capture Source" controls confuse alsamixer | ||
9323 | * So call somewhat different.. | ||
9324 | */ | ||
9325 | /* .name = "Capture Source", */ | ||
9326 | .name = "Input Source", | ||
9327 | .count = 1, | ||
9328 | .info = alc_mux_enum_info, | ||
9329 | .get = alc_mux_enum_get, | ||
9330 | .put = alc_mux_enum_put, | ||
9331 | }, | ||
9332 | { } /* end */ | ||
9333 | }; | ||
9334 | |||
9335 | static struct hda_verb alc262_toshiba_s06_verbs[] = { | ||
9336 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
9337 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
9338 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
9339 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
9340 | {0x22, AC_VERB_SET_CONNECT_SEL, 0x09}, | ||
9341 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | ||
9342 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
9343 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
9344 | {} | ||
9345 | }; | ||
9346 | |||
9347 | static void alc262_dmic_automute(struct hda_codec *codec) | ||
9348 | { | ||
9349 | unsigned int present; | ||
9350 | |||
9351 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
9352 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
9353 | snd_hda_codec_write(codec, 0x22, 0, | ||
9354 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x09); | ||
9355 | } | ||
9356 | |||
9357 | /* toggle speaker-output according to the hp-jack state */ | ||
9358 | static void alc262_toshiba_s06_speaker_automute(struct hda_codec *codec) | ||
9359 | { | ||
9360 | unsigned int present; | ||
9361 | unsigned char bits; | ||
9362 | |||
9363 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
9364 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
9365 | bits = present ? 0 : PIN_OUT; | ||
9366 | snd_hda_codec_write(codec, 0x14, 0, | ||
9367 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | ||
9368 | } | ||
9369 | |||
9370 | |||
9371 | |||
9372 | /* unsolicited event for HP jack sensing */ | ||
9373 | static void alc262_toshiba_s06_unsol_event(struct hda_codec *codec, | ||
9374 | unsigned int res) | ||
9375 | { | ||
9376 | if ((res >> 26) == ALC880_HP_EVENT) | ||
9377 | alc262_toshiba_s06_speaker_automute(codec); | ||
9378 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
9379 | alc262_dmic_automute(codec); | ||
9380 | |||
9381 | } | ||
9382 | |||
9383 | static void alc262_toshiba_s06_init_hook(struct hda_codec *codec) | ||
9384 | { | ||
9385 | alc262_toshiba_s06_speaker_automute(codec); | ||
9386 | alc262_dmic_automute(codec); | ||
9387 | } | ||
9388 | |||
8887 | /* mute/unmute internal speaker according to the hp jack and mute state */ | 9389 | /* mute/unmute internal speaker according to the hp jack and mute state */ |
8888 | static void alc262_hippo_automute(struct hda_codec *codec) | 9390 | static void alc262_hippo_automute(struct hda_codec *codec) |
8889 | { | 9391 | { |
@@ -8948,6 +9450,41 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec, | |||
8948 | } | 9450 | } |
8949 | 9451 | ||
8950 | /* | 9452 | /* |
9453 | * nec model | ||
9454 | * 0x15 = headphone | ||
9455 | * 0x16 = internal speaker | ||
9456 | * 0x18 = external mic | ||
9457 | */ | ||
9458 | |||
9459 | static struct snd_kcontrol_new alc262_nec_mixer[] = { | ||
9460 | HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), | ||
9461 | HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT), | ||
9462 | |||
9463 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9464 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9465 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
9466 | |||
9467 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
9468 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
9469 | { } /* end */ | ||
9470 | }; | ||
9471 | |||
9472 | static struct hda_verb alc262_nec_verbs[] = { | ||
9473 | /* Unmute Speaker */ | ||
9474 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
9475 | |||
9476 | /* Headphone */ | ||
9477 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
9478 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
9479 | |||
9480 | /* External mic to headphone */ | ||
9481 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
9482 | /* External mic to speaker */ | ||
9483 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
9484 | {} | ||
9485 | }; | ||
9486 | |||
9487 | /* | ||
8951 | * fujitsu model | 9488 | * fujitsu model |
8952 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, | 9489 | * 0x14 = headphone/spdif-out, 0x15 = internal speaker, |
8953 | * 0x1b = port replicator headphone out | 9490 | * 0x1b = port replicator headphone out |
@@ -9179,6 +9716,25 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = { | |||
9179 | { } /* end */ | 9716 | { } /* end */ |
9180 | }; | 9717 | }; |
9181 | 9718 | ||
9719 | static struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = { | ||
9720 | HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol), | ||
9721 | { | ||
9722 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
9723 | .name = "Master Playback Switch", | ||
9724 | .info = snd_hda_mixer_amp_switch_info, | ||
9725 | .get = snd_hda_mixer_amp_switch_get, | ||
9726 | .put = alc262_sony_master_sw_put, | ||
9727 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
9728 | }, | ||
9729 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9730 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9731 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
9732 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
9733 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
9734 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
9735 | { } /* end */ | ||
9736 | }; | ||
9737 | |||
9182 | /* additional init verbs for Benq laptops */ | 9738 | /* additional init verbs for Benq laptops */ |
9183 | static struct hda_verb alc262_EAPD_verbs[] = { | 9739 | static struct hda_verb alc262_EAPD_verbs[] = { |
9184 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, | 9740 | {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, |
@@ -9427,7 +9983,7 @@ static struct hda_verb alc262_volume_init_verbs[] = { | |||
9427 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 9983 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9428 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 9984 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9429 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 9985 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
9430 | 9986 | ||
9431 | /* set up input amps for analog loopback */ | 9987 | /* set up input amps for analog loopback */ |
9432 | /* Amp Indices: DAC = 0, mixer = 1 */ | 9988 | /* Amp Indices: DAC = 0, mixer = 1 */ |
9433 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 9989 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -9482,7 +10038,7 @@ static struct hda_verb alc262_HP_BPC_init_verbs[] = { | |||
9482 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 10038 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
9483 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | 10039 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
9484 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, | 10040 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, |
9485 | 10041 | ||
9486 | /* | 10042 | /* |
9487 | * Set up output mixers (0x0c - 0x0e) | 10043 | * Set up output mixers (0x0c - 0x0e) |
9488 | */ | 10044 | */ |
@@ -9643,6 +10199,24 @@ static struct hda_verb alc262_HP_BPC_WildWest_init_verbs[] = { | |||
9643 | { } | 10199 | { } |
9644 | }; | 10200 | }; |
9645 | 10201 | ||
10202 | static struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = { | ||
10203 | |||
10204 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */ | ||
10205 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
10206 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
10207 | |||
10208 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */ | ||
10209 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */ | ||
10210 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
10211 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) }, | ||
10212 | |||
10213 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */ | ||
10214 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
10215 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
10216 | {} | ||
10217 | }; | ||
10218 | |||
10219 | |||
9646 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 10220 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
9647 | #define alc262_loopbacks alc880_loopbacks | 10221 | #define alc262_loopbacks alc880_loopbacks |
9648 | #endif | 10222 | #endif |
@@ -9729,13 +10303,17 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { | |||
9729 | [ALC262_BENQ_ED8] = "benq", | 10303 | [ALC262_BENQ_ED8] = "benq", |
9730 | [ALC262_BENQ_T31] = "benq-t31", | 10304 | [ALC262_BENQ_T31] = "benq-t31", |
9731 | [ALC262_SONY_ASSAMD] = "sony-assamd", | 10305 | [ALC262_SONY_ASSAMD] = "sony-assamd", |
10306 | [ALC262_TOSHIBA_S06] = "toshiba-s06", | ||
10307 | [ALC262_TOSHIBA_RX1] = "toshiba-rx1", | ||
9732 | [ALC262_ULTRA] = "ultra", | 10308 | [ALC262_ULTRA] = "ultra", |
9733 | [ALC262_LENOVO_3000] = "lenovo-3000", | 10309 | [ALC262_LENOVO_3000] = "lenovo-3000", |
10310 | [ALC262_NEC] = "nec", | ||
9734 | [ALC262_AUTO] = "auto", | 10311 | [ALC262_AUTO] = "auto", |
9735 | }; | 10312 | }; |
9736 | 10313 | ||
9737 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | 10314 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
9738 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | 10315 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
10316 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | ||
9739 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), | 10317 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), |
9740 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), | 10318 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), |
9741 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), | 10319 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), |
@@ -9764,7 +10342,8 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
9764 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), | 10342 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
9765 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), | 10343 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), |
9766 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | 10344 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
9767 | ALC262_SONY_ASSAMD), | 10345 | ALC262_TOSHIBA_RX1), |
10346 | SND_PCI_QUIRK(0x1179, 0x0268, "Toshiba S06", ALC262_TOSHIBA_S06), | ||
9768 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | 10347 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
9769 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | 10348 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
9770 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), | 10349 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), |
@@ -9918,7 +10497,7 @@ static struct alc_config_preset alc262_presets[] = { | |||
9918 | .input_mux = &alc262_capture_source, | 10497 | .input_mux = &alc262_capture_source, |
9919 | .unsol_event = alc262_hippo_unsol_event, | 10498 | .unsol_event = alc262_hippo_unsol_event, |
9920 | .init_hook = alc262_hippo_automute, | 10499 | .init_hook = alc262_hippo_automute, |
9921 | }, | 10500 | }, |
9922 | [ALC262_ULTRA] = { | 10501 | [ALC262_ULTRA] = { |
9923 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, | 10502 | .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer }, |
9924 | .init_verbs = { alc262_ultra_verbs }, | 10503 | .init_verbs = { alc262_ultra_verbs }, |
@@ -9946,6 +10525,43 @@ static struct alc_config_preset alc262_presets[] = { | |||
9946 | .input_mux = &alc262_fujitsu_capture_source, | 10525 | .input_mux = &alc262_fujitsu_capture_source, |
9947 | .unsol_event = alc262_lenovo_3000_unsol_event, | 10526 | .unsol_event = alc262_lenovo_3000_unsol_event, |
9948 | }, | 10527 | }, |
10528 | [ALC262_NEC] = { | ||
10529 | .mixers = { alc262_nec_mixer }, | ||
10530 | .init_verbs = { alc262_nec_verbs }, | ||
10531 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10532 | .dac_nids = alc262_dac_nids, | ||
10533 | .hp_nid = 0x03, | ||
10534 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10535 | .channel_mode = alc262_modes, | ||
10536 | .input_mux = &alc262_capture_source, | ||
10537 | }, | ||
10538 | [ALC262_TOSHIBA_S06] = { | ||
10539 | .mixers = { alc262_toshiba_s06_mixer }, | ||
10540 | .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs, | ||
10541 | alc262_eapd_verbs }, | ||
10542 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10543 | .capsrc_nids = alc262_dmic_capsrc_nids, | ||
10544 | .dac_nids = alc262_dac_nids, | ||
10545 | .adc_nids = alc262_dmic_adc_nids, /* ADC0 */ | ||
10546 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
10547 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10548 | .channel_mode = alc262_modes, | ||
10549 | .input_mux = &alc262_dmic_capture_source, | ||
10550 | .unsol_event = alc262_toshiba_s06_unsol_event, | ||
10551 | .init_hook = alc262_toshiba_s06_init_hook, | ||
10552 | }, | ||
10553 | [ALC262_TOSHIBA_RX1] = { | ||
10554 | .mixers = { alc262_toshiba_rx1_mixer }, | ||
10555 | .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs }, | ||
10556 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
10557 | .dac_nids = alc262_dac_nids, | ||
10558 | .hp_nid = 0x03, | ||
10559 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
10560 | .channel_mode = alc262_modes, | ||
10561 | .input_mux = &alc262_capture_source, | ||
10562 | .unsol_event = alc262_hippo_unsol_event, | ||
10563 | .init_hook = alc262_hippo_automute, | ||
10564 | }, | ||
9949 | }; | 10565 | }; |
9950 | 10566 | ||
9951 | static int patch_alc262(struct hda_codec *codec) | 10567 | static int patch_alc262(struct hda_codec *codec) |
@@ -10004,7 +10620,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10004 | spec->stream_name_analog = "ALC262 Analog"; | 10620 | spec->stream_name_analog = "ALC262 Analog"; |
10005 | spec->stream_analog_playback = &alc262_pcm_analog_playback; | 10621 | spec->stream_analog_playback = &alc262_pcm_analog_playback; |
10006 | spec->stream_analog_capture = &alc262_pcm_analog_capture; | 10622 | spec->stream_analog_capture = &alc262_pcm_analog_capture; |
10007 | 10623 | ||
10008 | spec->stream_name_digital = "ALC262 Digital"; | 10624 | spec->stream_name_digital = "ALC262 Digital"; |
10009 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | 10625 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
10010 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | 10626 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
@@ -10040,7 +10656,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10040 | if (!spec->loopback.amplist) | 10656 | if (!spec->loopback.amplist) |
10041 | spec->loopback.amplist = alc262_loopbacks; | 10657 | spec->loopback.amplist = alc262_loopbacks; |
10042 | #endif | 10658 | #endif |
10043 | 10659 | ||
10044 | return 0; | 10660 | return 0; |
10045 | } | 10661 | } |
10046 | 10662 | ||
@@ -10049,7 +10665,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10049 | */ | 10665 | */ |
10050 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID | 10666 | #define ALC268_DIGOUT_NID ALC880_DIGOUT_NID |
10051 | #define alc268_modes alc260_modes | 10667 | #define alc268_modes alc260_modes |
10052 | 10668 | ||
10053 | static hda_nid_t alc268_dac_nids[2] = { | 10669 | static hda_nid_t alc268_dac_nids[2] = { |
10054 | /* front, hp */ | 10670 | /* front, hp */ |
10055 | 0x02, 0x03 | 10671 | 0x02, 0x03 |
@@ -10109,6 +10725,14 @@ static struct hda_verb alc268_toshiba_verbs[] = { | |||
10109 | { } /* end */ | 10725 | { } /* end */ |
10110 | }; | 10726 | }; |
10111 | 10727 | ||
10728 | static struct hda_input_mux alc268_acer_lc_capture_source = { | ||
10729 | .num_items = 2, | ||
10730 | .items = { | ||
10731 | { "i-Mic", 0x6 }, | ||
10732 | { "E-Mic", 0x0 }, | ||
10733 | }, | ||
10734 | }; | ||
10735 | |||
10112 | /* Acer specific */ | 10736 | /* Acer specific */ |
10113 | /* bind volumes of both NID 0x02 and 0x03 */ | 10737 | /* bind volumes of both NID 0x02 and 0x03 */ |
10114 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { | 10738 | static struct hda_bind_ctls alc268_acer_bind_master_vol = { |
@@ -10161,6 +10785,21 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, | |||
10161 | return change; | 10785 | return change; |
10162 | } | 10786 | } |
10163 | 10787 | ||
10788 | static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = { | ||
10789 | /* output mixer control */ | ||
10790 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
10791 | { | ||
10792 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
10793 | .name = "Master Playback Switch", | ||
10794 | .info = snd_hda_mixer_amp_switch_info, | ||
10795 | .get = snd_hda_mixer_amp_switch_get, | ||
10796 | .put = alc268_acer_master_sw_put, | ||
10797 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
10798 | }, | ||
10799 | HDA_CODEC_VOLUME("Mic Boost Capture Volume", 0x18, 0, HDA_INPUT), | ||
10800 | { } | ||
10801 | }; | ||
10802 | |||
10164 | static struct snd_kcontrol_new alc268_acer_mixer[] = { | 10803 | static struct snd_kcontrol_new alc268_acer_mixer[] = { |
10165 | /* output mixer control */ | 10804 | /* output mixer control */ |
10166 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | 10805 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), |
@@ -10178,6 +10817,16 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = { | |||
10178 | { } | 10817 | { } |
10179 | }; | 10818 | }; |
10180 | 10819 | ||
10820 | static struct hda_verb alc268_acer_aspire_one_verbs[] = { | ||
10821 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
10822 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
10823 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
10824 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
10825 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x06}, | ||
10826 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, 0xa017}, | ||
10827 | { } | ||
10828 | }; | ||
10829 | |||
10181 | static struct hda_verb alc268_acer_verbs[] = { | 10830 | static struct hda_verb alc268_acer_verbs[] = { |
10182 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ | 10831 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* internal dmic? */ |
10183 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 10832 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
@@ -10185,7 +10834,6 @@ static struct hda_verb alc268_acer_verbs[] = { | |||
10185 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 10834 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
10186 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 10835 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10187 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 10836 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
10188 | |||
10189 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 10837 | {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
10190 | { } | 10838 | { } |
10191 | }; | 10839 | }; |
@@ -10212,6 +10860,47 @@ static void alc268_acer_init_hook(struct hda_codec *codec) | |||
10212 | alc268_acer_automute(codec, 1); | 10860 | alc268_acer_automute(codec, 1); |
10213 | } | 10861 | } |
10214 | 10862 | ||
10863 | /* toggle speaker-output according to the hp-jack state */ | ||
10864 | static void alc268_aspire_one_speaker_automute(struct hda_codec *codec) | ||
10865 | { | ||
10866 | unsigned int present; | ||
10867 | unsigned char bits; | ||
10868 | |||
10869 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
10870 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10871 | bits = present ? AMP_IN_MUTE(0) : 0; | ||
10872 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 0, | ||
10873 | AMP_IN_MUTE(0), bits); | ||
10874 | snd_hda_codec_amp_stereo(codec, 0x0f, HDA_INPUT, 1, | ||
10875 | AMP_IN_MUTE(0), bits); | ||
10876 | } | ||
10877 | |||
10878 | |||
10879 | static void alc268_acer_mic_automute(struct hda_codec *codec) | ||
10880 | { | ||
10881 | unsigned int present; | ||
10882 | |||
10883 | present = snd_hda_codec_read(codec, 0x18, 0, | ||
10884 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
10885 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | ||
10886 | present ? 0x0 : 0x6); | ||
10887 | } | ||
10888 | |||
10889 | static void alc268_acer_lc_unsol_event(struct hda_codec *codec, | ||
10890 | unsigned int res) | ||
10891 | { | ||
10892 | if ((res >> 26) == ALC880_HP_EVENT) | ||
10893 | alc268_aspire_one_speaker_automute(codec); | ||
10894 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
10895 | alc268_acer_mic_automute(codec); | ||
10896 | } | ||
10897 | |||
10898 | static void alc268_acer_lc_init_hook(struct hda_codec *codec) | ||
10899 | { | ||
10900 | alc268_aspire_one_speaker_automute(codec); | ||
10901 | alc268_acer_mic_automute(codec); | ||
10902 | } | ||
10903 | |||
10215 | static struct snd_kcontrol_new alc268_dell_mixer[] = { | 10904 | static struct snd_kcontrol_new alc268_dell_mixer[] = { |
10216 | /* output mixer control */ | 10905 | /* output mixer control */ |
10217 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 10906 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
@@ -10360,7 +11049,7 @@ static struct hda_verb alc268_base_init_verbs[] = { | |||
10360 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11049 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
10361 | 11050 | ||
10362 | /* Unmute Selector 23h,24h and set the default input to mic-in */ | 11051 | /* Unmute Selector 23h,24h and set the default input to mic-in */ |
10363 | 11052 | ||
10364 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11053 | {0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, |
10365 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11054 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
10366 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11055 | {0x24, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -10559,7 +11248,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
10559 | 11248 | ||
10560 | nid = cfg->line_out_pins[0]; | 11249 | nid = cfg->line_out_pins[0]; |
10561 | if (nid) | 11250 | if (nid) |
10562 | alc268_new_analog_output(spec, nid, "Front", 0); | 11251 | alc268_new_analog_output(spec, nid, "Front", 0); |
10563 | 11252 | ||
10564 | nid = cfg->speaker_pins[0]; | 11253 | nid = cfg->speaker_pins[0]; |
10565 | if (nid == 0x1d) { | 11254 | if (nid == 0x1d) { |
@@ -10581,7 +11270,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
10581 | if (err < 0) | 11270 | if (err < 0) |
10582 | return err; | 11271 | return err; |
10583 | } | 11272 | } |
10584 | return 0; | 11273 | return 0; |
10585 | } | 11274 | } |
10586 | 11275 | ||
10587 | /* create playback/capture controls for input pins */ | 11276 | /* create playback/capture controls for input pins */ |
@@ -10602,7 +11291,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
10602 | case 0x1a: | 11291 | case 0x1a: |
10603 | idx1 = 2; /* Line In */ | 11292 | idx1 = 2; /* Line In */ |
10604 | break; | 11293 | break; |
10605 | case 0x1c: | 11294 | case 0x1c: |
10606 | idx1 = 3; /* CD */ | 11295 | idx1 = 3; /* CD */ |
10607 | break; | 11296 | break; |
10608 | case 0x12: | 11297 | case 0x12: |
@@ -10614,7 +11303,7 @@ static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
10614 | } | 11303 | } |
10615 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; | 11304 | imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; |
10616 | imux->items[imux->num_items].index = idx1; | 11305 | imux->items[imux->num_items].index = idx1; |
10617 | imux->num_items++; | 11306 | imux->num_items++; |
10618 | } | 11307 | } |
10619 | return 0; | 11308 | return 0; |
10620 | } | 11309 | } |
@@ -10644,11 +11333,11 @@ static void alc268_auto_init_mono_speaker_out(struct hda_codec *codec) | |||
10644 | } | 11333 | } |
10645 | 11334 | ||
10646 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ | 11335 | dac_vol1 = dac_vol2 = 0xb000 | 0x40; /* set max volume */ |
10647 | if (line_nid == 0x14) | 11336 | if (line_nid == 0x14) |
10648 | dac_vol2 = AMP_OUT_ZERO; | 11337 | dac_vol2 = AMP_OUT_ZERO; |
10649 | else if (line_nid == 0x15) | 11338 | else if (line_nid == 0x15) |
10650 | dac_vol1 = AMP_OUT_ZERO; | 11339 | dac_vol1 = AMP_OUT_ZERO; |
10651 | if (hp_nid == 0x14) | 11340 | if (hp_nid == 0x14) |
10652 | dac_vol2 = AMP_OUT_ZERO; | 11341 | dac_vol2 = AMP_OUT_ZERO; |
10653 | else if (hp_nid == 0x15) | 11342 | else if (hp_nid == 0x15) |
10654 | dac_vol1 = AMP_OUT_ZERO; | 11343 | dac_vol1 = AMP_OUT_ZERO; |
@@ -10739,6 +11428,7 @@ static const char *alc268_models[ALC268_MODEL_LAST] = { | |||
10739 | [ALC268_3ST] = "3stack", | 11428 | [ALC268_3ST] = "3stack", |
10740 | [ALC268_TOSHIBA] = "toshiba", | 11429 | [ALC268_TOSHIBA] = "toshiba", |
10741 | [ALC268_ACER] = "acer", | 11430 | [ALC268_ACER] = "acer", |
11431 | [ALC268_ACER_ASPIRE_ONE] = "acer-aspire", | ||
10742 | [ALC268_DELL] = "dell", | 11432 | [ALC268_DELL] = "dell", |
10743 | [ALC268_ZEPTO] = "zepto", | 11433 | [ALC268_ZEPTO] = "zepto", |
10744 | #ifdef CONFIG_SND_DEBUG | 11434 | #ifdef CONFIG_SND_DEBUG |
@@ -10753,11 +11443,14 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
10753 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), | 11443 | SND_PCI_QUIRK(0x1025, 0x012e, "Acer Aspire 5310", ALC268_ACER), |
10754 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), | 11444 | SND_PCI_QUIRK(0x1025, 0x0130, "Acer Extensa 5210", ALC268_ACER), |
10755 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), | 11445 | SND_PCI_QUIRK(0x1025, 0x0136, "Acer Aspire 5315", ALC268_ACER), |
11446 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", | ||
11447 | ALC268_ACER_ASPIRE_ONE), | ||
10756 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), | 11448 | SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), |
10757 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), | 11449 | SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), |
10758 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), | 11450 | SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), |
10759 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), | 11451 | SND_PCI_QUIRK(0x1179, 0xff10, "TOSHIBA A205", ALC268_TOSHIBA), |
10760 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), | 11452 | SND_PCI_QUIRK(0x1179, 0xff50, "TOSHIBA A305", ALC268_TOSHIBA), |
11453 | SND_PCI_QUIRK(0x1179, 0xff64, "TOSHIBA L305", ALC268_TOSHIBA), | ||
10761 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), | 11454 | SND_PCI_QUIRK(0x14c0, 0x0025, "COMPAL IFL90/JFL-92", ALC268_TOSHIBA), |
10762 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), | 11455 | SND_PCI_QUIRK(0x152d, 0x0763, "Diverse (CPR2000)", ALC268_ACER), |
10763 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), | 11456 | SND_PCI_QUIRK(0x152d, 0x0771, "Quanta IL1", ALC267_QUANTA_IL1), |
@@ -10830,6 +11523,23 @@ static struct alc_config_preset alc268_presets[] = { | |||
10830 | .unsol_event = alc268_acer_unsol_event, | 11523 | .unsol_event = alc268_acer_unsol_event, |
10831 | .init_hook = alc268_acer_init_hook, | 11524 | .init_hook = alc268_acer_init_hook, |
10832 | }, | 11525 | }, |
11526 | [ALC268_ACER_ASPIRE_ONE] = { | ||
11527 | .mixers = { alc268_acer_aspire_one_mixer, | ||
11528 | alc268_capture_alt_mixer }, | ||
11529 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | ||
11530 | alc268_acer_aspire_one_verbs }, | ||
11531 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | ||
11532 | .dac_nids = alc268_dac_nids, | ||
11533 | .num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt), | ||
11534 | .adc_nids = alc268_adc_nids_alt, | ||
11535 | .capsrc_nids = alc268_capsrc_nids, | ||
11536 | .hp_nid = 0x03, | ||
11537 | .num_channel_mode = ARRAY_SIZE(alc268_modes), | ||
11538 | .channel_mode = alc268_modes, | ||
11539 | .input_mux = &alc268_acer_lc_capture_source, | ||
11540 | .unsol_event = alc268_acer_lc_unsol_event, | ||
11541 | .init_hook = alc268_acer_lc_init_hook, | ||
11542 | }, | ||
10833 | [ALC268_DELL] = { | 11543 | [ALC268_DELL] = { |
10834 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, | 11544 | .mixers = { alc268_dell_mixer, alc268_beep_mixer }, |
10835 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 11545 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
@@ -10974,7 +11684,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
10974 | codec->patch_ops = alc_patch_ops; | 11684 | codec->patch_ops = alc_patch_ops; |
10975 | if (board_config == ALC268_AUTO) | 11685 | if (board_config == ALC268_AUTO) |
10976 | spec->init_hook = alc268_auto_init; | 11686 | spec->init_hook = alc268_auto_init; |
10977 | 11687 | ||
10978 | return 0; | 11688 | return 0; |
10979 | } | 11689 | } |
10980 | 11690 | ||
@@ -10990,6 +11700,14 @@ static hda_nid_t alc269_adc_nids[1] = { | |||
10990 | 0x08, | 11700 | 0x08, |
10991 | }; | 11701 | }; |
10992 | 11702 | ||
11703 | static hda_nid_t alc269_capsrc_nids[1] = { | ||
11704 | 0x23, | ||
11705 | }; | ||
11706 | |||
11707 | /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24), | ||
11708 | * not a mux! | ||
11709 | */ | ||
11710 | |||
10993 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { | 11711 | static struct hda_input_mux alc269_eeepc_dmic_capture_source = { |
10994 | .num_items = 2, | 11712 | .num_items = 2, |
10995 | .items = { | 11713 | .items = { |
@@ -11016,6 +11734,8 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { | |||
11016 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 11734 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
11017 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 11735 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
11018 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 11736 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
11737 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | ||
11738 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | ||
11019 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 11739 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
11020 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 11740 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
11021 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 11741 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
@@ -11025,6 +11745,28 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { | |||
11025 | { } /* end */ | 11745 | { } /* end */ |
11026 | }; | 11746 | }; |
11027 | 11747 | ||
11748 | static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | ||
11749 | /* output mixer control */ | ||
11750 | HDA_BIND_VOL("Master Playback Volume", &alc268_acer_bind_master_vol), | ||
11751 | { | ||
11752 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
11753 | .name = "Master Playback Switch", | ||
11754 | .info = snd_hda_mixer_amp_switch_info, | ||
11755 | .get = snd_hda_mixer_amp_switch_get, | ||
11756 | .put = alc268_acer_master_sw_put, | ||
11757 | .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
11758 | }, | ||
11759 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
11760 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
11761 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
11762 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
11763 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
11764 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | ||
11765 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
11766 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
11767 | { } | ||
11768 | }; | ||
11769 | |||
11028 | /* bind volumes of both NID 0x0c and 0x0d */ | 11770 | /* bind volumes of both NID 0x0c and 0x0d */ |
11029 | static struct hda_bind_ctls alc269_epc_bind_vol = { | 11771 | static struct hda_bind_ctls alc269_epc_bind_vol = { |
11030 | .ops = &snd_hda_bind_vol, | 11772 | .ops = &snd_hda_bind_vol, |
@@ -11068,75 +11810,72 @@ static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { | |||
11068 | { } /* end */ | 11810 | { } /* end */ |
11069 | }; | 11811 | }; |
11070 | 11812 | ||
11071 | /* | 11813 | /* beep control */ |
11072 | * generic initialization of ADC, input mixers and output mixers | 11814 | static struct snd_kcontrol_new alc269_beep_mixer[] = { |
11073 | */ | 11815 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), |
11074 | static struct hda_verb alc269_init_verbs[] = { | 11816 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), |
11075 | /* | 11817 | { } /* end */ |
11076 | * Unmute ADC0 and set the default input to mic-in | 11818 | }; |
11077 | */ | ||
11078 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11079 | 11819 | ||
11080 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | 11820 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
11081 | * analog-loopback mixer widget | 11821 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
11082 | * Note: PASD motherboards uses the Line In 2 as the input for | 11822 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
11083 | * front panel mic (mic 2) | 11823 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
11084 | */ | 11824 | {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 */ | 11825 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
11086 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 11826 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
11087 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11827 | { } |
11088 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | 11828 | }; |
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 | 11829 | ||
11092 | /* | 11830 | /* toggle speaker-output according to the hp-jack state */ |
11093 | * Set up output mixers (0x0c - 0x0e) | 11831 | static void alc269_quanta_fl1_speaker_automute(struct hda_codec *codec) |
11094 | */ | 11832 | { |
11095 | /* set vol=0 to output mixers */ | 11833 | unsigned int present; |
11096 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 11834 | unsigned char bits; |
11097 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11098 | 11835 | ||
11099 | /* set up input amps for analog loopback */ | 11836 | present = snd_hda_codec_read(codec, 0x15, 0, |
11100 | /* Amp Indices: DAC = 0, mixer = 1 */ | 11837 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11101 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11838 | bits = present ? AMP_IN_MUTE(0) : 0; |
11102 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 11839 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
11103 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11840 | AMP_IN_MUTE(0), bits); |
11104 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 11841 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
11105 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11842 | AMP_IN_MUTE(0), bits); |
11106 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11107 | 11843 | ||
11108 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 11844 | snd_hda_codec_write(codec, 0x20, 0, |
11109 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 11845 | AC_VERB_SET_COEF_INDEX, 0x0c); |
11110 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 11846 | snd_hda_codec_write(codec, 0x20, 0, |
11111 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 11847 | 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 | 11848 | ||
11116 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11849 | snd_hda_codec_write(codec, 0x20, 0, |
11117 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 11850 | AC_VERB_SET_COEF_INDEX, 0x0c); |
11118 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11851 | snd_hda_codec_write(codec, 0x20, 0, |
11119 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11852 | AC_VERB_SET_PROC_COEF, 0x480); |
11120 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11853 | } |
11121 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11122 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11123 | 11854 | ||
11124 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11855 | static void alc269_quanta_fl1_mic_automute(struct hda_codec *codec) |
11125 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11856 | { |
11857 | unsigned int present; | ||
11126 | 11858 | ||
11127 | /* FIXME: use matrix-type input source selection */ | 11859 | present = snd_hda_codec_read(codec, 0x18, 0, |
11128 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | 11860 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11129 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | 11861 | snd_hda_codec_write(codec, 0x23, 0, |
11130 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11862 | AC_VERB_SET_CONNECT_SEL, present ? 0x0 : 0x1); |
11131 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 11863 | } |
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 | 11864 | ||
11135 | /* set EAPD */ | 11865 | static void alc269_quanta_fl1_unsol_event(struct hda_codec *codec, |
11136 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 11866 | unsigned int res) |
11137 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | 11867 | { |
11138 | { } | 11868 | if ((res >> 26) == ALC880_HP_EVENT) |
11139 | }; | 11869 | alc269_quanta_fl1_speaker_automute(codec); |
11870 | if ((res >> 26) == ALC880_MIC_EVENT) | ||
11871 | alc269_quanta_fl1_mic_automute(codec); | ||
11872 | } | ||
11873 | |||
11874 | static void alc269_quanta_fl1_init_hook(struct hda_codec *codec) | ||
11875 | { | ||
11876 | alc269_quanta_fl1_speaker_automute(codec); | ||
11877 | alc269_quanta_fl1_mic_automute(codec); | ||
11878 | } | ||
11140 | 11879 | ||
11141 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { | 11880 | static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { |
11142 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 11881 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
@@ -11163,42 +11902,42 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |||
11163 | static void alc269_speaker_automute(struct hda_codec *codec) | 11902 | static void alc269_speaker_automute(struct hda_codec *codec) |
11164 | { | 11903 | { |
11165 | unsigned int present; | 11904 | unsigned int present; |
11166 | unsigned int bits; | 11905 | unsigned char bits; |
11167 | 11906 | ||
11168 | present = snd_hda_codec_read(codec, 0x15, 0, | 11907 | present = snd_hda_codec_read(codec, 0x15, 0, |
11169 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 11908 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11170 | bits = present ? AMP_IN_MUTE(0) : 0; | 11909 | bits = present ? AMP_IN_MUTE(0) : 0; |
11171 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 11910 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
11172 | AMP_IN_MUTE(0), bits); | 11911 | AMP_IN_MUTE(0), bits); |
11173 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | 11912 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, |
11174 | AMP_IN_MUTE(0), bits); | 11913 | AMP_IN_MUTE(0), bits); |
11175 | } | 11914 | } |
11176 | 11915 | ||
11177 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) | 11916 | static void alc269_eeepc_dmic_automute(struct hda_codec *codec) |
11178 | { | 11917 | { |
11179 | unsigned int present; | 11918 | unsigned int present; |
11180 | 11919 | ||
11181 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) | 11920 | present = snd_hda_codec_read(codec, 0x18, 0, |
11182 | & AC_PINSENSE_PRESENCE; | 11921 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11183 | snd_hda_codec_write(codec, 0x23, 0, AC_VERB_SET_CONNECT_SEL, | 11922 | snd_hda_codec_write(codec, 0x23, 0, |
11184 | present ? 0 : 5); | 11923 | AC_VERB_SET_CONNECT_SEL, (present ? 0 : 5)); |
11185 | } | 11924 | } |
11186 | 11925 | ||
11187 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) | 11926 | static void alc269_eeepc_amic_automute(struct hda_codec *codec) |
11188 | { | 11927 | { |
11189 | unsigned int present; | 11928 | unsigned int present; |
11190 | 11929 | ||
11191 | present = snd_hda_codec_read(codec, 0x18, 0, AC_VERB_GET_PIN_SENSE, 0) | 11930 | present = snd_hda_codec_read(codec, 0x18, 0, |
11192 | & AC_PINSENSE_PRESENCE; | 11931 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
11193 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 11932 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
11194 | present ? AMP_IN_UNMUTE(0) : AMP_IN_MUTE(0)); | 11933 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
11195 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 11934 | snd_hda_codec_write(codec, 0x24, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
11196 | present ? AMP_IN_MUTE(1) : AMP_IN_UNMUTE(1)); | 11935 | 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); |
11197 | } | 11936 | } |
11198 | 11937 | ||
11199 | /* unsolicited event for HP jack sensing */ | 11938 | /* unsolicited event for HP jack sensing */ |
11200 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, | 11939 | static void alc269_eeepc_dmic_unsol_event(struct hda_codec *codec, |
11201 | unsigned int res) | 11940 | unsigned int res) |
11202 | { | 11941 | { |
11203 | if ((res >> 26) == ALC880_HP_EVENT) | 11942 | if ((res >> 26) == ALC880_HP_EVENT) |
11204 | alc269_speaker_automute(codec); | 11943 | alc269_speaker_automute(codec); |
@@ -11215,7 +11954,7 @@ static void alc269_eeepc_dmic_inithook(struct hda_codec *codec) | |||
11215 | 11954 | ||
11216 | /* unsolicited event for HP jack sensing */ | 11955 | /* unsolicited event for HP jack sensing */ |
11217 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, | 11956 | static void alc269_eeepc_amic_unsol_event(struct hda_codec *codec, |
11218 | unsigned int res) | 11957 | unsigned int res) |
11219 | { | 11958 | { |
11220 | if ((res >> 26) == ALC880_HP_EVENT) | 11959 | if ((res >> 26) == ALC880_HP_EVENT) |
11221 | alc269_speaker_automute(codec); | 11960 | alc269_speaker_automute(codec); |
@@ -11230,6 +11969,76 @@ static void alc269_eeepc_amic_inithook(struct hda_codec *codec) | |||
11230 | alc269_eeepc_amic_automute(codec); | 11969 | alc269_eeepc_amic_automute(codec); |
11231 | } | 11970 | } |
11232 | 11971 | ||
11972 | /* | ||
11973 | * generic initialization of ADC, input mixers and output mixers | ||
11974 | */ | ||
11975 | static struct hda_verb alc269_init_verbs[] = { | ||
11976 | /* | ||
11977 | * Unmute ADC0 and set the default input to mic-in | ||
11978 | */ | ||
11979 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11980 | |||
11981 | /* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the | ||
11982 | * analog-loopback mixer widget | ||
11983 | * Note: PASD motherboards uses the Line In 2 as the input for | ||
11984 | * front panel mic (mic 2) | ||
11985 | */ | ||
11986 | /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ | ||
11987 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
11988 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
11989 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
11990 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
11991 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | ||
11992 | |||
11993 | /* | ||
11994 | * Set up output mixers (0x0c - 0x0e) | ||
11995 | */ | ||
11996 | /* set vol=0 to output mixers */ | ||
11997 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11998 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11999 | |||
12000 | /* set up input amps for analog loopback */ | ||
12001 | /* Amp Indices: DAC = 0, mixer = 1 */ | ||
12002 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12003 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12004 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12005 | {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12006 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
12007 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12008 | |||
12009 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
12010 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
12011 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
12012 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
12013 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
12014 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
12015 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
12016 | |||
12017 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
12018 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
12019 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12020 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12021 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12022 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12023 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
12024 | |||
12025 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
12026 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
12027 | |||
12028 | /* FIXME: use matrix-type input source selection */ | ||
12029 | /* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ | ||
12030 | /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ | ||
12031 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
12032 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
12033 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, | ||
12034 | {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, | ||
12035 | |||
12036 | /* set EAPD */ | ||
12037 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
12038 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, | ||
12039 | { } | ||
12040 | }; | ||
12041 | |||
11233 | /* add playback controls from the parsed DAC table */ | 12042 | /* add playback controls from the parsed DAC table */ |
11234 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | 12043 | static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, |
11235 | const struct auto_pin_cfg *cfg) | 12044 | const struct auto_pin_cfg *cfg) |
@@ -11330,7 +12139,7 @@ static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11330 | static int alc269_parse_auto_config(struct hda_codec *codec) | 12139 | static int alc269_parse_auto_config(struct hda_codec *codec) |
11331 | { | 12140 | { |
11332 | struct alc_spec *spec = codec->spec; | 12141 | struct alc_spec *spec = codec->spec; |
11333 | int err; | 12142 | int i, err; |
11334 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | 12143 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
11335 | 12144 | ||
11336 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 12145 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
@@ -11353,9 +12162,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
11353 | if (spec->kctl_alloc) | 12162 | if (spec->kctl_alloc) |
11354 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 12163 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
11355 | 12164 | ||
12165 | /* create a beep mixer control if the pin 0x1d isn't assigned */ | ||
12166 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) | ||
12167 | if (spec->autocfg.input_pins[i] == 0x1d) | ||
12168 | break; | ||
12169 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) | ||
12170 | spec->mixers[spec->num_mixers++] = alc269_beep_mixer; | ||
12171 | |||
11356 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; | 12172 | spec->init_verbs[spec->num_init_verbs++] = alc269_init_verbs; |
11357 | spec->num_mux_defs = 1; | 12173 | spec->num_mux_defs = 1; |
11358 | spec->input_mux = &spec->private_imux; | 12174 | spec->input_mux = &spec->private_imux; |
12175 | /* set default input source */ | ||
12176 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | ||
12177 | 0, AC_VERB_SET_CONNECT_SEL, | ||
12178 | spec->input_mux->items[0].index); | ||
11359 | 12179 | ||
11360 | err = alc_auto_add_mic_boost(codec); | 12180 | err = alc_auto_add_mic_boost(codec); |
11361 | if (err < 0) | 12181 | if (err < 0) |
@@ -11387,14 +12207,20 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
11387 | * configuration and preset | 12207 | * configuration and preset |
11388 | */ | 12208 | */ |
11389 | static const char *alc269_models[ALC269_MODEL_LAST] = { | 12209 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
11390 | [ALC269_BASIC] = "basic", | 12210 | [ALC269_BASIC] = "basic", |
12211 | [ALC269_QUANTA_FL1] = "quanta", | ||
12212 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | ||
12213 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901" | ||
11391 | }; | 12214 | }; |
11392 | 12215 | ||
11393 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | 12216 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
12217 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | ||
11394 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | 12218 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
11395 | ALC269_ASUS_EEEPC_P703), | 12219 | ALC269_ASUS_EEEPC_P703), |
11396 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | 12220 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
11397 | ALC269_ASUS_EEEPC_P901), | 12221 | ALC269_ASUS_EEEPC_P901), |
12222 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | ||
12223 | ALC269_ASUS_EEEPC_P901), | ||
11398 | {} | 12224 | {} |
11399 | }; | 12225 | }; |
11400 | 12226 | ||
@@ -11409,6 +12235,18 @@ static struct alc_config_preset alc269_presets[] = { | |||
11409 | .channel_mode = alc269_modes, | 12235 | .channel_mode = alc269_modes, |
11410 | .input_mux = &alc269_capture_source, | 12236 | .input_mux = &alc269_capture_source, |
11411 | }, | 12237 | }, |
12238 | [ALC269_QUANTA_FL1] = { | ||
12239 | .mixers = { alc269_quanta_fl1_mixer }, | ||
12240 | .init_verbs = { alc269_init_verbs, alc269_quanta_fl1_verbs }, | ||
12241 | .num_dacs = ARRAY_SIZE(alc269_dac_nids), | ||
12242 | .dac_nids = alc269_dac_nids, | ||
12243 | .hp_nid = 0x03, | ||
12244 | .num_channel_mode = ARRAY_SIZE(alc269_modes), | ||
12245 | .channel_mode = alc269_modes, | ||
12246 | .input_mux = &alc269_capture_source, | ||
12247 | .unsol_event = alc269_quanta_fl1_unsol_event, | ||
12248 | .init_hook = alc269_quanta_fl1_init_hook, | ||
12249 | }, | ||
11412 | [ALC269_ASUS_EEEPC_P703] = { | 12250 | [ALC269_ASUS_EEEPC_P703] = { |
11413 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, | 12251 | .mixers = { alc269_eeepc_mixer, alc269_epc_capture_mixer }, |
11414 | .init_verbs = { alc269_init_verbs, | 12252 | .init_verbs = { alc269_init_verbs, |
@@ -11488,6 +12326,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
11488 | 12326 | ||
11489 | spec->adc_nids = alc269_adc_nids; | 12327 | spec->adc_nids = alc269_adc_nids; |
11490 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); | 12328 | spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); |
12329 | spec->capsrc_nids = alc269_capsrc_nids; | ||
11491 | 12330 | ||
11492 | codec->patch_ops = alc_patch_ops; | 12331 | codec->patch_ops = alc_patch_ops; |
11493 | if (board_config == ALC269_AUTO) | 12332 | if (board_config == ALC269_AUTO) |
@@ -11689,7 +12528,7 @@ static struct snd_kcontrol_new alc861_toshiba_mixer[] = { | |||
11689 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), | 12528 | HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), |
11690 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), | 12529 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), |
11691 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), | 12530 | HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), |
11692 | 12531 | ||
11693 | /*Capture mixer control */ | 12532 | /*Capture mixer control */ |
11694 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), | 12533 | HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), |
11695 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), | 12534 | HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), |
@@ -11832,20 +12671,20 @@ static struct hda_verb alc861_base_init_verbs[] = { | |||
11832 | /* route front mic to ADC1*/ | 12671 | /* route front mic to ADC1*/ |
11833 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, | 12672 | {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11834 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12673 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11835 | 12674 | ||
11836 | /* Unmute DAC0~3 & spdif out*/ | 12675 | /* Unmute DAC0~3 & spdif out*/ |
11837 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12676 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11838 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12677 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11839 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12678 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11840 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12679 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11841 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12680 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11842 | 12681 | ||
11843 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12682 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11844 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12683 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11845 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12684 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11846 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12685 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11847 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12686 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11848 | 12687 | ||
11849 | /* Unmute Stereo Mixer 15 */ | 12688 | /* Unmute Stereo Mixer 15 */ |
11850 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12689 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11851 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12690 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -11901,13 +12740,13 @@ static struct hda_verb alc861_threestack_init_verbs[] = { | |||
11901 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12740 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11902 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12741 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11903 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12742 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11904 | 12743 | ||
11905 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12744 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11906 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12745 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11907 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12746 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11908 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12747 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11909 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12748 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11910 | 12749 | ||
11911 | /* Unmute Stereo Mixer 15 */ | 12750 | /* Unmute Stereo Mixer 15 */ |
11912 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12751 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11913 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12752 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -11963,13 +12802,13 @@ static struct hda_verb alc861_uniwill_m31_init_verbs[] = { | |||
11963 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12802 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11964 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12803 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11965 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12804 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
11966 | 12805 | ||
11967 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12806 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
11968 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12807 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11969 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12808 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11970 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12809 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11971 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12810 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
11972 | 12811 | ||
11973 | /* Unmute Stereo Mixer 15 */ | 12812 | /* Unmute Stereo Mixer 15 */ |
11974 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12813 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11975 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12814 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12034,7 +12873,7 @@ static struct hda_verb alc861_asus_init_verbs[] = { | |||
12034 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12873 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12035 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12874 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12036 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12875 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12037 | 12876 | ||
12038 | /* Unmute Stereo Mixer 15 */ | 12877 | /* Unmute Stereo Mixer 15 */ |
12039 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12878 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12040 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12879 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12071,20 +12910,20 @@ static struct hda_verb alc861_auto_init_verbs[] = { | |||
12071 | */ | 12910 | */ |
12072 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ | 12911 | /* {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, */ |
12073 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12912 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12074 | 12913 | ||
12075 | /* Unmute DAC0~3 & spdif out*/ | 12914 | /* Unmute DAC0~3 & spdif out*/ |
12076 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12915 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12077 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12916 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12078 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12917 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12079 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 12918 | {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
12080 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 12919 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
12081 | 12920 | ||
12082 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ | 12921 | /* Unmute Mixer 14 (mic) 1c (Line in)*/ |
12083 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12922 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12084 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12923 | {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12085 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12924 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12086 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12925 | {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
12087 | 12926 | ||
12088 | /* Unmute Stereo Mixer 15 */ | 12927 | /* Unmute Stereo Mixer 15 */ |
12089 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 12928 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
12090 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 12929 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
@@ -12659,7 +13498,7 @@ static int patch_alc861(struct hda_codec *codec) | |||
12659 | if (!spec->loopback.amplist) | 13498 | if (!spec->loopback.amplist) |
12660 | spec->loopback.amplist = alc861_loopbacks; | 13499 | spec->loopback.amplist = alc861_loopbacks; |
12661 | #endif | 13500 | #endif |
12662 | 13501 | ||
12663 | return 0; | 13502 | return 0; |
12664 | } | 13503 | } |
12665 | 13504 | ||
@@ -12913,7 +13752,7 @@ static struct snd_kcontrol_new alc861vd_hp_mixer[] = { | |||
12913 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 13752 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
12914 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 13753 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
12915 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 13754 | HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
12916 | 13755 | ||
12917 | { } /* end */ | 13756 | { } /* end */ |
12918 | }; | 13757 | }; |
12919 | 13758 | ||
@@ -13058,7 +13897,7 @@ static struct hda_verb alc861vd_lenovo_unsol_verbs[] = { | |||
13058 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 13897 | {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, |
13059 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, | 13898 | {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, |
13060 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 13899 | {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}, | 13900 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, |
13062 | {} | 13901 | {} |
13063 | }; | 13902 | }; |
13064 | 13903 | ||
@@ -13120,7 +13959,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
13120 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 13959 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
13121 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 13960 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13122 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 13961 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
13123 | 13962 | ||
13124 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 13963 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
13125 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 13964 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
13126 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | 13965 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, |
@@ -13145,7 +13984,7 @@ static struct hda_verb alc861vd_dallas_verbs[] = { | |||
13145 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 13984 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
13146 | 13985 | ||
13147 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 13986 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
13148 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, | 13987 | {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, |
13149 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | 13988 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
13150 | 13989 | ||
13151 | { } /* end */ | 13990 | { } /* end */ |
@@ -13304,7 +14143,7 @@ static struct alc_config_preset alc861vd_presets[] = { | |||
13304 | .input_mux = &alc861vd_hp_capture_source, | 14143 | .input_mux = &alc861vd_hp_capture_source, |
13305 | .unsol_event = alc861vd_dallas_unsol_event, | 14144 | .unsol_event = alc861vd_dallas_unsol_event, |
13306 | .init_hook = alc861vd_dallas_automute, | 14145 | .init_hook = alc861vd_dallas_automute, |
13307 | }, | 14146 | }, |
13308 | }; | 14147 | }; |
13309 | 14148 | ||
13310 | /* | 14149 | /* |
@@ -13883,13 +14722,120 @@ static struct snd_kcontrol_new alc662_eeepc_ep20_mixer[] = { | |||
13883 | { } /* end */ | 14722 | { } /* end */ |
13884 | }; | 14723 | }; |
13885 | 14724 | ||
14725 | static struct hda_bind_ctls alc663_asus_bind_master_vol = { | ||
14726 | .ops = &snd_hda_bind_vol, | ||
14727 | .values = { | ||
14728 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
14729 | HDA_COMPOSE_AMP_VAL(0x03, 3, 0, HDA_OUTPUT), | ||
14730 | 0 | ||
14731 | }, | ||
14732 | }; | ||
14733 | |||
14734 | static struct hda_bind_ctls alc663_asus_one_bind_switch = { | ||
14735 | .ops = &snd_hda_bind_sw, | ||
14736 | .values = { | ||
14737 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14738 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
14739 | 0 | ||
14740 | }, | ||
14741 | }; | ||
14742 | |||
13886 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { | 14743 | static struct snd_kcontrol_new alc663_m51va_mixer[] = { |
14744 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14745 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_one_bind_switch), | ||
14746 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14747 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14748 | { } /* end */ | ||
14749 | }; | ||
14750 | |||
14751 | static struct hda_bind_ctls alc663_asus_tree_bind_switch = { | ||
14752 | .ops = &snd_hda_bind_sw, | ||
14753 | .values = { | ||
14754 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14755 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
14756 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
14757 | 0 | ||
14758 | }, | ||
14759 | }; | ||
14760 | |||
14761 | static struct snd_kcontrol_new alc663_two_hp_m1_mixer[] = { | ||
14762 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14763 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_tree_bind_switch), | ||
14764 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14765 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14766 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14767 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14768 | |||
14769 | { } /* end */ | ||
14770 | }; | ||
14771 | |||
14772 | static struct hda_bind_ctls alc663_asus_four_bind_switch = { | ||
14773 | .ops = &snd_hda_bind_sw, | ||
14774 | .values = { | ||
14775 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
14776 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
14777 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
14778 | 0 | ||
14779 | }, | ||
14780 | }; | ||
14781 | |||
14782 | static struct snd_kcontrol_new alc663_two_hp_m2_mixer[] = { | ||
14783 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14784 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_four_bind_switch), | ||
14785 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14786 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14787 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14788 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14789 | { } /* end */ | ||
14790 | }; | ||
14791 | |||
14792 | static struct snd_kcontrol_new alc662_1bjd_mixer[] = { | ||
13887 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), | 14793 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), |
13888 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), | 14794 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), |
14795 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
14796 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14797 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
14798 | HDA_CODEC_VOLUME("F-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
14799 | HDA_CODEC_MUTE("F-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
14800 | { } /* end */ | ||
14801 | }; | ||
14802 | |||
14803 | static struct hda_bind_ctls alc663_asus_two_bind_master_vol = { | ||
14804 | .ops = &snd_hda_bind_vol, | ||
14805 | .values = { | ||
14806 | HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), | ||
14807 | HDA_COMPOSE_AMP_VAL(0x04, 3, 0, HDA_OUTPUT), | ||
14808 | 0 | ||
14809 | }, | ||
14810 | }; | ||
14811 | |||
14812 | static struct hda_bind_ctls alc663_asus_two_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(0x16, 3, 0, HDA_OUTPUT), | ||
14817 | 0 | ||
14818 | }, | ||
14819 | }; | ||
14820 | |||
14821 | static struct snd_kcontrol_new alc663_asus_21jd_clfe_mixer[] = { | ||
14822 | HDA_BIND_VOL("Master Playback Volume", | ||
14823 | &alc663_asus_two_bind_master_vol), | ||
14824 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
14825 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
13889 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 14826 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
13890 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 14827 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
13891 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 14828 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
13892 | HDA_CODEC_MUTE("DMic Playback Switch", 0x23, 0x9, HDA_INPUT), | 14829 | { } /* end */ |
14830 | }; | ||
14831 | |||
14832 | static struct snd_kcontrol_new alc663_asus_15jd_clfe_mixer[] = { | ||
14833 | HDA_BIND_VOL("Master Playback Volume", &alc663_asus_bind_master_vol), | ||
14834 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_two_bind_switch), | ||
14835 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), | ||
14836 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
14837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
14838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
13893 | { } /* end */ | 14839 | { } /* end */ |
13894 | }; | 14840 | }; |
13895 | 14841 | ||
@@ -14074,14 +15020,81 @@ static struct hda_verb alc663_auto_init_verbs[] = { | |||
14074 | }; | 15020 | }; |
14075 | 15021 | ||
14076 | static struct hda_verb alc663_m51va_init_verbs[] = { | 15022 | static struct hda_verb alc663_m51va_init_verbs[] = { |
15023 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15024 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
14077 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 15025 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
14078 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | 15026 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, |
14079 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | 15027 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ |
15028 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15029 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
15030 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15031 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15032 | {} | ||
15033 | }; | ||
14080 | 15034 | ||
14081 | {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | 15035 | static struct hda_verb alc663_21jd_amic_init_verbs[] = { |
15036 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15037 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15038 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15039 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15040 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15041 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15042 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15043 | {} | ||
15044 | }; | ||
14082 | 15045 | ||
15046 | static struct hda_verb alc662_1bjd_amic_init_verbs[] = { | ||
15047 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15048 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15049 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15050 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Headphone */ | ||
15051 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15052 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15053 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15054 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15055 | {} | ||
15056 | }; | ||
15057 | |||
15058 | static struct hda_verb alc663_15jd_amic_init_verbs[] = { | ||
15059 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15060 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15061 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15062 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15063 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15064 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15065 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15066 | {} | ||
15067 | }; | ||
15068 | |||
15069 | static struct hda_verb alc663_two_hp_amic_m1_init_verbs[] = { | ||
15070 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15071 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15072 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15073 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
15074 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15075 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15076 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, /* Headphone */ | ||
15077 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15078 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
14083 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | 15079 | {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}, | 15080 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, |
15081 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15082 | {} | ||
15083 | }; | ||
15084 | |||
15085 | static struct hda_verb alc663_two_hp_amic_m2_init_verbs[] = { | ||
15086 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
15087 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15088 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15089 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15090 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
15091 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
15092 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
15093 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15094 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
15095 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15096 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15097 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
14085 | {} | 15098 | {} |
14086 | }; | 15099 | }; |
14087 | 15100 | ||
@@ -14110,6 +15123,14 @@ static struct hda_verb alc663_g50v_init_verbs[] = { | |||
14110 | {} | 15123 | {} |
14111 | }; | 15124 | }; |
14112 | 15125 | ||
15126 | static struct hda_verb alc662_ecs_init_verbs[] = { | ||
15127 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f}, | ||
15128 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
15129 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
15130 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
15131 | {} | ||
15132 | }; | ||
15133 | |||
14113 | /* capture mixer elements */ | 15134 | /* capture mixer elements */ |
14114 | static struct snd_kcontrol_new alc662_capture_mixer[] = { | 15135 | static struct snd_kcontrol_new alc662_capture_mixer[] = { |
14115 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | 15136 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
@@ -14129,6 +15150,12 @@ static struct snd_kcontrol_new alc662_capture_mixer[] = { | |||
14129 | { } /* end */ | 15150 | { } /* end */ |
14130 | }; | 15151 | }; |
14131 | 15152 | ||
15153 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | ||
15154 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | ||
15155 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | ||
15156 | { } /* end */ | ||
15157 | }; | ||
15158 | |||
14132 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) | 15159 | static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec) |
14133 | { | 15160 | { |
14134 | unsigned int present; | 15161 | unsigned int present; |
@@ -14209,12 +15236,12 @@ static void alc662_eeepc_ep20_automute(struct hda_codec *codec) | |||
14209 | if (present) { | 15236 | if (present) { |
14210 | /* mute internal speaker */ | 15237 | /* mute internal speaker */ |
14211 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 15238 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
14212 | HDA_AMP_MUTE, HDA_AMP_MUTE); | 15239 | HDA_AMP_MUTE, HDA_AMP_MUTE); |
14213 | } else { | 15240 | } else { |
14214 | /* unmute internal speaker if necessary */ | 15241 | /* unmute internal speaker if necessary */ |
14215 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); | 15242 | mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); |
14216 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, | 15243 | snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, |
14217 | HDA_AMP_MUTE, mute); | 15244 | HDA_AMP_MUTE, mute); |
14218 | } | 15245 | } |
14219 | } | 15246 | } |
14220 | 15247 | ||
@@ -14237,11 +15264,108 @@ static void alc663_m51va_speaker_automute(struct hda_codec *codec) | |||
14237 | unsigned char bits; | 15264 | unsigned char bits; |
14238 | 15265 | ||
14239 | present = snd_hda_codec_read(codec, 0x21, 0, | 15266 | present = snd_hda_codec_read(codec, 0x21, 0, |
14240 | AC_VERB_GET_PIN_SENSE, 0) | 15267 | AC_VERB_GET_PIN_SENSE, 0) |
14241 | & AC_PINSENSE_PRESENCE; | 15268 | & AC_PINSENSE_PRESENCE; |
14242 | bits = present ? HDA_AMP_MUTE : 0; | 15269 | bits = present ? HDA_AMP_MUTE : 0; |
14243 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | 15270 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
14244 | HDA_AMP_MUTE, bits); | 15271 | AMP_IN_MUTE(0), bits); |
15272 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15273 | AMP_IN_MUTE(0), bits); | ||
15274 | } | ||
15275 | |||
15276 | static void alc663_21jd_two_speaker_automute(struct hda_codec *codec) | ||
15277 | { | ||
15278 | unsigned int present; | ||
15279 | unsigned char bits; | ||
15280 | |||
15281 | present = snd_hda_codec_read(codec, 0x21, 0, | ||
15282 | AC_VERB_GET_PIN_SENSE, 0) | ||
15283 | & AC_PINSENSE_PRESENCE; | ||
15284 | bits = present ? HDA_AMP_MUTE : 0; | ||
15285 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15286 | AMP_IN_MUTE(0), bits); | ||
15287 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15288 | AMP_IN_MUTE(0), bits); | ||
15289 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
15290 | AMP_IN_MUTE(0), bits); | ||
15291 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
15292 | AMP_IN_MUTE(0), bits); | ||
15293 | } | ||
15294 | |||
15295 | static void alc663_15jd_two_speaker_automute(struct hda_codec *codec) | ||
15296 | { | ||
15297 | unsigned int present; | ||
15298 | unsigned char bits; | ||
15299 | |||
15300 | present = snd_hda_codec_read(codec, 0x15, 0, | ||
15301 | AC_VERB_GET_PIN_SENSE, 0) | ||
15302 | & AC_PINSENSE_PRESENCE; | ||
15303 | bits = present ? HDA_AMP_MUTE : 0; | ||
15304 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15305 | AMP_IN_MUTE(0), bits); | ||
15306 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15307 | AMP_IN_MUTE(0), bits); | ||
15308 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 0, | ||
15309 | AMP_IN_MUTE(0), bits); | ||
15310 | snd_hda_codec_amp_stereo(codec, 0x0e, HDA_INPUT, 1, | ||
15311 | AMP_IN_MUTE(0), bits); | ||
15312 | } | ||
15313 | |||
15314 | static void alc662_f5z_speaker_automute(struct hda_codec *codec) | ||
15315 | { | ||
15316 | unsigned int present; | ||
15317 | unsigned char bits; | ||
15318 | |||
15319 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
15320 | AC_VERB_GET_PIN_SENSE, 0) | ||
15321 | & AC_PINSENSE_PRESENCE; | ||
15322 | bits = present ? 0 : PIN_OUT; | ||
15323 | snd_hda_codec_write(codec, 0x14, 0, | ||
15324 | AC_VERB_SET_PIN_WIDGET_CONTROL, bits); | ||
15325 | } | ||
15326 | |||
15327 | static void alc663_two_hp_m1_speaker_automute(struct hda_codec *codec) | ||
15328 | { | ||
15329 | unsigned int present1, present2; | ||
15330 | |||
15331 | present1 = snd_hda_codec_read(codec, 0x21, 0, | ||
15332 | AC_VERB_GET_PIN_SENSE, 0) | ||
15333 | & AC_PINSENSE_PRESENCE; | ||
15334 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
15335 | AC_VERB_GET_PIN_SENSE, 0) | ||
15336 | & AC_PINSENSE_PRESENCE; | ||
15337 | |||
15338 | if (present1 || present2) { | ||
15339 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
15340 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
15341 | } else { | ||
15342 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
15343 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
15344 | } | ||
15345 | } | ||
15346 | |||
15347 | static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | ||
15348 | { | ||
15349 | unsigned int present1, present2; | ||
15350 | |||
15351 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | ||
15352 | AC_VERB_GET_PIN_SENSE, 0) | ||
15353 | & AC_PINSENSE_PRESENCE; | ||
15354 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
15355 | AC_VERB_GET_PIN_SENSE, 0) | ||
15356 | & AC_PINSENSE_PRESENCE; | ||
15357 | |||
15358 | if (present1 || present2) { | ||
15359 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15360 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | ||
15361 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15362 | AMP_IN_MUTE(0), AMP_IN_MUTE(0)); | ||
15363 | } else { | ||
15364 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | ||
15365 | AMP_IN_MUTE(0), 0); | ||
15366 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 1, | ||
15367 | AMP_IN_MUTE(0), 0); | ||
15368 | } | ||
14245 | } | 15369 | } |
14246 | 15370 | ||
14247 | static void alc663_m51va_mic_automute(struct hda_codec *codec) | 15371 | static void alc663_m51va_mic_automute(struct hda_codec *codec) |
@@ -14249,16 +15373,16 @@ static void alc663_m51va_mic_automute(struct hda_codec *codec) | |||
14249 | unsigned int present; | 15373 | unsigned int present; |
14250 | 15374 | ||
14251 | present = snd_hda_codec_read(codec, 0x18, 0, | 15375 | present = snd_hda_codec_read(codec, 0x18, 0, |
14252 | AC_VERB_GET_PIN_SENSE, 0) | 15376 | AC_VERB_GET_PIN_SENSE, 0) |
14253 | & AC_PINSENSE_PRESENCE; | 15377 | & AC_PINSENSE_PRESENCE; |
14254 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15378 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14255 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | 15379 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
14256 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15380 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14257 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); | 15381 | 0x7000 | (0x00 << 8) | (present ? 0 : 0x80)); |
14258 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15382 | snd_hda_codec_write_cache(codec, 0x22, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14259 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | 15383 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
14260 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, | 15384 | snd_hda_codec_write_cache(codec, 0x23, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
14261 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); | 15385 | 0x7000 | (0x09 << 8) | (present ? 0x80 : 0)); |
14262 | } | 15386 | } |
14263 | 15387 | ||
14264 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 15388 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
@@ -14280,6 +15404,121 @@ static void alc663_m51va_inithook(struct hda_codec *codec) | |||
14280 | alc663_m51va_mic_automute(codec); | 15404 | alc663_m51va_mic_automute(codec); |
14281 | } | 15405 | } |
14282 | 15406 | ||
15407 | /* ***************** Mode1 ******************************/ | ||
15408 | static void alc663_mode1_unsol_event(struct hda_codec *codec, | ||
15409 | unsigned int res) | ||
15410 | { | ||
15411 | switch (res >> 26) { | ||
15412 | case ALC880_HP_EVENT: | ||
15413 | alc663_m51va_speaker_automute(codec); | ||
15414 | break; | ||
15415 | case ALC880_MIC_EVENT: | ||
15416 | alc662_eeepc_mic_automute(codec); | ||
15417 | break; | ||
15418 | } | ||
15419 | } | ||
15420 | |||
15421 | static void alc663_mode1_inithook(struct hda_codec *codec) | ||
15422 | { | ||
15423 | alc663_m51va_speaker_automute(codec); | ||
15424 | alc662_eeepc_mic_automute(codec); | ||
15425 | } | ||
15426 | /* ***************** Mode2 ******************************/ | ||
15427 | static void alc662_mode2_unsol_event(struct hda_codec *codec, | ||
15428 | unsigned int res) | ||
15429 | { | ||
15430 | switch (res >> 26) { | ||
15431 | case ALC880_HP_EVENT: | ||
15432 | alc662_f5z_speaker_automute(codec); | ||
15433 | break; | ||
15434 | case ALC880_MIC_EVENT: | ||
15435 | alc662_eeepc_mic_automute(codec); | ||
15436 | break; | ||
15437 | } | ||
15438 | } | ||
15439 | |||
15440 | static void alc662_mode2_inithook(struct hda_codec *codec) | ||
15441 | { | ||
15442 | alc662_f5z_speaker_automute(codec); | ||
15443 | alc662_eeepc_mic_automute(codec); | ||
15444 | } | ||
15445 | /* ***************** Mode3 ******************************/ | ||
15446 | static void alc663_mode3_unsol_event(struct hda_codec *codec, | ||
15447 | unsigned int res) | ||
15448 | { | ||
15449 | switch (res >> 26) { | ||
15450 | case ALC880_HP_EVENT: | ||
15451 | alc663_two_hp_m1_speaker_automute(codec); | ||
15452 | break; | ||
15453 | case ALC880_MIC_EVENT: | ||
15454 | alc662_eeepc_mic_automute(codec); | ||
15455 | break; | ||
15456 | } | ||
15457 | } | ||
15458 | |||
15459 | static void alc663_mode3_inithook(struct hda_codec *codec) | ||
15460 | { | ||
15461 | alc663_two_hp_m1_speaker_automute(codec); | ||
15462 | alc662_eeepc_mic_automute(codec); | ||
15463 | } | ||
15464 | /* ***************** Mode4 ******************************/ | ||
15465 | static void alc663_mode4_unsol_event(struct hda_codec *codec, | ||
15466 | unsigned int res) | ||
15467 | { | ||
15468 | switch (res >> 26) { | ||
15469 | case ALC880_HP_EVENT: | ||
15470 | alc663_21jd_two_speaker_automute(codec); | ||
15471 | break; | ||
15472 | case ALC880_MIC_EVENT: | ||
15473 | alc662_eeepc_mic_automute(codec); | ||
15474 | break; | ||
15475 | } | ||
15476 | } | ||
15477 | |||
15478 | static void alc663_mode4_inithook(struct hda_codec *codec) | ||
15479 | { | ||
15480 | alc663_21jd_two_speaker_automute(codec); | ||
15481 | alc662_eeepc_mic_automute(codec); | ||
15482 | } | ||
15483 | /* ***************** Mode5 ******************************/ | ||
15484 | static void alc663_mode5_unsol_event(struct hda_codec *codec, | ||
15485 | unsigned int res) | ||
15486 | { | ||
15487 | switch (res >> 26) { | ||
15488 | case ALC880_HP_EVENT: | ||
15489 | alc663_15jd_two_speaker_automute(codec); | ||
15490 | break; | ||
15491 | case ALC880_MIC_EVENT: | ||
15492 | alc662_eeepc_mic_automute(codec); | ||
15493 | break; | ||
15494 | } | ||
15495 | } | ||
15496 | |||
15497 | static void alc663_mode5_inithook(struct hda_codec *codec) | ||
15498 | { | ||
15499 | alc663_15jd_two_speaker_automute(codec); | ||
15500 | alc662_eeepc_mic_automute(codec); | ||
15501 | } | ||
15502 | /* ***************** Mode6 ******************************/ | ||
15503 | static void alc663_mode6_unsol_event(struct hda_codec *codec, | ||
15504 | unsigned int res) | ||
15505 | { | ||
15506 | switch (res >> 26) { | ||
15507 | case ALC880_HP_EVENT: | ||
15508 | alc663_two_hp_m2_speaker_automute(codec); | ||
15509 | break; | ||
15510 | case ALC880_MIC_EVENT: | ||
15511 | alc662_eeepc_mic_automute(codec); | ||
15512 | break; | ||
15513 | } | ||
15514 | } | ||
15515 | |||
15516 | static void alc663_mode6_inithook(struct hda_codec *codec) | ||
15517 | { | ||
15518 | alc663_two_hp_m2_speaker_automute(codec); | ||
15519 | alc662_eeepc_mic_automute(codec); | ||
15520 | } | ||
15521 | |||
14283 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 15522 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
14284 | { | 15523 | { |
14285 | unsigned int present; | 15524 | unsigned int present; |
@@ -14350,6 +15589,46 @@ static void alc663_g50v_inithook(struct hda_codec *codec) | |||
14350 | alc662_eeepc_mic_automute(codec); | 15589 | alc662_eeepc_mic_automute(codec); |
14351 | } | 15590 | } |
14352 | 15591 | ||
15592 | /* bind hp and internal speaker mute (with plug check) */ | ||
15593 | static int alc662_ecs_master_sw_put(struct snd_kcontrol *kcontrol, | ||
15594 | struct snd_ctl_elem_value *ucontrol) | ||
15595 | { | ||
15596 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
15597 | long *valp = ucontrol->value.integer.value; | ||
15598 | int change; | ||
15599 | |||
15600 | change = snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, | ||
15601 | HDA_AMP_MUTE, | ||
15602 | valp[0] ? 0 : HDA_AMP_MUTE); | ||
15603 | change |= snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, | ||
15604 | HDA_AMP_MUTE, | ||
15605 | valp[1] ? 0 : HDA_AMP_MUTE); | ||
15606 | if (change) | ||
15607 | alc262_hippo1_automute(codec); | ||
15608 | return change; | ||
15609 | } | ||
15610 | |||
15611 | static struct snd_kcontrol_new alc662_ecs_mixer[] = { | ||
15612 | HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT), | ||
15613 | { | ||
15614 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
15615 | .name = "Master Playback Switch", | ||
15616 | .info = snd_hda_mixer_amp_switch_info, | ||
15617 | .get = snd_hda_mixer_amp_switch_get, | ||
15618 | .put = alc662_ecs_master_sw_put, | ||
15619 | .private_value = HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
15620 | }, | ||
15621 | |||
15622 | HDA_CODEC_VOLUME("e-Mic/LineIn Boost", 0x18, 0, HDA_INPUT), | ||
15623 | HDA_CODEC_VOLUME("e-Mic/LineIn Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
15624 | HDA_CODEC_MUTE("e-Mic/LineIn Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
15625 | |||
15626 | HDA_CODEC_VOLUME("i-Mic Boost", 0x19, 0, HDA_INPUT), | ||
15627 | HDA_CODEC_VOLUME("i-Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
15628 | HDA_CODEC_MUTE("i-Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
15629 | { } /* end */ | ||
15630 | }; | ||
15631 | |||
14353 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15632 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
14354 | #define alc662_loopbacks alc880_loopbacks | 15633 | #define alc662_loopbacks alc880_loopbacks |
14355 | #endif | 15634 | #endif |
@@ -14372,21 +15651,67 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
14372 | [ALC662_LENOVO_101E] = "lenovo-101e", | 15651 | [ALC662_LENOVO_101E] = "lenovo-101e", |
14373 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", | 15652 | [ALC662_ASUS_EEEPC_P701] = "eeepc-p701", |
14374 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", | 15653 | [ALC662_ASUS_EEEPC_EP20] = "eeepc-ep20", |
15654 | [ALC662_ECS] = "ecs", | ||
14375 | [ALC663_ASUS_M51VA] = "m51va", | 15655 | [ALC663_ASUS_M51VA] = "m51va", |
14376 | [ALC663_ASUS_G71V] = "g71v", | 15656 | [ALC663_ASUS_G71V] = "g71v", |
14377 | [ALC663_ASUS_H13] = "h13", | 15657 | [ALC663_ASUS_H13] = "h13", |
14378 | [ALC663_ASUS_G50V] = "g50v", | 15658 | [ALC663_ASUS_G50V] = "g50v", |
15659 | [ALC663_ASUS_MODE1] = "asus-mode1", | ||
15660 | [ALC662_ASUS_MODE2] = "asus-mode2", | ||
15661 | [ALC663_ASUS_MODE3] = "asus-mode3", | ||
15662 | [ALC663_ASUS_MODE4] = "asus-mode4", | ||
15663 | [ALC663_ASUS_MODE5] = "asus-mode5", | ||
15664 | [ALC663_ASUS_MODE6] = "asus-mode6", | ||
14379 | [ALC662_AUTO] = "auto", | 15665 | [ALC662_AUTO] = "auto", |
14380 | }; | 15666 | }; |
14381 | 15667 | ||
14382 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | 15668 | 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), | 15669 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
14385 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), | 15670 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS M51VA", ALC663_ASUS_G50V), |
14386 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | 15671 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
14387 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | 15672 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
14388 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | 15673 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
15674 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | ||
15675 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), | ||
15676 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | ||
15677 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | ||
15678 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | ||
15679 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15680 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15681 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | ||
15682 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
15683 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
15684 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | ||
15685 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | ||
15686 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | ||
15687 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | ||
15688 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | ||
15689 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | ||
15690 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | ||
15691 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | ||
15692 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | ||
15693 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | ||
15694 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
15695 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | ||
15696 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | ||
15697 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
15698 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | ||
15699 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | ||
15700 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | ||
15701 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | ||
15702 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | ||
15703 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | ||
15704 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | ||
15705 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | ||
15706 | ALC662_3ST_6ch_DIG), | ||
14389 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | 15707 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), |
15708 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | ||
15709 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | ||
15710 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | ||
15711 | ALC662_3ST_6ch_DIG), | ||
15712 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | ||
15713 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | ||
15714 | ALC662_3ST_6ch_DIG), | ||
14390 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), | 15715 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), |
14391 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | 15716 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), |
14392 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | 15717 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), |
@@ -14477,6 +15802,18 @@ static struct alc_config_preset alc662_presets[] = { | |||
14477 | .unsol_event = alc662_eeepc_ep20_unsol_event, | 15802 | .unsol_event = alc662_eeepc_ep20_unsol_event, |
14478 | .init_hook = alc662_eeepc_ep20_inithook, | 15803 | .init_hook = alc662_eeepc_ep20_inithook, |
14479 | }, | 15804 | }, |
15805 | [ALC662_ECS] = { | ||
15806 | .mixers = { alc662_ecs_mixer, alc662_capture_mixer }, | ||
15807 | .init_verbs = { alc662_init_verbs, | ||
15808 | alc662_ecs_init_verbs }, | ||
15809 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15810 | .dac_nids = alc662_dac_nids, | ||
15811 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15812 | .channel_mode = alc662_3ST_2ch_modes, | ||
15813 | .input_mux = &alc662_eeepc_capture_source, | ||
15814 | .unsol_event = alc662_eeepc_unsol_event, | ||
15815 | .init_hook = alc662_eeepc_inithook, | ||
15816 | }, | ||
14480 | [ALC663_ASUS_M51VA] = { | 15817 | [ALC663_ASUS_M51VA] = { |
14481 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, | 15818 | .mixers = { alc663_m51va_mixer, alc662_capture_mixer}, |
14482 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, | 15819 | .init_verbs = { alc662_init_verbs, alc663_m51va_init_verbs }, |
@@ -14524,6 +15861,91 @@ static struct alc_config_preset alc662_presets[] = { | |||
14524 | .unsol_event = alc663_g50v_unsol_event, | 15861 | .unsol_event = alc663_g50v_unsol_event, |
14525 | .init_hook = alc663_g50v_inithook, | 15862 | .init_hook = alc663_g50v_inithook, |
14526 | }, | 15863 | }, |
15864 | [ALC663_ASUS_MODE1] = { | ||
15865 | .mixers = { alc663_m51va_mixer, alc662_auto_capture_mixer }, | ||
15866 | .init_verbs = { alc662_init_verbs, | ||
15867 | alc663_21jd_amic_init_verbs }, | ||
15868 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15869 | .hp_nid = 0x03, | ||
15870 | .dac_nids = alc662_dac_nids, | ||
15871 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15872 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15873 | .channel_mode = alc662_3ST_2ch_modes, | ||
15874 | .input_mux = &alc662_eeepc_capture_source, | ||
15875 | .unsol_event = alc663_mode1_unsol_event, | ||
15876 | .init_hook = alc663_mode1_inithook, | ||
15877 | }, | ||
15878 | [ALC662_ASUS_MODE2] = { | ||
15879 | .mixers = { alc662_1bjd_mixer, alc662_auto_capture_mixer }, | ||
15880 | .init_verbs = { alc662_init_verbs, | ||
15881 | alc662_1bjd_amic_init_verbs }, | ||
15882 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15883 | .dac_nids = alc662_dac_nids, | ||
15884 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15885 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15886 | .channel_mode = alc662_3ST_2ch_modes, | ||
15887 | .input_mux = &alc662_eeepc_capture_source, | ||
15888 | .unsol_event = alc662_mode2_unsol_event, | ||
15889 | .init_hook = alc662_mode2_inithook, | ||
15890 | }, | ||
15891 | [ALC663_ASUS_MODE3] = { | ||
15892 | .mixers = { alc663_two_hp_m1_mixer, alc662_auto_capture_mixer }, | ||
15893 | .init_verbs = { alc662_init_verbs, | ||
15894 | alc663_two_hp_amic_m1_init_verbs }, | ||
15895 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15896 | .hp_nid = 0x03, | ||
15897 | .dac_nids = alc662_dac_nids, | ||
15898 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15899 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15900 | .channel_mode = alc662_3ST_2ch_modes, | ||
15901 | .input_mux = &alc662_eeepc_capture_source, | ||
15902 | .unsol_event = alc663_mode3_unsol_event, | ||
15903 | .init_hook = alc663_mode3_inithook, | ||
15904 | }, | ||
15905 | [ALC663_ASUS_MODE4] = { | ||
15906 | .mixers = { alc663_asus_21jd_clfe_mixer, | ||
15907 | alc662_auto_capture_mixer}, | ||
15908 | .init_verbs = { alc662_init_verbs, | ||
15909 | alc663_21jd_amic_init_verbs}, | ||
15910 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15911 | .hp_nid = 0x03, | ||
15912 | .dac_nids = alc662_dac_nids, | ||
15913 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15914 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15915 | .channel_mode = alc662_3ST_2ch_modes, | ||
15916 | .input_mux = &alc662_eeepc_capture_source, | ||
15917 | .unsol_event = alc663_mode4_unsol_event, | ||
15918 | .init_hook = alc663_mode4_inithook, | ||
15919 | }, | ||
15920 | [ALC663_ASUS_MODE5] = { | ||
15921 | .mixers = { alc663_asus_15jd_clfe_mixer, | ||
15922 | alc662_auto_capture_mixer }, | ||
15923 | .init_verbs = { alc662_init_verbs, | ||
15924 | alc663_15jd_amic_init_verbs }, | ||
15925 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15926 | .hp_nid = 0x03, | ||
15927 | .dac_nids = alc662_dac_nids, | ||
15928 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15929 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15930 | .channel_mode = alc662_3ST_2ch_modes, | ||
15931 | .input_mux = &alc662_eeepc_capture_source, | ||
15932 | .unsol_event = alc663_mode5_unsol_event, | ||
15933 | .init_hook = alc663_mode5_inithook, | ||
15934 | }, | ||
15935 | [ALC663_ASUS_MODE6] = { | ||
15936 | .mixers = { alc663_two_hp_m2_mixer, alc662_auto_capture_mixer }, | ||
15937 | .init_verbs = { alc662_init_verbs, | ||
15938 | alc663_two_hp_amic_m2_init_verbs }, | ||
15939 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
15940 | .hp_nid = 0x03, | ||
15941 | .dac_nids = alc662_dac_nids, | ||
15942 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
15943 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
15944 | .channel_mode = alc662_3ST_2ch_modes, | ||
15945 | .input_mux = &alc662_eeepc_capture_source, | ||
15946 | .unsol_event = alc663_mode6_unsol_event, | ||
15947 | .init_hook = alc663_mode6_inithook, | ||
15948 | }, | ||
14527 | }; | 15949 | }; |
14528 | 15950 | ||
14529 | 15951 | ||
@@ -14560,15 +15982,15 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14560 | HDA_OUTPUT)); | 15982 | HDA_OUTPUT)); |
14561 | if (err < 0) | 15983 | if (err < 0) |
14562 | return err; | 15984 | return err; |
14563 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 15985 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
14564 | "Center Playback Switch", | 15986 | "Center Playback Switch", |
14565 | HDA_COMPOSE_AMP_VAL(nid, 1, 2, | 15987 | HDA_COMPOSE_AMP_VAL(0x0e, 1, 0, |
14566 | HDA_INPUT)); | 15988 | HDA_INPUT)); |
14567 | if (err < 0) | 15989 | if (err < 0) |
14568 | return err; | 15990 | return err; |
14569 | err = add_control(spec, ALC_CTL_BIND_MUTE, | 15991 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, |
14570 | "LFE Playback Switch", | 15992 | "LFE Playback Switch", |
14571 | HDA_COMPOSE_AMP_VAL(nid, 2, 2, | 15993 | HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, |
14572 | HDA_INPUT)); | 15994 | HDA_INPUT)); |
14573 | if (err < 0) | 15995 | if (err < 0) |
14574 | return err; | 15996 | return err; |
@@ -14580,9 +16002,9 @@ static int alc662_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
14580 | if (err < 0) | 16002 | if (err < 0) |
14581 | return err; | 16003 | return err; |
14582 | sprintf(name, "%s Playback Switch", chname[i]); | 16004 | sprintf(name, "%s Playback Switch", chname[i]); |
14583 | err = add_control(spec, ALC_CTL_BIND_MUTE, name, | 16005 | err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, |
14584 | HDA_COMPOSE_AMP_VAL(nid, 3, 2, | 16006 | HDA_COMPOSE_AMP_VAL(alc880_idx_to_mixer(i), |
14585 | HDA_INPUT)); | 16007 | 3, 0, HDA_INPUT)); |
14586 | if (err < 0) | 16008 | if (err < 0) |
14587 | return err; | 16009 | return err; |
14588 | } | 16010 | } |
@@ -14777,7 +16199,7 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
14777 | 16199 | ||
14778 | spec->num_mux_defs = 1; | 16200 | spec->num_mux_defs = 1; |
14779 | spec->input_mux = &spec->private_imux; | 16201 | spec->input_mux = &spec->private_imux; |
14780 | 16202 | ||
14781 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; | 16203 | spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs; |
14782 | if (codec->vendor_id == 0x10ec0663) | 16204 | if (codec->vendor_id == 0x10ec0663) |
14783 | spec->init_verbs[spec->num_init_verbs++] = | 16205 | spec->init_verbs[spec->num_init_verbs++] = |
@@ -14896,6 +16318,8 @@ struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
14896 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, | 16318 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
14897 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, | 16319 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
14898 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, | 16320 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, |
16321 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", | ||
16322 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | ||
14899 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", | 16323 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
14900 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ | 16324 | .patch = patch_alc882 }, /* should be patch_alc883() in future */ |
14901 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, | 16325 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index ad994fcab72..c461baa83c2 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 | }; |
@@ -253,6 +326,10 @@ static hda_nid_t stac92hd71bxx_dmux_nids[1] = { | |||
253 | 0x1c, | 326 | 0x1c, |
254 | }; | 327 | }; |
255 | 328 | ||
329 | static hda_nid_t stac92hd71bxx_smux_nids[2] = { | ||
330 | 0x24, 0x25, | ||
331 | }; | ||
332 | |||
256 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { | 333 | static hda_nid_t stac92hd71bxx_dac_nids[1] = { |
257 | 0x10, /*0x11, */ | 334 | 0x10, /*0x11, */ |
258 | }; | 335 | }; |
@@ -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,6 +843,19 @@ 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}, |
@@ -690,12 +918,16 @@ static struct hda_verb d965_core_init[] = { | |||
690 | static struct hda_verb stac927x_core_init[] = { | 918 | static struct hda_verb stac927x_core_init[] = { |
691 | /* set master volume and direct control */ | 919 | /* set master volume and direct control */ |
692 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 920 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
921 | /* enable analog pc beep path */ | ||
922 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
693 | {} | 923 | {} |
694 | }; | 924 | }; |
695 | 925 | ||
696 | static struct hda_verb stac9205_core_init[] = { | 926 | static struct hda_verb stac9205_core_init[] = { |
697 | /* set master volume and direct control */ | 927 | /* set master volume and direct control */ |
698 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 928 | { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
929 | /* enable analog pc beep path */ | ||
930 | { 0x01, AC_VERB_SET_DIGI_CONVERT_2, 1 << 5}, | ||
699 | {} | 931 | {} |
700 | }; | 932 | }; |
701 | 933 | ||
@@ -709,6 +941,31 @@ static struct hda_verb stac9205_core_init[] = { | |||
709 | .put = stac92xx_mono_mux_enum_put, \ | 941 | .put = stac92xx_mono_mux_enum_put, \ |
710 | } | 942 | } |
711 | 943 | ||
944 | #define STAC_AMP_MUX \ | ||
945 | { \ | ||
946 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
947 | .name = "Amp Selector Capture Switch", \ | ||
948 | .count = 1, \ | ||
949 | .info = stac92xx_amp_mux_enum_info, \ | ||
950 | .get = stac92xx_amp_mux_enum_get, \ | ||
951 | .put = stac92xx_amp_mux_enum_put, \ | ||
952 | } | ||
953 | |||
954 | #define STAC_AMP_VOL(xname, nid, chs, idx, dir) \ | ||
955 | { \ | ||
956 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
957 | .name = xname, \ | ||
958 | .index = 0, \ | ||
959 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ | ||
960 | SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ | ||
961 | SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ | ||
962 | .info = stac92xx_amp_volume_info, \ | ||
963 | .get = stac92xx_amp_volume_get, \ | ||
964 | .put = stac92xx_amp_volume_put, \ | ||
965 | .tlv = { .c = snd_hda_mixer_amp_tlv }, \ | ||
966 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ | ||
967 | } | ||
968 | |||
712 | #define STAC_INPUT_SOURCE(cnt) \ | 969 | #define STAC_INPUT_SOURCE(cnt) \ |
713 | { \ | 970 | { \ |
714 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 971 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -736,33 +993,36 @@ static struct snd_kcontrol_new stac9200_mixer[] = { | |||
736 | STAC_INPUT_SOURCE(1), | 993 | STAC_INPUT_SOURCE(1), |
737 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), | 994 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
738 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), | 995 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
739 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0c, 0, HDA_OUTPUT), | ||
740 | { } /* end */ | 996 | { } /* end */ |
741 | }; | 997 | }; |
742 | 998 | ||
999 | #define DELL_M6_MIXER 6 | ||
743 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { | 1000 | static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { |
744 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), | 1001 | /* 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), | 1002 | 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), | 1003 | HDA_CODEC_MUTE("Front Mic Mixer Capture Switch", 0x1d, 0, HDA_INPUT), |
754 | 1004 | ||
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), | 1005 | 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), | 1006 | HDA_CODEC_MUTE("Line In Mixer Capture Switch", 0x1d, 0x2, HDA_INPUT), |
760 | 1007 | ||
1008 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | ||
1009 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | ||
1010 | |||
1011 | /* start of config #2 */ | ||
1012 | HDA_CODEC_VOLUME("Mic Mixer Capture Volume", 0x1d, 0x1, HDA_INPUT), | ||
1013 | HDA_CODEC_MUTE("Mic Mixer Capture Switch", 0x1d, 0x1, HDA_INPUT), | ||
1014 | |||
761 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | 1015 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
762 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | 1016 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
763 | 1017 | ||
764 | HDA_CODEC_VOLUME("CD Mixer Capture Volume", 0x1d, 0x4, HDA_INPUT), | 1018 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), |
765 | HDA_CODEC_MUTE("CD Mixer Capture Switch", 0x1d, 0x4, HDA_INPUT), | 1019 | |
1020 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1021 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | ||
1022 | |||
1023 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1024 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x21, 0x0, HDA_OUTPUT), | ||
1025 | |||
766 | { } /* end */ | 1026 | { } /* end */ |
767 | }; | 1027 | }; |
768 | 1028 | ||
@@ -818,19 +1078,46 @@ static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { | |||
818 | { } /* end */ | 1078 | { } /* end */ |
819 | }; | 1079 | }; |
820 | 1080 | ||
1081 | |||
1082 | static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { | ||
1083 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1084 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_OUTPUT), | ||
1085 | |||
1086 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1087 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), | ||
1088 | |||
1089 | HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT), | ||
1090 | HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT), | ||
1091 | |||
1092 | HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT), | ||
1093 | HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT), | ||
1094 | |||
1095 | HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT), | ||
1096 | HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT), | ||
1097 | |||
1098 | HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT), | ||
1099 | HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT), | ||
1100 | |||
1101 | /* | ||
1102 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT), | ||
1103 | HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT), | ||
1104 | */ | ||
1105 | { } /* end */ | ||
1106 | }; | ||
1107 | |||
821 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | 1108 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
822 | STAC_INPUT_SOURCE(2), | 1109 | STAC_INPUT_SOURCE(2), |
823 | 1110 | ||
824 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1111 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
825 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1112 | 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 | 1113 | ||
828 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1114 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
829 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1115 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
830 | HDA_CODEC_VOLUME_IDX("Capture Mux Volume", 0x1, 0x1b, 0x0, HDA_OUTPUT), | 1116 | /* analog pc-beep replaced with digital beep support */ |
831 | 1117 | /* | |
832 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), | 1118 | HDA_CODEC_VOLUME("PC Beep Volume", 0x17, 0x2, HDA_INPUT), |
833 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), | 1119 | HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), |
1120 | */ | ||
834 | 1121 | ||
835 | HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), | 1122 | HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), |
836 | HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), | 1123 | HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), |
@@ -843,11 +1130,9 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | |||
843 | 1130 | ||
844 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1131 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
845 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1132 | 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 | 1133 | ||
848 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1134 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1d, 0x0, HDA_OUTPUT), |
849 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1d, 0x0, HDA_OUTPUT), | 1135 | 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 */ | 1136 | { } /* end */ |
852 | }; | 1137 | }; |
853 | 1138 | ||
@@ -855,7 +1140,6 @@ static struct snd_kcontrol_new stac925x_mixer[] = { | |||
855 | STAC_INPUT_SOURCE(1), | 1140 | STAC_INPUT_SOURCE(1), |
856 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), | 1141 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
857 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), | 1142 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
858 | HDA_CODEC_VOLUME("Capture Mux Volume", 0x0f, 0, HDA_OUTPUT), | ||
859 | { } /* end */ | 1143 | { } /* end */ |
860 | }; | 1144 | }; |
861 | 1145 | ||
@@ -865,12 +1149,9 @@ static struct snd_kcontrol_new stac9205_mixer[] = { | |||
865 | 1149 | ||
866 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), | 1150 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
867 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), | 1151 | 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 | 1152 | ||
870 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), | 1153 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x1c, 0x0, HDA_INPUT), |
871 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1e, 0x0, HDA_OUTPUT), | 1154 | 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 */ | 1155 | { } /* end */ |
875 | }; | 1156 | }; |
876 | 1157 | ||
@@ -879,11 +1160,9 @@ static struct snd_kcontrol_new stac922x_mixer[] = { | |||
879 | STAC_INPUT_SOURCE(2), | 1160 | STAC_INPUT_SOURCE(2), |
880 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), | 1161 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
881 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), | 1162 | 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 | 1163 | ||
884 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), | 1164 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x18, 0x0, HDA_INPUT), |
885 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_INPUT), | 1165 | 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 */ | 1166 | { } /* end */ |
888 | }; | 1167 | }; |
889 | 1168 | ||
@@ -894,15 +1173,12 @@ static struct snd_kcontrol_new stac927x_mixer[] = { | |||
894 | 1173 | ||
895 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), | 1174 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
896 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), | 1175 | 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 | 1176 | ||
899 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), | 1177 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x1, 0x19, 0x0, HDA_INPUT), |
900 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x1c, 0x0, HDA_OUTPUT), | 1178 | 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 | 1179 | ||
903 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), | 1180 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x2, 0x1A, 0x0, HDA_INPUT), |
904 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), | 1181 | 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 */ | 1182 | { } /* end */ |
907 | }; | 1183 | }; |
908 | 1184 | ||
@@ -915,6 +1191,15 @@ static struct snd_kcontrol_new stac_dmux_mixer = { | |||
915 | .put = stac92xx_dmux_enum_put, | 1191 | .put = stac92xx_dmux_enum_put, |
916 | }; | 1192 | }; |
917 | 1193 | ||
1194 | static struct snd_kcontrol_new stac_smux_mixer = { | ||
1195 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1196 | .name = "IEC958 Playback Source", | ||
1197 | /* count set later */ | ||
1198 | .info = stac92xx_smux_enum_info, | ||
1199 | .get = stac92xx_smux_enum_get, | ||
1200 | .put = stac92xx_smux_enum_put, | ||
1201 | }; | ||
1202 | |||
918 | static const char *slave_vols[] = { | 1203 | static const char *slave_vols[] = { |
919 | "Front Playback Volume", | 1204 | "Front Playback Volume", |
920 | "Surround Playback Volume", | 1205 | "Surround Playback Volume", |
@@ -966,6 +1251,22 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
966 | if (err < 0) | 1251 | if (err < 0) |
967 | return err; | 1252 | return err; |
968 | } | 1253 | } |
1254 | if (spec->num_smuxes > 0) { | ||
1255 | int wcaps = get_wcaps(codec, spec->multiout.dig_out_nid); | ||
1256 | struct hda_input_mux *smux = &spec->private_smux; | ||
1257 | /* check for mute support on SPDIF out */ | ||
1258 | if (wcaps & AC_WCAP_OUT_AMP) { | ||
1259 | smux->items[smux->num_items].label = "Off"; | ||
1260 | smux->items[smux->num_items].index = 0; | ||
1261 | smux->num_items++; | ||
1262 | spec->spdif_mute = 1; | ||
1263 | } | ||
1264 | stac_smux_mixer.count = spec->num_smuxes; | ||
1265 | err = snd_ctl_add(codec->bus->card, | ||
1266 | snd_ctl_new1(&stac_smux_mixer, codec)); | ||
1267 | if (err < 0) | ||
1268 | return err; | ||
1269 | } | ||
969 | 1270 | ||
970 | if (spec->multiout.dig_out_nid) { | 1271 | if (spec->multiout.dig_out_nid) { |
971 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); | 1272 | err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); |
@@ -977,7 +1278,7 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
977 | return err; | 1278 | return err; |
978 | spec->multiout.share_spdif = 1; | 1279 | spec->multiout.share_spdif = 1; |
979 | } | 1280 | } |
980 | if (spec->dig_in_nid) { | 1281 | if (spec->dig_in_nid && (!spec->gpio_dir & 0x01)) { |
981 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 1282 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
982 | if (err < 0) | 1283 | if (err < 0) |
983 | return err; | 1284 | return err; |
@@ -1325,40 +1626,65 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1325 | {} /* terminator */ | 1626 | {} /* terminator */ |
1326 | }; | 1627 | }; |
1327 | 1628 | ||
1328 | static unsigned int ref92hd71bxx_pin_configs[10] = { | 1629 | static unsigned int ref92hd83xxx_pin_configs[14] = { |
1630 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, | ||
1631 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, | ||
1632 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, | ||
1633 | 0x01451160, 0x98560170, | ||
1634 | }; | ||
1635 | |||
1636 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | ||
1637 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | ||
1638 | }; | ||
1639 | |||
1640 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | ||
1641 | [STAC_92HD83XXX_REF] = "ref", | ||
1642 | }; | ||
1643 | |||
1644 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | ||
1645 | /* SigmaTel reference board */ | ||
1646 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | ||
1647 | "DFI LanParty", STAC_92HD71BXX_REF), | ||
1648 | }; | ||
1649 | |||
1650 | static unsigned int ref92hd71bxx_pin_configs[11] = { | ||
1329 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, | 1651 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
1330 | 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0, | 1652 | 0x0181302e, 0x01114010, 0x01019020, 0x90a000f0, |
1331 | 0x90a000f0, 0x01452050, | 1653 | 0x90a000f0, 0x01452050, 0x01452050, |
1332 | }; | 1654 | }; |
1333 | 1655 | ||
1334 | static unsigned int dell_m4_1_pin_configs[10] = { | 1656 | static unsigned int dell_m4_1_pin_configs[11] = { |
1335 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, | 1657 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
1336 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, | 1658 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
1337 | 0x40f000f0, 0x4f0000f0, | 1659 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, |
1338 | }; | 1660 | }; |
1339 | 1661 | ||
1340 | static unsigned int dell_m4_2_pin_configs[10] = { | 1662 | static unsigned int dell_m4_2_pin_configs[11] = { |
1341 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | 1663 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
1342 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, | 1664 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
1343 | 0x40f000f0, 0x044413b0, | 1665 | 0x40f000f0, 0x044413b0, 0x044413b0, |
1344 | }; | 1666 | }; |
1345 | 1667 | ||
1346 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | 1668 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
1347 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, | 1669 | [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, |
1348 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, | 1670 | [STAC_DELL_M4_1] = dell_m4_1_pin_configs, |
1349 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, | 1671 | [STAC_DELL_M4_2] = dell_m4_2_pin_configs, |
1672 | [STAC_HP_M4] = NULL, | ||
1350 | }; | 1673 | }; |
1351 | 1674 | ||
1352 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { | 1675 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
1353 | [STAC_92HD71BXX_REF] = "ref", | 1676 | [STAC_92HD71BXX_REF] = "ref", |
1354 | [STAC_DELL_M4_1] = "dell-m4-1", | 1677 | [STAC_DELL_M4_1] = "dell-m4-1", |
1355 | [STAC_DELL_M4_2] = "dell-m4-2", | 1678 | [STAC_DELL_M4_2] = "dell-m4-2", |
1679 | [STAC_HP_M4] = "hp-m4", | ||
1356 | }; | 1680 | }; |
1357 | 1681 | ||
1358 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | 1682 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
1359 | /* SigmaTel reference board */ | 1683 | /* SigmaTel reference board */ |
1360 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1361 | "DFI LanParty", STAC_92HD71BXX_REF), | 1685 | "DFI LanParty", STAC_92HD71BXX_REF), |
1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | ||
1687 | "unknown HP", STAC_HP_M4), | ||
1362 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
1363 | "unknown Dell", STAC_DELL_M4_1), | 1689 | "unknown Dell", STAC_DELL_M4_1), |
1364 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, | 1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
@@ -1477,6 +1803,11 @@ static unsigned int intel_mac_v5_pin_configs[10] = { | |||
1477 | 0x400000fc, 0x400000fb, | 1803 | 0x400000fc, 0x400000fb, |
1478 | }; | 1804 | }; |
1479 | 1805 | ||
1806 | static unsigned int ecs202_pin_configs[10] = { | ||
1807 | 0x0221401f, 0x02a19020, 0x01a19020, 0x01114010, | ||
1808 | 0x408000f0, 0x01813022, 0x074510a0, 0x40c400f1, | ||
1809 | 0x9037012e, 0x40e000f2, | ||
1810 | }; | ||
1480 | 1811 | ||
1481 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | 1812 | static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { |
1482 | [STAC_D945_REF] = ref922x_pin_configs, | 1813 | [STAC_D945_REF] = ref922x_pin_configs, |
@@ -1495,6 +1826,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | |||
1495 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, | 1826 | [STAC_MACBOOK_PRO_V2] = intel_mac_v3_pin_configs, |
1496 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, | 1827 | [STAC_IMAC_INTEL] = intel_mac_v2_pin_configs, |
1497 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, | 1828 | [STAC_IMAC_INTEL_20] = intel_mac_v3_pin_configs, |
1829 | [STAC_ECS_202] = ecs202_pin_configs, | ||
1498 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, | 1830 | [STAC_922X_DELL_D81] = dell_922x_d81_pin_configs, |
1499 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, | 1831 | [STAC_922X_DELL_D82] = dell_922x_d82_pin_configs, |
1500 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, | 1832 | [STAC_922X_DELL_M81] = dell_922x_m81_pin_configs, |
@@ -1518,6 +1850,7 @@ static const char *stac922x_models[STAC_922X_MODELS] = { | |||
1518 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", | 1850 | [STAC_MACBOOK_PRO_V2] = "macbook-pro", |
1519 | [STAC_IMAC_INTEL] = "imac-intel", | 1851 | [STAC_IMAC_INTEL] = "imac-intel", |
1520 | [STAC_IMAC_INTEL_20] = "imac-intel-20", | 1852 | [STAC_IMAC_INTEL_20] = "imac-intel-20", |
1853 | [STAC_ECS_202] = "ecs202", | ||
1521 | [STAC_922X_DELL_D81] = "dell-d81", | 1854 | [STAC_922X_DELL_D81] = "dell-d81", |
1522 | [STAC_922X_DELL_D82] = "dell-d82", | 1855 | [STAC_922X_DELL_D82] = "dell-d82", |
1523 | [STAC_922X_DELL_M81] = "dell-m81", | 1856 | [STAC_922X_DELL_M81] = "dell-m81", |
@@ -1604,6 +1937,33 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { | |||
1604 | "unknown Dell", STAC_922X_DELL_D81), | 1937 | "unknown Dell", STAC_922X_DELL_D81), |
1605 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, | 1938 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
1606 | "Dell XPS M1210", STAC_922X_DELL_M82), | 1939 | "Dell XPS M1210", STAC_922X_DELL_M82), |
1940 | /* ECS/PC Chips boards */ | ||
1941 | SND_PCI_QUIRK(0x1019, 0x2144, | ||
1942 | "ECS/PC chips", STAC_ECS_202), | ||
1943 | SND_PCI_QUIRK(0x1019, 0x2608, | ||
1944 | "ECS/PC chips", STAC_ECS_202), | ||
1945 | SND_PCI_QUIRK(0x1019, 0x2633, | ||
1946 | "ECS/PC chips P17G/1333", STAC_ECS_202), | ||
1947 | SND_PCI_QUIRK(0x1019, 0x2811, | ||
1948 | "ECS/PC chips", STAC_ECS_202), | ||
1949 | SND_PCI_QUIRK(0x1019, 0x2812, | ||
1950 | "ECS/PC chips", STAC_ECS_202), | ||
1951 | SND_PCI_QUIRK(0x1019, 0x2813, | ||
1952 | "ECS/PC chips", STAC_ECS_202), | ||
1953 | SND_PCI_QUIRK(0x1019, 0x2814, | ||
1954 | "ECS/PC chips", STAC_ECS_202), | ||
1955 | SND_PCI_QUIRK(0x1019, 0x2815, | ||
1956 | "ECS/PC chips", STAC_ECS_202), | ||
1957 | SND_PCI_QUIRK(0x1019, 0x2816, | ||
1958 | "ECS/PC chips", STAC_ECS_202), | ||
1959 | SND_PCI_QUIRK(0x1019, 0x2817, | ||
1960 | "ECS/PC chips", STAC_ECS_202), | ||
1961 | SND_PCI_QUIRK(0x1019, 0x2818, | ||
1962 | "ECS/PC chips", STAC_ECS_202), | ||
1963 | SND_PCI_QUIRK(0x1019, 0x2819, | ||
1964 | "ECS/PC chips", STAC_ECS_202), | ||
1965 | SND_PCI_QUIRK(0x1019, 0x2820, | ||
1966 | "ECS/PC chips", STAC_ECS_202), | ||
1607 | {} /* terminator */ | 1967 | {} /* terminator */ |
1608 | }; | 1968 | }; |
1609 | 1969 | ||
@@ -1683,8 +2043,8 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
1683 | /* Dell 3 stack systems with verb table in BIOS */ | 2043 | /* Dell 3 stack systems with verb table in BIOS */ |
1684 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), | 2044 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f3, "Dell Inspiron 1420", STAC_DELL_BIOS), |
1685 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), | 2045 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0227, "Dell Vostro 1400 ", STAC_DELL_BIOS), |
1686 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell ", STAC_DELL_BIOS), | ||
1687 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), | 2046 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022e, "Dell ", STAC_DELL_BIOS), |
2047 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x022f, "Dell Inspiron 1525", STAC_DELL_3ST), | ||
1688 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), | 2048 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0242, "Dell ", STAC_DELL_BIOS), |
1689 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), | 2049 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0243, "Dell ", STAC_DELL_BIOS), |
1690 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), | 2050 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
@@ -1867,6 +2227,8 @@ static int stac92xx_playback_pcm_open(struct hda_pcm_stream *hinfo, | |||
1867 | struct snd_pcm_substream *substream) | 2227 | struct snd_pcm_substream *substream) |
1868 | { | 2228 | { |
1869 | struct sigmatel_spec *spec = codec->spec; | 2229 | struct sigmatel_spec *spec = codec->spec; |
2230 | if (spec->stream_delay) | ||
2231 | msleep(spec->stream_delay); | ||
1870 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, | 2232 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
1871 | hinfo); | 2233 | hinfo); |
1872 | } | 2234 | } |
@@ -1930,9 +2292,14 @@ static int stac92xx_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
1930 | struct snd_pcm_substream *substream) | 2292 | struct snd_pcm_substream *substream) |
1931 | { | 2293 | { |
1932 | struct sigmatel_spec *spec = codec->spec; | 2294 | struct sigmatel_spec *spec = codec->spec; |
2295 | hda_nid_t nid = spec->adc_nids[substream->number]; | ||
1933 | 2296 | ||
1934 | snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], | 2297 | if (spec->powerdown_adcs) { |
1935 | stream_tag, 0, format); | 2298 | msleep(40); |
2299 | snd_hda_codec_write_cache(codec, nid, 0, | ||
2300 | AC_VERB_SET_POWER_STATE, AC_PWRST_D0); | ||
2301 | } | ||
2302 | snd_hda_codec_setup_stream(codec, nid, stream_tag, 0, format); | ||
1936 | return 0; | 2303 | return 0; |
1937 | } | 2304 | } |
1938 | 2305 | ||
@@ -1941,8 +2308,12 @@ static int stac92xx_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
1941 | struct snd_pcm_substream *substream) | 2308 | struct snd_pcm_substream *substream) |
1942 | { | 2309 | { |
1943 | struct sigmatel_spec *spec = codec->spec; | 2310 | struct sigmatel_spec *spec = codec->spec; |
2311 | hda_nid_t nid = spec->adc_nids[substream->number]; | ||
1944 | 2312 | ||
1945 | snd_hda_codec_cleanup_stream(codec, spec->adc_nids[substream->number]); | 2313 | snd_hda_codec_cleanup_stream(codec, nid); |
2314 | if (spec->powerdown_adcs) | ||
2315 | snd_hda_codec_write_cache(codec, nid, 0, | ||
2316 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
1946 | return 0; | 2317 | return 0; |
1947 | } | 2318 | } |
1948 | 2319 | ||
@@ -2193,6 +2564,8 @@ enum { | |||
2193 | STAC_CTL_WIDGET_VOL, | 2564 | STAC_CTL_WIDGET_VOL, |
2194 | STAC_CTL_WIDGET_MUTE, | 2565 | STAC_CTL_WIDGET_MUTE, |
2195 | STAC_CTL_WIDGET_MONO_MUX, | 2566 | STAC_CTL_WIDGET_MONO_MUX, |
2567 | STAC_CTL_WIDGET_AMP_MUX, | ||
2568 | STAC_CTL_WIDGET_AMP_VOL, | ||
2196 | STAC_CTL_WIDGET_HP_SWITCH, | 2569 | STAC_CTL_WIDGET_HP_SWITCH, |
2197 | STAC_CTL_WIDGET_IO_SWITCH, | 2570 | STAC_CTL_WIDGET_IO_SWITCH, |
2198 | STAC_CTL_WIDGET_CLFE_SWITCH | 2571 | STAC_CTL_WIDGET_CLFE_SWITCH |
@@ -2202,13 +2575,16 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2202 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), | 2575 | HDA_CODEC_VOLUME(NULL, 0, 0, 0), |
2203 | HDA_CODEC_MUTE(NULL, 0, 0, 0), | 2576 | HDA_CODEC_MUTE(NULL, 0, 0, 0), |
2204 | STAC_MONO_MUX, | 2577 | STAC_MONO_MUX, |
2578 | STAC_AMP_MUX, | ||
2579 | STAC_AMP_VOL(NULL, 0, 0, 0, 0), | ||
2205 | STAC_CODEC_HP_SWITCH(NULL), | 2580 | STAC_CODEC_HP_SWITCH(NULL), |
2206 | STAC_CODEC_IO_SWITCH(NULL, 0), | 2581 | STAC_CODEC_IO_SWITCH(NULL, 0), |
2207 | STAC_CODEC_CLFE_SWITCH(NULL, 0), | 2582 | STAC_CODEC_CLFE_SWITCH(NULL, 0), |
2208 | }; | 2583 | }; |
2209 | 2584 | ||
2210 | /* add dynamic controls */ | 2585 | /* add dynamic controls */ |
2211 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char *name, unsigned long val) | 2586 | static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, |
2587 | int idx, const char *name, unsigned long val) | ||
2212 | { | 2588 | { |
2213 | struct snd_kcontrol_new *knew; | 2589 | struct snd_kcontrol_new *knew; |
2214 | 2590 | ||
@@ -2228,6 +2604,7 @@ static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char | |||
2228 | 2604 | ||
2229 | knew = &spec->kctl_alloc[spec->num_kctl_used]; | 2605 | knew = &spec->kctl_alloc[spec->num_kctl_used]; |
2230 | *knew = stac92xx_control_templates[type]; | 2606 | *knew = stac92xx_control_templates[type]; |
2607 | knew->index = idx; | ||
2231 | knew->name = kstrdup(name, GFP_KERNEL); | 2608 | knew->name = kstrdup(name, GFP_KERNEL); |
2232 | if (! knew->name) | 2609 | if (! knew->name) |
2233 | return -ENOMEM; | 2610 | return -ENOMEM; |
@@ -2236,6 +2613,14 @@ static int stac92xx_add_control(struct sigmatel_spec *spec, int type, const char | |||
2236 | return 0; | 2613 | return 0; |
2237 | } | 2614 | } |
2238 | 2615 | ||
2616 | |||
2617 | /* add dynamic controls */ | ||
2618 | static int stac92xx_add_control(struct sigmatel_spec *spec, int type, | ||
2619 | const char *name, unsigned long val) | ||
2620 | { | ||
2621 | return stac92xx_add_control_idx(spec, type, 0, name, val); | ||
2622 | } | ||
2623 | |||
2239 | /* flag inputs as additional dynamic lineouts */ | 2624 | /* flag inputs as additional dynamic lineouts */ |
2240 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) | 2625 | static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) |
2241 | { | 2626 | { |
@@ -2467,6 +2852,10 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
2467 | } | 2852 | } |
2468 | } | 2853 | } |
2469 | 2854 | ||
2855 | if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && | ||
2856 | cfg->hp_outs && !spec->multiout.hp_nid) | ||
2857 | spec->multiout.hp_nid = nid; | ||
2858 | |||
2470 | if (cfg->hp_outs > 1) { | 2859 | if (cfg->hp_outs > 1) { |
2471 | err = stac92xx_add_control(spec, | 2860 | err = stac92xx_add_control(spec, |
2472 | STAC_CTL_WIDGET_HP_SWITCH, | 2861 | STAC_CTL_WIDGET_HP_SWITCH, |
@@ -2579,8 +2968,8 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, | |||
2579 | } | 2968 | } |
2580 | 2969 | ||
2581 | /* labels for mono mux outputs */ | 2970 | /* labels for mono mux outputs */ |
2582 | static const char *stac92xx_mono_labels[3] = { | 2971 | static const char *stac92xx_mono_labels[4] = { |
2583 | "DAC0", "DAC1", "Mixer" | 2972 | "DAC0", "DAC1", "Mixer", "DAC2" |
2584 | }; | 2973 | }; |
2585 | 2974 | ||
2586 | /* create mono mux for mono out on capable codecs */ | 2975 | /* create mono mux for mono out on capable codecs */ |
@@ -2609,6 +2998,116 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) | |||
2609 | "Mono Mux", spec->mono_nid); | 2998 | "Mono Mux", spec->mono_nid); |
2610 | } | 2999 | } |
2611 | 3000 | ||
3001 | /* labels for amp mux outputs */ | ||
3002 | static const char *stac92xx_amp_labels[3] = { | ||
3003 | "Front Microphone", "Microphone", "Line In" | ||
3004 | }; | ||
3005 | |||
3006 | /* create amp out controls mux on capable codecs */ | ||
3007 | static int stac92xx_auto_create_amp_output_ctls(struct hda_codec *codec) | ||
3008 | { | ||
3009 | struct sigmatel_spec *spec = codec->spec; | ||
3010 | struct hda_input_mux *amp_mux = &spec->private_amp_mux; | ||
3011 | int i, err; | ||
3012 | |||
3013 | for (i = 0; i < spec->num_amps; i++) { | ||
3014 | amp_mux->items[amp_mux->num_items].label = | ||
3015 | stac92xx_amp_labels[i]; | ||
3016 | amp_mux->items[amp_mux->num_items].index = i; | ||
3017 | amp_mux->num_items++; | ||
3018 | } | ||
3019 | |||
3020 | if (spec->num_amps > 1) { | ||
3021 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_MUX, | ||
3022 | "Amp Selector Capture Switch", 0); | ||
3023 | if (err < 0) | ||
3024 | return err; | ||
3025 | } | ||
3026 | return stac92xx_add_control(spec, STAC_CTL_WIDGET_AMP_VOL, | ||
3027 | "Amp Capture Volume", | ||
3028 | HDA_COMPOSE_AMP_VAL(spec->amp_nids[0], 3, 0, HDA_INPUT)); | ||
3029 | } | ||
3030 | |||
3031 | |||
3032 | /* create PC beep volume controls */ | ||
3033 | static int stac92xx_auto_create_beep_ctls(struct hda_codec *codec, | ||
3034 | hda_nid_t nid) | ||
3035 | { | ||
3036 | struct sigmatel_spec *spec = codec->spec; | ||
3037 | u32 caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3038 | int err; | ||
3039 | |||
3040 | /* check for mute support for the the amp */ | ||
3041 | if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { | ||
3042 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, | ||
3043 | "PC Beep Playback Switch", | ||
3044 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | ||
3045 | if (err < 0) | ||
3046 | return err; | ||
3047 | } | ||
3048 | |||
3049 | /* check to see if there is volume support for the amp */ | ||
3050 | if ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) { | ||
3051 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, | ||
3052 | "PC Beep Playback Volume", | ||
3053 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)); | ||
3054 | if (err < 0) | ||
3055 | return err; | ||
3056 | } | ||
3057 | return 0; | ||
3058 | } | ||
3059 | |||
3060 | static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) | ||
3061 | { | ||
3062 | struct sigmatel_spec *spec = codec->spec; | ||
3063 | int wcaps, nid, i, err = 0; | ||
3064 | |||
3065 | for (i = 0; i < spec->num_muxes; i++) { | ||
3066 | nid = spec->mux_nids[i]; | ||
3067 | wcaps = get_wcaps(codec, nid); | ||
3068 | |||
3069 | if (wcaps & AC_WCAP_OUT_AMP) { | ||
3070 | err = stac92xx_add_control_idx(spec, | ||
3071 | STAC_CTL_WIDGET_VOL, i, "Mux Capture Volume", | ||
3072 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | ||
3073 | if (err < 0) | ||
3074 | return err; | ||
3075 | } | ||
3076 | } | ||
3077 | return 0; | ||
3078 | }; | ||
3079 | |||
3080 | static const char *stac92xx_spdif_labels[3] = { | ||
3081 | "Digital Playback", "Analog Mux 1", "Analog Mux 2", | ||
3082 | }; | ||
3083 | |||
3084 | static int stac92xx_auto_create_spdif_mux_ctls(struct hda_codec *codec) | ||
3085 | { | ||
3086 | struct sigmatel_spec *spec = codec->spec; | ||
3087 | struct hda_input_mux *spdif_mux = &spec->private_smux; | ||
3088 | const char **labels = spec->spdif_labels; | ||
3089 | int i, num_cons; | ||
3090 | hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; | ||
3091 | |||
3092 | num_cons = snd_hda_get_connections(codec, | ||
3093 | spec->smux_nids[0], | ||
3094 | con_lst, | ||
3095 | HDA_MAX_NUM_INPUTS); | ||
3096 | if (!num_cons) | ||
3097 | return -EINVAL; | ||
3098 | |||
3099 | if (!labels) | ||
3100 | labels = stac92xx_spdif_labels; | ||
3101 | |||
3102 | for (i = 0; i < num_cons; i++) { | ||
3103 | spdif_mux->items[spdif_mux->num_items].label = labels[i]; | ||
3104 | spdif_mux->items[spdif_mux->num_items].index = i; | ||
3105 | spdif_mux->num_items++; | ||
3106 | } | ||
3107 | |||
3108 | return 0; | ||
3109 | } | ||
3110 | |||
2612 | /* labels for dmic mux inputs */ | 3111 | /* labels for dmic mux inputs */ |
2613 | static const char *stac92xx_dmic_labels[5] = { | 3112 | static const char *stac92xx_dmic_labels[5] = { |
2614 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", | 3113 | "Analog Inputs", "Digital Mic 1", "Digital Mic 2", |
@@ -2656,16 +3155,19 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
2656 | } | 3155 | } |
2657 | continue; | 3156 | continue; |
2658 | found: | 3157 | found: |
2659 | wcaps = get_wcaps(codec, nid); | 3158 | wcaps = get_wcaps(codec, nid) & |
3159 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | ||
2660 | 3160 | ||
2661 | if (wcaps & AC_WCAP_OUT_AMP) { | 3161 | if (wcaps) { |
2662 | sprintf(name, "%s Capture Volume", | 3162 | sprintf(name, "%s Capture Volume", |
2663 | stac92xx_dmic_labels[dimux->num_items]); | 3163 | stac92xx_dmic_labels[dimux->num_items]); |
2664 | 3164 | ||
2665 | err = stac92xx_add_control(spec, | 3165 | err = stac92xx_add_control(spec, |
2666 | STAC_CTL_WIDGET_VOL, | 3166 | STAC_CTL_WIDGET_VOL, |
2667 | name, | 3167 | name, |
2668 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT)); | 3168 | HDA_COMPOSE_AMP_VAL(nid, 3, 0, |
3169 | (wcaps & AC_WCAP_OUT_AMP) ? | ||
3170 | HDA_OUTPUT : HDA_INPUT)); | ||
2669 | if (err < 0) | 3171 | if (err < 0) |
2670 | return err; | 3172 | return err; |
2671 | } | 3173 | } |
@@ -2789,8 +3291,8 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2789 | hp_speaker_swap = 1; | 3291 | hp_speaker_swap = 1; |
2790 | } | 3292 | } |
2791 | if (spec->autocfg.mono_out_pin) { | 3293 | if (spec->autocfg.mono_out_pin) { |
2792 | int dir = (get_wcaps(codec, spec->autocfg.mono_out_pin) | 3294 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
2793 | & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; | 3295 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
2794 | u32 caps = query_amp_caps(codec, | 3296 | u32 caps = query_amp_caps(codec, |
2795 | spec->autocfg.mono_out_pin, dir); | 3297 | spec->autocfg.mono_out_pin, dir); |
2796 | hda_nid_t conn_list[1]; | 3298 | hda_nid_t conn_list[1]; |
@@ -2812,21 +3314,26 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2812 | !(wcaps & AC_WCAP_LR_SWAP)) | 3314 | !(wcaps & AC_WCAP_LR_SWAP)) |
2813 | spec->mono_nid = conn_list[0]; | 3315 | spec->mono_nid = conn_list[0]; |
2814 | } | 3316 | } |
2815 | /* all mono outs have a least a mute/unmute switch */ | 3317 | if (dir) { |
2816 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, | 3318 | hda_nid_t nid = spec->autocfg.mono_out_pin; |
2817 | "Mono Playback Switch", | 3319 | |
2818 | HDA_COMPOSE_AMP_VAL(spec->autocfg.mono_out_pin, | 3320 | /* most mono outs have a least a mute/unmute switch */ |
2819 | 1, 0, dir)); | 3321 | dir = (dir & AC_WCAP_OUT_AMP) ? HDA_OUTPUT : HDA_INPUT; |
2820 | if (err < 0) | 3322 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, |
2821 | return err; | 3323 | "Mono Playback Switch", |
2822 | /* check to see if there is volume support for the amp */ | 3324 | 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) | 3325 | if (err < 0) |
2829 | return err; | 3326 | return err; |
3327 | /* check for volume support for the amp */ | ||
3328 | if ((caps & AC_AMPCAP_NUM_STEPS) | ||
3329 | >> AC_AMPCAP_NUM_STEPS_SHIFT) { | ||
3330 | err = stac92xx_add_control(spec, | ||
3331 | STAC_CTL_WIDGET_VOL, | ||
3332 | "Mono Playback Volume", | ||
3333 | HDA_COMPOSE_AMP_VAL(nid, 1, 0, dir)); | ||
3334 | if (err < 0) | ||
3335 | return err; | ||
3336 | } | ||
2830 | } | 3337 | } |
2831 | 3338 | ||
2832 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, | 3339 | stac92xx_auto_set_pinctl(codec, spec->autocfg.mono_out_pin, |
@@ -2844,6 +3351,28 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2844 | if (err < 0) | 3351 | if (err < 0) |
2845 | return err; | 3352 | return err; |
2846 | 3353 | ||
3354 | /* setup analog beep controls */ | ||
3355 | if (spec->anabeep_nid > 0) { | ||
3356 | err = stac92xx_auto_create_beep_ctls(codec, | ||
3357 | spec->anabeep_nid); | ||
3358 | if (err < 0) | ||
3359 | return err; | ||
3360 | } | ||
3361 | |||
3362 | /* setup digital beep controls and input device */ | ||
3363 | #ifdef CONFIG_SND_HDA_INPUT_BEEP | ||
3364 | if (spec->digbeep_nid > 0) { | ||
3365 | hda_nid_t nid = spec->digbeep_nid; | ||
3366 | |||
3367 | err = stac92xx_auto_create_beep_ctls(codec, nid); | ||
3368 | if (err < 0) | ||
3369 | return err; | ||
3370 | err = snd_hda_attach_beep_device(codec, nid); | ||
3371 | if (err < 0) | ||
3372 | return err; | ||
3373 | } | ||
3374 | #endif | ||
3375 | |||
2847 | if (hp_speaker_swap == 1) { | 3376 | if (hp_speaker_swap == 1) { |
2848 | /* Restore the hp_outs and line_outs */ | 3377 | /* Restore the hp_outs and line_outs */ |
2849 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, | 3378 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, |
@@ -2872,11 +3401,25 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2872 | if (err < 0) | 3401 | if (err < 0) |
2873 | return err; | 3402 | return err; |
2874 | } | 3403 | } |
2875 | 3404 | if (spec->num_amps > 0) { | |
2876 | if (spec->num_dmics > 0) | 3405 | err = stac92xx_auto_create_amp_output_ctls(codec); |
3406 | if (err < 0) | ||
3407 | return err; | ||
3408 | } | ||
3409 | if (spec->num_dmics > 0 && !spec->dinput_mux) | ||
2877 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, | 3410 | if ((err = stac92xx_auto_create_dmic_input_ctls(codec, |
2878 | &spec->autocfg)) < 0) | 3411 | &spec->autocfg)) < 0) |
2879 | return err; | 3412 | return err; |
3413 | if (spec->num_muxes > 0) { | ||
3414 | err = stac92xx_auto_create_mux_input_ctls(codec); | ||
3415 | if (err < 0) | ||
3416 | return err; | ||
3417 | } | ||
3418 | if (spec->num_smuxes > 0) { | ||
3419 | err = stac92xx_auto_create_spdif_mux_ctls(codec); | ||
3420 | if (err < 0) | ||
3421 | return err; | ||
3422 | } | ||
2880 | 3423 | ||
2881 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 3424 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2882 | if (spec->multiout.max_channels > 2) | 3425 | if (spec->multiout.max_channels > 2) |
@@ -2884,17 +3427,17 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
2884 | 3427 | ||
2885 | if (spec->autocfg.dig_out_pin) | 3428 | if (spec->autocfg.dig_out_pin) |
2886 | spec->multiout.dig_out_nid = dig_out; | 3429 | spec->multiout.dig_out_nid = dig_out; |
2887 | if (spec->autocfg.dig_in_pin) | 3430 | if (dig_in && spec->autocfg.dig_in_pin) |
2888 | spec->dig_in_nid = dig_in; | 3431 | spec->dig_in_nid = dig_in; |
2889 | 3432 | ||
2890 | if (spec->kctl_alloc) | 3433 | if (spec->kctl_alloc) |
2891 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; | 3434 | spec->mixers[spec->num_mixers++] = spec->kctl_alloc; |
2892 | 3435 | ||
2893 | spec->input_mux = &spec->private_imux; | 3436 | spec->input_mux = &spec->private_imux; |
2894 | if (!spec->dinput_mux) | 3437 | spec->dinput_mux = &spec->private_dimux; |
2895 | spec->dinput_mux = &spec->private_dimux; | 3438 | spec->sinput_mux = &spec->private_smux; |
2896 | spec->mono_mux = &spec->private_mono_mux; | 3439 | spec->mono_mux = &spec->private_mono_mux; |
2897 | 3440 | spec->amp_mux = &spec->private_amp_mux; | |
2898 | return 1; | 3441 | return 1; |
2899 | } | 3442 | } |
2900 | 3443 | ||
@@ -3074,6 +3617,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3074 | 3617 | ||
3075 | snd_hda_sequence_write(codec, spec->init); | 3618 | snd_hda_sequence_write(codec, spec->init); |
3076 | 3619 | ||
3620 | /* power down adcs initially */ | ||
3621 | if (spec->powerdown_adcs) | ||
3622 | for (i = 0; i < spec->num_adcs; i++) | ||
3623 | snd_hda_codec_write_cache(codec, | ||
3624 | spec->adc_nids[i], 0, | ||
3625 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | ||
3077 | /* set up pins */ | 3626 | /* set up pins */ |
3078 | if (spec->hp_detect) { | 3627 | if (spec->hp_detect) { |
3079 | /* Enable unsolicited responses on the HP widget */ | 3628 | /* Enable unsolicited responses on the HP widget */ |
@@ -3095,7 +3644,12 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3095 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3644 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3096 | hda_nid_t nid = cfg->input_pins[i]; | 3645 | hda_nid_t nid = cfg->input_pins[i]; |
3097 | if (nid) { | 3646 | if (nid) { |
3098 | unsigned int pinctl = AC_PINCTL_IN_EN; | 3647 | unsigned int pinctl = snd_hda_codec_read(codec, nid, |
3648 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
3649 | /* if PINCTL already set then skip */ | ||
3650 | if (pinctl & AC_PINCAP_IN) | ||
3651 | continue; | ||
3652 | pinctl = AC_PINCTL_IN_EN; | ||
3099 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) | 3653 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) |
3100 | pinctl |= stac92xx_get_vref(codec, nid); | 3654 | pinctl |= stac92xx_get_vref(codec, nid); |
3101 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | 3655 | stac92xx_auto_set_pinctl(codec, nid, pinctl); |
@@ -3158,6 +3712,7 @@ static void stac92xx_free(struct hda_codec *codec) | |||
3158 | kfree(spec->bios_pin_configs); | 3712 | kfree(spec->bios_pin_configs); |
3159 | 3713 | ||
3160 | kfree(spec); | 3714 | kfree(spec); |
3715 | snd_hda_detach_beep_device(codec); | ||
3161 | } | 3716 | } |
3162 | 3717 | ||
3163 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | 3718 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
@@ -3279,7 +3834,12 @@ static void stac92xx_pin_sense(struct hda_codec *codec, int idx) | |||
3279 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) | 3834 | val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) |
3280 | & 0x000000ff; | 3835 | & 0x000000ff; |
3281 | presence = get_hp_pin_presence(codec, nid); | 3836 | presence = get_hp_pin_presence(codec, nid); |
3282 | idx = 1 << idx; | 3837 | |
3838 | /* several codecs have two power down bits */ | ||
3839 | if (spec->pwr_mapping) | ||
3840 | idx = spec->pwr_mapping[idx]; | ||
3841 | else | ||
3842 | idx = 1 << idx; | ||
3283 | 3843 | ||
3284 | if (presence) | 3844 | if (presence) |
3285 | val &= ~idx; | 3845 | val &= ~idx; |
@@ -3295,13 +3855,22 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
3295 | struct sigmatel_spec *spec = codec->spec; | 3855 | struct sigmatel_spec *spec = codec->spec; |
3296 | int idx = res >> 26 & 0x0f; | 3856 | int idx = res >> 26 & 0x0f; |
3297 | 3857 | ||
3298 | switch ((res >> 26) & 0x30) { | 3858 | switch ((res >> 26) & 0x70) { |
3299 | case STAC_HP_EVENT: | 3859 | case STAC_HP_EVENT: |
3300 | stac92xx_hp_detect(codec, res); | 3860 | stac92xx_hp_detect(codec, res); |
3301 | /* fallthru */ | 3861 | /* fallthru */ |
3302 | case STAC_PWR_EVENT: | 3862 | case STAC_PWR_EVENT: |
3303 | if (spec->num_pwrs > 0) | 3863 | if (spec->num_pwrs > 0) |
3304 | stac92xx_pin_sense(codec, idx); | 3864 | stac92xx_pin_sense(codec, idx); |
3865 | break; | ||
3866 | case STAC_VREF_EVENT: { | ||
3867 | int data = snd_hda_codec_read(codec, codec->afg, 0, | ||
3868 | AC_VERB_GET_GPIO_DATA, 0); | ||
3869 | /* toggle VREF state based on GPIOx status */ | ||
3870 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, | ||
3871 | !!(data & (1 << idx))); | ||
3872 | break; | ||
3873 | } | ||
3305 | } | 3874 | } |
3306 | } | 3875 | } |
3307 | 3876 | ||
@@ -3478,9 +4047,9 @@ static struct hda_input_mux stac92hd73xx_dmux = { | |||
3478 | .num_items = 4, | 4047 | .num_items = 4, |
3479 | .items = { | 4048 | .items = { |
3480 | { "Analog Inputs", 0x0b }, | 4049 | { "Analog Inputs", 0x0b }, |
3481 | { "CD", 0x08 }, | ||
3482 | { "Digital Mic 1", 0x09 }, | 4050 | { "Digital Mic 1", 0x09 }, |
3483 | { "Digital Mic 2", 0x0a }, | 4051 | { "Digital Mic 2", 0x0a }, |
4052 | { "CD", 0x08 }, | ||
3484 | } | 4053 | } |
3485 | }; | 4054 | }; |
3486 | 4055 | ||
@@ -3495,6 +4064,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
3495 | return -ENOMEM; | 4064 | return -ENOMEM; |
3496 | 4065 | ||
3497 | codec->spec = spec; | 4066 | codec->spec = spec; |
4067 | codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; | ||
3498 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); | 4068 | spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); |
3499 | spec->pin_nids = stac92hd73xx_pin_nids; | 4069 | spec->pin_nids = stac92hd73xx_pin_nids; |
3500 | spec->board_config = snd_hda_check_board_config(codec, | 4070 | spec->board_config = snd_hda_check_board_config(codec, |
@@ -3527,17 +4097,14 @@ again: | |||
3527 | 4097 | ||
3528 | switch (spec->multiout.num_dacs) { | 4098 | switch (spec->multiout.num_dacs) { |
3529 | case 0x3: /* 6 Channel */ | 4099 | case 0x3: /* 6 Channel */ |
3530 | spec->multiout.hp_nid = 0x17; | ||
3531 | spec->mixer = stac92hd73xx_6ch_mixer; | 4100 | spec->mixer = stac92hd73xx_6ch_mixer; |
3532 | spec->init = stac92hd73xx_6ch_core_init; | 4101 | spec->init = stac92hd73xx_6ch_core_init; |
3533 | break; | 4102 | break; |
3534 | case 0x4: /* 8 Channel */ | 4103 | case 0x4: /* 8 Channel */ |
3535 | spec->multiout.hp_nid = 0x18; | ||
3536 | spec->mixer = stac92hd73xx_8ch_mixer; | 4104 | spec->mixer = stac92hd73xx_8ch_mixer; |
3537 | spec->init = stac92hd73xx_8ch_core_init; | 4105 | spec->init = stac92hd73xx_8ch_core_init; |
3538 | break; | 4106 | break; |
3539 | case 0x5: /* 10 Channel */ | 4107 | case 0x5: /* 10 Channel */ |
3540 | spec->multiout.hp_nid = 0x19; | ||
3541 | spec->mixer = stac92hd73xx_10ch_mixer; | 4108 | spec->mixer = stac92hd73xx_10ch_mixer; |
3542 | spec->init = stac92hd73xx_10ch_core_init; | 4109 | spec->init = stac92hd73xx_10ch_core_init; |
3543 | }; | 4110 | }; |
@@ -3546,27 +4113,34 @@ again: | |||
3546 | spec->aloopback_mask = 0x01; | 4113 | spec->aloopback_mask = 0x01; |
3547 | spec->aloopback_shift = 8; | 4114 | spec->aloopback_shift = 8; |
3548 | 4115 | ||
4116 | spec->digbeep_nid = 0x1c; | ||
3549 | spec->mux_nids = stac92hd73xx_mux_nids; | 4117 | spec->mux_nids = stac92hd73xx_mux_nids; |
3550 | spec->adc_nids = stac92hd73xx_adc_nids; | 4118 | spec->adc_nids = stac92hd73xx_adc_nids; |
3551 | spec->dmic_nids = stac92hd73xx_dmic_nids; | 4119 | spec->dmic_nids = stac92hd73xx_dmic_nids; |
3552 | spec->dmux_nids = stac92hd73xx_dmux_nids; | 4120 | spec->dmux_nids = stac92hd73xx_dmux_nids; |
4121 | spec->smux_nids = stac92hd73xx_smux_nids; | ||
4122 | spec->amp_nids = stac92hd73xx_amp_nids; | ||
4123 | spec->num_amps = ARRAY_SIZE(stac92hd73xx_amp_nids); | ||
3553 | 4124 | ||
3554 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); | 4125 | spec->num_muxes = ARRAY_SIZE(stac92hd73xx_mux_nids); |
3555 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); | 4126 | spec->num_adcs = ARRAY_SIZE(stac92hd73xx_adc_nids); |
3556 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); | 4127 | spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); |
3557 | spec->dinput_mux = &stac92hd73xx_dmux; | 4128 | memcpy(&spec->private_dimux, &stac92hd73xx_dmux, |
3558 | /* GPIO0 High = Enable EAPD */ | 4129 | sizeof(stac92hd73xx_dmux)); |
3559 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | ||
3560 | spec->gpio_data = 0x01; | ||
3561 | 4130 | ||
3562 | switch (spec->board_config) { | 4131 | switch (spec->board_config) { |
3563 | case STAC_DELL_M6: | 4132 | case STAC_DELL_M6: |
3564 | spec->init = dell_eq_core_init; | 4133 | spec->init = dell_eq_core_init; |
4134 | spec->num_smuxes = 0; | ||
4135 | spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; | ||
4136 | spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; | ||
4137 | spec->num_amps = 1; | ||
3565 | switch (codec->subsystem_id) { | 4138 | switch (codec->subsystem_id) { |
3566 | case 0x1028025e: /* Analog Mics */ | 4139 | case 0x1028025e: /* Analog Mics */ |
3567 | case 0x1028025f: | 4140 | case 0x1028025f: |
3568 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4141 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
3569 | spec->num_dmics = 0; | 4142 | spec->num_dmics = 0; |
4143 | spec->private_dimux.num_items = 1; | ||
3570 | break; | 4144 | break; |
3571 | case 0x10280271: /* Digital Mics */ | 4145 | case 0x10280271: /* Digital Mics */ |
3572 | case 0x10280272: | 4146 | case 0x10280272: |
@@ -3576,23 +4150,32 @@ again: | |||
3576 | case 0x10280255: | 4150 | case 0x10280255: |
3577 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4151 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
3578 | spec->num_dmics = 1; | 4152 | spec->num_dmics = 1; |
4153 | spec->private_dimux.num_items = 2; | ||
3579 | break; | 4154 | break; |
3580 | case 0x10280256: /* Both */ | 4155 | case 0x10280256: /* Both */ |
3581 | case 0x10280057: | 4156 | case 0x10280057: |
3582 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4157 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); |
3583 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4158 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); |
3584 | spec->num_dmics = 1; | 4159 | spec->num_dmics = 1; |
4160 | spec->private_dimux.num_items = 2; | ||
3585 | break; | 4161 | break; |
3586 | } | 4162 | } |
3587 | break; | 4163 | break; |
3588 | default: | 4164 | default: |
3589 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; | 4165 | spec->num_dmics = STAC92HD73XX_NUM_DMICS; |
4166 | spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); | ||
3590 | } | 4167 | } |
4168 | if (spec->board_config > STAC_92HD73XX_REF) { | ||
4169 | /* GPIO0 High = Enable EAPD */ | ||
4170 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | ||
4171 | spec->gpio_data = 0x01; | ||
4172 | } | ||
4173 | spec->dinput_mux = &spec->private_dimux; | ||
3591 | 4174 | ||
3592 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); | 4175 | spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); |
3593 | spec->pwr_nids = stac92hd73xx_pwr_nids; | 4176 | spec->pwr_nids = stac92hd73xx_pwr_nids; |
3594 | 4177 | ||
3595 | err = stac92xx_parse_auto_config(codec, 0x22, 0x24); | 4178 | err = stac92xx_parse_auto_config(codec, 0x25, 0x27); |
3596 | 4179 | ||
3597 | if (!err) { | 4180 | if (!err) { |
3598 | if (spec->board_config < 0) { | 4181 | if (spec->board_config < 0) { |
@@ -3614,6 +4197,136 @@ again: | |||
3614 | return 0; | 4197 | return 0; |
3615 | } | 4198 | } |
3616 | 4199 | ||
4200 | static struct hda_input_mux stac92hd83xxx_dmux = { | ||
4201 | .num_items = 3, | ||
4202 | .items = { | ||
4203 | { "Analog Inputs", 0x03 }, | ||
4204 | { "Digital Mic 1", 0x04 }, | ||
4205 | { "Digital Mic 2", 0x05 }, | ||
4206 | } | ||
4207 | }; | ||
4208 | |||
4209 | static int patch_stac92hd83xxx(struct hda_codec *codec) | ||
4210 | { | ||
4211 | struct sigmatel_spec *spec; | ||
4212 | int err; | ||
4213 | |||
4214 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | ||
4215 | if (spec == NULL) | ||
4216 | return -ENOMEM; | ||
4217 | |||
4218 | codec->spec = spec; | ||
4219 | codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; | ||
4220 | spec->mono_nid = 0x19; | ||
4221 | spec->digbeep_nid = 0x21; | ||
4222 | spec->dmic_nids = stac92hd83xxx_dmic_nids; | ||
4223 | spec->dmux_nids = stac92hd83xxx_dmux_nids; | ||
4224 | spec->adc_nids = stac92hd83xxx_adc_nids; | ||
4225 | spec->pwr_nids = stac92hd83xxx_pwr_nids; | ||
4226 | spec->pwr_mapping = stac92hd83xxx_pwr_mapping; | ||
4227 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); | ||
4228 | spec->multiout.dac_nids = stac92hd83xxx_dac_nids; | ||
4229 | |||
4230 | spec->init = stac92hd83xxx_core_init; | ||
4231 | switch (codec->vendor_id) { | ||
4232 | case 0x111d7605: | ||
4233 | spec->multiout.num_dacs = STAC92HD81_DAC_COUNT; | ||
4234 | break; | ||
4235 | default: | ||
4236 | spec->num_pwrs--; | ||
4237 | spec->init++; /* switch to config #2 */ | ||
4238 | spec->multiout.num_dacs = STAC92HD83_DAC_COUNT; | ||
4239 | } | ||
4240 | |||
4241 | spec->mixer = stac92hd83xxx_mixer; | ||
4242 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); | ||
4243 | spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); | ||
4244 | spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); | ||
4245 | spec->num_dmics = STAC92HD83XXX_NUM_DMICS; | ||
4246 | spec->dinput_mux = &stac92hd83xxx_dmux; | ||
4247 | spec->pin_nids = stac92hd83xxx_pin_nids; | ||
4248 | spec->board_config = snd_hda_check_board_config(codec, | ||
4249 | STAC_92HD83XXX_MODELS, | ||
4250 | stac92hd83xxx_models, | ||
4251 | stac92hd83xxx_cfg_tbl); | ||
4252 | again: | ||
4253 | if (spec->board_config < 0) { | ||
4254 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | ||
4255 | " STAC92HD83XXX, using BIOS defaults\n"); | ||
4256 | err = stac92xx_save_bios_config_regs(codec); | ||
4257 | if (err < 0) { | ||
4258 | stac92xx_free(codec); | ||
4259 | return err; | ||
4260 | } | ||
4261 | spec->pin_configs = spec->bios_pin_configs; | ||
4262 | } else { | ||
4263 | spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config]; | ||
4264 | stac92xx_set_config_regs(codec); | ||
4265 | } | ||
4266 | |||
4267 | err = stac92xx_parse_auto_config(codec, 0x1d, 0); | ||
4268 | if (!err) { | ||
4269 | if (spec->board_config < 0) { | ||
4270 | printk(KERN_WARNING "hda_codec: No auto-config is " | ||
4271 | "available, default to model=ref\n"); | ||
4272 | spec->board_config = STAC_92HD83XXX_REF; | ||
4273 | goto again; | ||
4274 | } | ||
4275 | err = -EINVAL; | ||
4276 | } | ||
4277 | |||
4278 | if (err < 0) { | ||
4279 | stac92xx_free(codec); | ||
4280 | return err; | ||
4281 | } | ||
4282 | |||
4283 | codec->patch_ops = stac92xx_patch_ops; | ||
4284 | |||
4285 | return 0; | ||
4286 | } | ||
4287 | |||
4288 | #ifdef SND_HDA_NEEDS_RESUME | ||
4289 | static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr) | ||
4290 | { | ||
4291 | struct sigmatel_spec *spec = codec->spec; | ||
4292 | int i; | ||
4293 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
4294 | AC_VERB_SET_POWER_STATE, pwr); | ||
4295 | |||
4296 | msleep(1); | ||
4297 | for (i = 0; i < spec->num_adcs; i++) { | ||
4298 | snd_hda_codec_write_cache(codec, | ||
4299 | spec->adc_nids[i], 0, | ||
4300 | AC_VERB_SET_POWER_STATE, pwr); | ||
4301 | } | ||
4302 | }; | ||
4303 | |||
4304 | static int stac92hd71xx_resume(struct hda_codec *codec) | ||
4305 | { | ||
4306 | stac92hd71xx_set_power_state(codec, AC_PWRST_D0); | ||
4307 | return stac92xx_resume(codec); | ||
4308 | } | ||
4309 | |||
4310 | static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) | ||
4311 | { | ||
4312 | stac92hd71xx_set_power_state(codec, AC_PWRST_D3); | ||
4313 | return 0; | ||
4314 | }; | ||
4315 | |||
4316 | #endif | ||
4317 | |||
4318 | static struct hda_codec_ops stac92hd71bxx_patch_ops = { | ||
4319 | .build_controls = stac92xx_build_controls, | ||
4320 | .build_pcms = stac92xx_build_pcms, | ||
4321 | .init = stac92xx_init, | ||
4322 | .free = stac92xx_free, | ||
4323 | .unsol_event = stac92xx_unsol_event, | ||
4324 | #ifdef SND_HDA_NEEDS_RESUME | ||
4325 | .resume = stac92hd71xx_resume, | ||
4326 | .suspend = stac92hd71xx_suspend, | ||
4327 | #endif | ||
4328 | }; | ||
4329 | |||
3617 | static int patch_stac92hd71bxx(struct hda_codec *codec) | 4330 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
3618 | { | 4331 | { |
3619 | struct sigmatel_spec *spec; | 4332 | struct sigmatel_spec *spec; |
@@ -3624,6 +4337,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
3624 | return -ENOMEM; | 4337 | return -ENOMEM; |
3625 | 4338 | ||
3626 | codec->spec = spec; | 4339 | codec->spec = spec; |
4340 | codec->patch_ops = stac92xx_patch_ops; | ||
3627 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); | 4341 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); |
3628 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); | 4342 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
3629 | spec->pin_nids = stac92hd71bxx_pin_nids; | 4343 | spec->pin_nids = stac92hd71bxx_pin_nids; |
@@ -3653,8 +4367,28 @@ again: | |||
3653 | case 0x111d76b5: | 4367 | case 0x111d76b5: |
3654 | spec->mixer = stac92hd71bxx_mixer; | 4368 | spec->mixer = stac92hd71bxx_mixer; |
3655 | spec->init = stac92hd71bxx_core_init; | 4369 | spec->init = stac92hd71bxx_core_init; |
4370 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | ||
3656 | break; | 4371 | break; |
3657 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4372 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4373 | switch (codec->subsystem_id) { | ||
4374 | case 0x103c361a: | ||
4375 | /* Enable VREF power saving on GPIO1 detect */ | ||
4376 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4377 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | ||
4378 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
4379 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
4380 | (AC_USRSP_EN | STAC_VREF_EVENT | 0x01)); | ||
4381 | spec->gpio_mask |= 0x02; | ||
4382 | break; | ||
4383 | } | ||
4384 | if ((codec->revision_id & 0xf) == 0 || | ||
4385 | (codec->revision_id & 0xf) == 1) { | ||
4386 | #ifdef SND_HDA_NEEDS_RESUME | ||
4387 | codec->patch_ops = stac92hd71bxx_patch_ops; | ||
4388 | #endif | ||
4389 | spec->stream_delay = 40; /* 40 milliseconds */ | ||
4390 | } | ||
4391 | |||
3658 | /* no output amps */ | 4392 | /* no output amps */ |
3659 | spec->num_pwrs = 0; | 4393 | spec->num_pwrs = 0; |
3660 | spec->mixer = stac92hd71bxx_analog_mixer; | 4394 | spec->mixer = stac92hd71bxx_analog_mixer; |
@@ -3664,32 +4398,60 @@ again: | |||
3664 | stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); | 4398 | stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); |
3665 | break; | 4399 | break; |
3666 | case 0x111d7603: /* 6 Port with Analog Mixer */ | 4400 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
4401 | if ((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 | |||
3667 | /* no output amps */ | 4408 | /* no output amps */ |
3668 | spec->num_pwrs = 0; | 4409 | spec->num_pwrs = 0; |
3669 | /* fallthru */ | 4410 | /* fallthru */ |
3670 | default: | 4411 | default: |
3671 | spec->mixer = stac92hd71bxx_analog_mixer; | 4412 | spec->mixer = stac92hd71bxx_analog_mixer; |
3672 | spec->init = stac92hd71bxx_analog_core_init; | 4413 | spec->init = stac92hd71bxx_analog_core_init; |
4414 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | ||
3673 | } | 4415 | } |
3674 | 4416 | ||
3675 | spec->aloopback_mask = 0x20; | 4417 | spec->aloopback_mask = 0x20; |
3676 | spec->aloopback_shift = 0; | 4418 | spec->aloopback_shift = 0; |
3677 | 4419 | ||
3678 | /* GPIO0 High = EAPD */ | 4420 | if (spec->board_config > STAC_92HD71BXX_REF) { |
3679 | spec->gpio_mask = 0x01; | 4421 | /* GPIO0 = EAPD */ |
3680 | spec->gpio_dir = 0x01; | 4422 | spec->gpio_mask = 0x01; |
3681 | spec->gpio_data = 0x01; | 4423 | spec->gpio_dir = 0x01; |
4424 | spec->gpio_data = 0x01; | ||
4425 | } | ||
3682 | 4426 | ||
4427 | spec->powerdown_adcs = 1; | ||
4428 | spec->digbeep_nid = 0x26; | ||
3683 | spec->mux_nids = stac92hd71bxx_mux_nids; | 4429 | spec->mux_nids = stac92hd71bxx_mux_nids; |
3684 | spec->adc_nids = stac92hd71bxx_adc_nids; | 4430 | spec->adc_nids = stac92hd71bxx_adc_nids; |
3685 | spec->dmic_nids = stac92hd71bxx_dmic_nids; | 4431 | spec->dmic_nids = stac92hd71bxx_dmic_nids; |
3686 | spec->dmux_nids = stac92hd71bxx_dmux_nids; | 4432 | spec->dmux_nids = stac92hd71bxx_dmux_nids; |
4433 | spec->smux_nids = stac92hd71bxx_smux_nids; | ||
3687 | spec->pwr_nids = stac92hd71bxx_pwr_nids; | 4434 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
3688 | 4435 | ||
3689 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); | 4436 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
3690 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); | 4437 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
3691 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | 4438 | |
3692 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | 4439 | switch (spec->board_config) { |
4440 | case STAC_HP_M4: | ||
4441 | spec->num_dmics = 0; | ||
4442 | spec->num_smuxes = 0; | ||
4443 | spec->num_dmuxes = 0; | ||
4444 | |||
4445 | /* enable internal microphone */ | ||
4446 | stac92xx_set_config_reg(codec, 0x0e, 0x01813040); | ||
4447 | stac92xx_auto_set_pinctl(codec, 0x0e, | ||
4448 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); | ||
4449 | break; | ||
4450 | default: | ||
4451 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | ||
4452 | spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); | ||
4453 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
4454 | }; | ||
3693 | 4455 | ||
3694 | spec->multiout.num_dacs = 1; | 4456 | spec->multiout.num_dacs = 1; |
3695 | spec->multiout.hp_nid = 0x11; | 4457 | spec->multiout.hp_nid = 0x11; |
@@ -3711,8 +4473,6 @@ again: | |||
3711 | return err; | 4473 | return err; |
3712 | } | 4474 | } |
3713 | 4475 | ||
3714 | codec->patch_ops = stac92xx_patch_ops; | ||
3715 | |||
3716 | return 0; | 4476 | return 0; |
3717 | }; | 4477 | }; |
3718 | 4478 | ||
@@ -3854,10 +4614,14 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3854 | stac92xx_set_config_regs(codec); | 4614 | stac92xx_set_config_regs(codec); |
3855 | } | 4615 | } |
3856 | 4616 | ||
4617 | spec->digbeep_nid = 0x23; | ||
3857 | spec->adc_nids = stac927x_adc_nids; | 4618 | spec->adc_nids = stac927x_adc_nids; |
3858 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); | 4619 | spec->num_adcs = ARRAY_SIZE(stac927x_adc_nids); |
3859 | spec->mux_nids = stac927x_mux_nids; | 4620 | spec->mux_nids = stac927x_mux_nids; |
3860 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); | 4621 | spec->num_muxes = ARRAY_SIZE(stac927x_mux_nids); |
4622 | spec->smux_nids = stac927x_smux_nids; | ||
4623 | spec->num_smuxes = ARRAY_SIZE(stac927x_smux_nids); | ||
4624 | spec->spdif_labels = stac927x_spdif_labels; | ||
3861 | spec->dac_list = stac927x_dac_nids; | 4625 | spec->dac_list = stac927x_dac_nids; |
3862 | spec->multiout.dac_nids = spec->dac_nids; | 4626 | spec->multiout.dac_nids = spec->dac_nids; |
3863 | 4627 | ||
@@ -3900,9 +4664,11 @@ static int patch_stac927x(struct hda_codec *codec) | |||
3900 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); | 4664 | spec->num_dmuxes = ARRAY_SIZE(stac927x_dmux_nids); |
3901 | break; | 4665 | break; |
3902 | default: | 4666 | default: |
3903 | /* GPIO0 High = Enable EAPD */ | 4667 | if (spec->board_config > STAC_D965_REF) { |
3904 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 4668 | /* GPIO0 High = Enable EAPD */ |
3905 | spec->gpio_data = 0x01; | 4669 | spec->eapd_mask = spec->gpio_mask = 0x01; |
4670 | spec->gpio_dir = spec->gpio_data = 0x01; | ||
4671 | } | ||
3906 | spec->num_dmics = 0; | 4672 | spec->num_dmics = 0; |
3907 | 4673 | ||
3908 | spec->init = stac927x_core_init; | 4674 | spec->init = stac927x_core_init; |
@@ -3974,10 +4740,13 @@ static int patch_stac9205(struct hda_codec *codec) | |||
3974 | stac92xx_set_config_regs(codec); | 4740 | stac92xx_set_config_regs(codec); |
3975 | } | 4741 | } |
3976 | 4742 | ||
4743 | spec->digbeep_nid = 0x23; | ||
3977 | spec->adc_nids = stac9205_adc_nids; | 4744 | spec->adc_nids = stac9205_adc_nids; |
3978 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); | 4745 | spec->num_adcs = ARRAY_SIZE(stac9205_adc_nids); |
3979 | spec->mux_nids = stac9205_mux_nids; | 4746 | spec->mux_nids = stac9205_mux_nids; |
3980 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); | 4747 | spec->num_muxes = ARRAY_SIZE(stac9205_mux_nids); |
4748 | spec->smux_nids = stac9205_smux_nids; | ||
4749 | spec->num_smuxes = ARRAY_SIZE(stac9205_smux_nids); | ||
3981 | spec->dmic_nids = stac9205_dmic_nids; | 4750 | spec->dmic_nids = stac9205_dmic_nids; |
3982 | spec->num_dmics = STAC9205_NUM_DMICS; | 4751 | spec->num_dmics = STAC9205_NUM_DMICS; |
3983 | spec->dmux_nids = stac9205_dmux_nids; | 4752 | spec->dmux_nids = stac9205_dmux_nids; |
@@ -4013,6 +4782,9 @@ static int patch_stac9205(struct hda_codec *codec) | |||
4013 | */ | 4782 | */ |
4014 | spec->gpio_data = 0x01; | 4783 | spec->gpio_data = 0x01; |
4015 | break; | 4784 | break; |
4785 | case STAC_9205_REF: | ||
4786 | /* SPDIF-In enabled */ | ||
4787 | break; | ||
4016 | default: | 4788 | default: |
4017 | /* GPIO0 High = EAPD */ | 4789 | /* GPIO0 High = EAPD */ |
4018 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; | 4790 | spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1; |
@@ -4332,6 +5104,8 @@ struct hda_codec_preset snd_hda_preset_sigmatel[] = { | |||
4332 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, | 5104 | { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, |
4333 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, | 5105 | { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, |
4334 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, | 5106 | { .id = 0x111d7603, .name = "92HD75B3X5", .patch = patch_stac92hd71bxx}, |
5107 | { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, | ||
5108 | { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, | ||
4335 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, | 5109 | { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, |
4336 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, | 5110 | { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, |
4337 | { .id = 0x111d7675, .name = "92HD73C1X5", .patch = patch_stac92hd73xx }, | 5111 | { .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 | }; |