diff options
author | Jaroslav Kysela <perex@perex.cz> | 2010-01-08 03:11:18 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2010-01-08 03:11:18 -0500 |
commit | a4ad68d57e4dc4138304df23d1817eb094149389 (patch) | |
tree | ca7d8c4ce5377c4251560de06e15dd7be7063351 /sound/pci | |
parent | cd9d95a55550555da8e587ead9cbba5f98a371a3 (diff) | |
parent | c97259df3f2e163c72f4d0685c61fb2e026dc989 (diff) |
Merge branch 'topic/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6 into devel
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 2 | ||||
-rw-r--r-- | sound/pci/cs5535audio/Makefile | 2 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio.c | 1 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio.h | 4 | ||||
-rw-r--r-- | sound/pci/cs5535audio/cs5535audio_olpc.c | 26 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.c | 58 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 1 | ||||
-rw-r--r-- | sound/pci/hda/hda_hwdep.c | 14 | ||||
-rw-r--r-- | sound/pci/hda/hda_intel.c | 49 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_analog.c | 79 | ||||
-rw-r--r-- | sound/pci/hda/patch_cirrus.c | 34 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 43 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 419 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 135 | ||||
-rw-r--r-- | sound/pci/hda/patch_via.c | 3 |
17 files changed, 711 insertions, 164 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 20cb60afb200..c11920623009 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -2122,7 +2122,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template, | |||
2122 | } | 2122 | } |
2123 | /* nothing should be in powerdown mode */ | 2123 | /* nothing should be in powerdown mode */ |
2124 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); | 2124 | snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); |
2125 | end_time = jiffies + msecs_to_jiffies(120); | 2125 | end_time = jiffies + msecs_to_jiffies(5000); |
2126 | do { | 2126 | do { |
2127 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) | 2127 | if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) |
2128 | goto __ready_ok; | 2128 | goto __ready_ok; |
diff --git a/sound/pci/cs5535audio/Makefile b/sound/pci/cs5535audio/Makefile index fda7a94c992f..ccc642269b9e 100644 --- a/sound/pci/cs5535audio/Makefile +++ b/sound/pci/cs5535audio/Makefile | |||
@@ -4,9 +4,7 @@ | |||
4 | 4 | ||
5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o | 5 | snd-cs5535audio-y := cs5535audio.o cs5535audio_pcm.o |
6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o | 6 | snd-cs5535audio-$(CONFIG_PM) += cs5535audio_pm.o |
7 | ifdef CONFIG_MGEODE_LX | ||
8 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o | 7 | snd-cs5535audio-$(CONFIG_OLPC) += cs5535audio_olpc.o |
9 | endif | ||
10 | 8 | ||
11 | # Toplevel Module Dependency | 9 | # Toplevel Module Dependency |
12 | obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o | 10 | obj-$(CONFIG_SND_CS5535AUDIO) += snd-cs5535audio.o |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 05f56e04849b..91e7faf69bbb 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -389,6 +389,7 @@ probefail_out: | |||
389 | 389 | ||
390 | static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) | 390 | static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) |
391 | { | 391 | { |
392 | olpc_quirks_cleanup(); | ||
392 | snd_card_free(pci_get_drvdata(pci)); | 393 | snd_card_free(pci_get_drvdata(pci)); |
393 | pci_set_drvdata(pci, NULL); | 394 | pci_set_drvdata(pci, NULL); |
394 | } | 395 | } |
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h index 7a298ac662e3..51966d782a3c 100644 --- a/sound/pci/cs5535audio/cs5535audio.h +++ b/sound/pci/cs5535audio/cs5535audio.h | |||
@@ -99,10 +99,11 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state); | |||
99 | int snd_cs5535audio_resume(struct pci_dev *pci); | 99 | int snd_cs5535audio_resume(struct pci_dev *pci); |
100 | #endif | 100 | #endif |
101 | 101 | ||
102 | #if defined(CONFIG_OLPC) && defined(CONFIG_MGEODE_LX) | 102 | #ifdef CONFIG_OLPC |
103 | void __devinit olpc_prequirks(struct snd_card *card, | 103 | void __devinit olpc_prequirks(struct snd_card *card, |
104 | struct snd_ac97_template *ac97); | 104 | struct snd_ac97_template *ac97); |
105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); | 105 | int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); |
106 | void __devexit olpc_quirks_cleanup(void); | ||
106 | void olpc_analog_input(struct snd_ac97 *ac97, int on); | 107 | void olpc_analog_input(struct snd_ac97 *ac97, int on); |
107 | void olpc_mic_bias(struct snd_ac97 *ac97, int on); | 108 | void olpc_mic_bias(struct snd_ac97 *ac97, int on); |
108 | 109 | ||
@@ -128,6 +129,7 @@ static inline int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
128 | { | 129 | { |
129 | return 0; | 130 | return 0; |
130 | } | 131 | } |
132 | static inline void olpc_quirks_cleanup(void) { } | ||
131 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } | 133 | static inline void olpc_analog_input(struct snd_ac97 *ac97, int on) { } |
132 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } | 134 | static inline void olpc_mic_bias(struct snd_ac97 *ac97, int on) { } |
133 | static inline void olpc_capture_open(struct snd_ac97 *ac97) { } | 135 | static inline void olpc_capture_open(struct snd_ac97 *ac97) { } |
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c index 5c6814335cd7..50da49be9ae5 100644 --- a/sound/pci/cs5535audio/cs5535audio_olpc.c +++ b/sound/pci/cs5535audio/cs5535audio_olpc.c | |||
@@ -13,10 +13,13 @@ | |||
13 | #include <sound/info.h> | 13 | #include <sound/info.h> |
14 | #include <sound/control.h> | 14 | #include <sound/control.h> |
15 | #include <sound/ac97_codec.h> | 15 | #include <sound/ac97_codec.h> |
16 | #include <linux/gpio.h> | ||
16 | 17 | ||
17 | #include <asm/olpc.h> | 18 | #include <asm/olpc.h> |
18 | #include "cs5535audio.h" | 19 | #include "cs5535audio.h" |
19 | 20 | ||
21 | #define DRV_NAME "cs5535audio-olpc" | ||
22 | |||
20 | /* | 23 | /* |
21 | * OLPC has an additional feature on top of the regular AD1888 codec features. | 24 | * OLPC has an additional feature on top of the regular AD1888 codec features. |
22 | * It has an Analog Input mode that is switched into (after disabling the | 25 | * It has an Analog Input mode that is switched into (after disabling the |
@@ -38,10 +41,7 @@ void olpc_analog_input(struct snd_ac97 *ac97, int on) | |||
38 | } | 41 | } |
39 | 42 | ||
40 | /* set Analog Input through GPIO */ | 43 | /* set Analog Input through GPIO */ |
41 | if (on) | 44 | gpio_set_value(OLPC_GPIO_MIC_AC, on); |
42 | geode_gpio_set(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); | ||
43 | else | ||
44 | geode_gpio_clear(OLPC_GPIO_MIC_AC, GPIO_OUTPUT_VAL); | ||
45 | } | 45 | } |
46 | 46 | ||
47 | /* | 47 | /* |
@@ -73,8 +73,7 @@ static int olpc_dc_info(struct snd_kcontrol *kctl, | |||
73 | 73 | ||
74 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) | 74 | static int olpc_dc_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v) |
75 | { | 75 | { |
76 | v->value.integer.value[0] = geode_gpio_isset(OLPC_GPIO_MIC_AC, | 76 | v->value.integer.value[0] = gpio_get_value(OLPC_GPIO_MIC_AC); |
77 | GPIO_OUTPUT_VAL); | ||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
80 | 79 | ||
@@ -153,6 +152,12 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
153 | if (!machine_is_olpc()) | 152 | if (!machine_is_olpc()) |
154 | return 0; | 153 | return 0; |
155 | 154 | ||
155 | if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) { | ||
156 | printk(KERN_ERR DRV_NAME ": unable to allocate MIC GPIO\n"); | ||
157 | return -EIO; | ||
158 | } | ||
159 | gpio_direction_output(OLPC_GPIO_MIC_AC, 0); | ||
160 | |||
156 | /* drop the original AD1888 HPF control */ | 161 | /* drop the original AD1888 HPF control */ |
157 | memset(&elem, 0, sizeof(elem)); | 162 | memset(&elem, 0, sizeof(elem)); |
158 | elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 163 | elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
@@ -169,11 +174,18 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) | |||
169 | for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) { | 174 | for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) { |
170 | err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i], | 175 | err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i], |
171 | ac97->private_data)); | 176 | ac97->private_data)); |
172 | if (err < 0) | 177 | if (err < 0) { |
178 | gpio_free(OLPC_GPIO_MIC_AC); | ||
173 | return err; | 179 | return err; |
180 | } | ||
174 | } | 181 | } |
175 | 182 | ||
176 | /* turn off the mic by default */ | 183 | /* turn off the mic by default */ |
177 | olpc_mic_bias(ac97, 0); | 184 | olpc_mic_bias(ac97, 0); |
178 | return 0; | 185 | return 0; |
179 | } | 186 | } |
187 | |||
188 | void __devexit olpc_quirks_cleanup(void) | ||
189 | { | ||
190 | gpio_free(OLPC_GPIO_MIC_AC); | ||
191 | } | ||
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index c848ec0f085e..d02ea8926e7e 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -824,6 +824,9 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, | |||
824 | struct hda_pincfg *pin; | 824 | struct hda_pincfg *pin; |
825 | unsigned int oldcfg; | 825 | unsigned int oldcfg; |
826 | 826 | ||
827 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) | ||
828 | return -EINVAL; | ||
829 | |||
827 | oldcfg = snd_hda_codec_get_pincfg(codec, nid); | 830 | oldcfg = snd_hda_codec_get_pincfg(codec, nid); |
828 | pin = look_up_pincfg(codec, list, nid); | 831 | pin = look_up_pincfg(codec, list, nid); |
829 | if (!pin) { | 832 | if (!pin) { |
@@ -899,6 +902,25 @@ static void restore_pincfgs(struct hda_codec *codec) | |||
899 | } | 902 | } |
900 | } | 903 | } |
901 | 904 | ||
905 | /** | ||
906 | * snd_hda_shutup_pins - Shut up all pins | ||
907 | * @codec: the HDA codec | ||
908 | * | ||
909 | * Clear all pin controls to shup up before suspend for avoiding click noise. | ||
910 | * The controls aren't cached so that they can be resumed properly. | ||
911 | */ | ||
912 | void snd_hda_shutup_pins(struct hda_codec *codec) | ||
913 | { | ||
914 | int i; | ||
915 | for (i = 0; i < codec->init_pins.used; i++) { | ||
916 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | ||
917 | /* use read here for syncing after issuing each verb */ | ||
918 | snd_hda_codec_read(codec, pin->nid, 0, | ||
919 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
920 | } | ||
921 | } | ||
922 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); | ||
923 | |||
902 | static void init_hda_cache(struct hda_cache_rec *cache, | 924 | static void init_hda_cache(struct hda_cache_rec *cache, |
903 | unsigned int record_size); | 925 | unsigned int record_size); |
904 | static void free_hda_cache(struct hda_cache_rec *cache); | 926 | static void free_hda_cache(struct hda_cache_rec *cache); |
@@ -1088,11 +1110,6 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1088 | if (err < 0) | 1110 | if (err < 0) |
1089 | return err; | 1111 | return err; |
1090 | } | 1112 | } |
1091 | /* audio codec should override the mixer name */ | ||
1092 | if (codec->afg || !*codec->bus->card->mixername) | ||
1093 | snprintf(codec->bus->card->mixername, | ||
1094 | sizeof(codec->bus->card->mixername), | ||
1095 | "%s %s", codec->vendor_name, codec->chip_name); | ||
1096 | 1113 | ||
1097 | if (is_generic_config(codec)) { | 1114 | if (is_generic_config(codec)) { |
1098 | err = snd_hda_parse_generic_codec(codec); | 1115 | err = snd_hda_parse_generic_codec(codec); |
@@ -1111,6 +1128,11 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1111 | patched: | 1128 | patched: |
1112 | if (!err && codec->patch_ops.unsol_event) | 1129 | if (!err && codec->patch_ops.unsol_event) |
1113 | err = init_unsol_queue(codec->bus); | 1130 | err = init_unsol_queue(codec->bus); |
1131 | /* audio codec should override the mixer name */ | ||
1132 | if (!err && (codec->afg || !*codec->bus->card->mixername)) | ||
1133 | snprintf(codec->bus->card->mixername, | ||
1134 | sizeof(codec->bus->card->mixername), | ||
1135 | "%s %s", codec->vendor_name, codec->chip_name); | ||
1114 | return err; | 1136 | return err; |
1115 | } | 1137 | } |
1116 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); | 1138 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); |
@@ -3537,32 +3559,6 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew) | |||
3537 | } | 3559 | } |
3538 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); | 3560 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); |
3539 | 3561 | ||
3540 | /** | ||
3541 | * snd_hda_add_nids - assign nids to controls from the array | ||
3542 | * @codec: the HDA codec | ||
3543 | * @kctl: struct snd_kcontrol | ||
3544 | * @index: index to kctl | ||
3545 | * @nids: the array of hda_nid_t | ||
3546 | * @size: count of hda_nid_t items | ||
3547 | * | ||
3548 | * This helper function assigns NIDs in the given array to a control element. | ||
3549 | * | ||
3550 | * Returns 0 if successful, or a negative error code. | ||
3551 | */ | ||
3552 | int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl, | ||
3553 | unsigned int index, hda_nid_t *nids, unsigned int size) | ||
3554 | { | ||
3555 | int err; | ||
3556 | |||
3557 | for ( ; size > 0; size--, nids++) { | ||
3558 | err = snd_hda_add_nid(codec, kctl, index, *nids); | ||
3559 | if (err < 0) | ||
3560 | return err; | ||
3561 | } | ||
3562 | return 0; | ||
3563 | } | ||
3564 | EXPORT_SYMBOL_HDA(snd_hda_add_nids); | ||
3565 | |||
3566 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3562 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3567 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | 3563 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, |
3568 | unsigned int power_state); | 3564 | unsigned int power_state); |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 0d08ad5bd898..11c4aa8ee996 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -898,6 +898,7 @@ int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, | |||
898 | unsigned int cfg); | 898 | unsigned int cfg); |
899 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, | 899 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, |
900 | hda_nid_t nid, unsigned int cfg); /* for hwdep */ | 900 | hda_nid_t nid, unsigned int cfg); /* for hwdep */ |
901 | void snd_hda_shutup_pins(struct hda_codec *codec); | ||
901 | 902 | ||
902 | /* | 903 | /* |
903 | * Mixer | 904 | * Mixer |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index d24328661c6a..b36919c0d363 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/compat.h> | 24 | #include <linux/compat.h> |
25 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
26 | #include <linux/ctype.h> | 26 | #include <linux/ctype.h> |
27 | #include <linux/string.h> | ||
27 | #include <linux/firmware.h> | 28 | #include <linux/firmware.h> |
28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
29 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
@@ -292,8 +293,11 @@ static ssize_t type##_store(struct device *dev, \ | |||
292 | { \ | 293 | { \ |
293 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); \ | 294 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); \ |
294 | struct hda_codec *codec = hwdep->private_data; \ | 295 | struct hda_codec *codec = hwdep->private_data; \ |
295 | char *after; \ | 296 | unsigned long val; \ |
296 | codec->type = simple_strtoul(buf, &after, 0); \ | 297 | int err = strict_strtoul(buf, 0, &val); \ |
298 | if (err < 0) \ | ||
299 | return err; \ | ||
300 | codec->type = val; \ | ||
297 | return count; \ | 301 | return count; \ |
298 | } | 302 | } |
299 | 303 | ||
@@ -428,8 +432,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf) | |||
428 | char *key, *val; | 432 | char *key, *val; |
429 | struct hda_hint *hint; | 433 | struct hda_hint *hint; |
430 | 434 | ||
431 | while (isspace(*buf)) | 435 | buf = skip_spaces(buf); |
432 | buf++; | ||
433 | if (!*buf || *buf == '#' || *buf == '\n') | 436 | if (!*buf || *buf == '#' || *buf == '\n') |
434 | return 0; | 437 | return 0; |
435 | if (*buf == '=') | 438 | if (*buf == '=') |
@@ -444,8 +447,7 @@ static int parse_hints(struct hda_codec *codec, const char *buf) | |||
444 | return -EINVAL; | 447 | return -EINVAL; |
445 | } | 448 | } |
446 | *val++ = 0; | 449 | *val++ = 0; |
447 | while (isspace(*val)) | 450 | val = skip_spaces(val); |
448 | val++; | ||
449 | remove_trail_spaces(key); | 451 | remove_trail_spaces(key); |
450 | remove_trail_spaces(val); | 452 | remove_trail_spaces(val); |
451 | hint = get_hint(codec, key); | 453 | hint = get_hint(codec, key); |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index e54420e691ae..1f516e668d88 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -356,6 +356,7 @@ struct azx_dev { | |||
356 | */ | 356 | */ |
357 | unsigned char stream_tag; /* assigned stream */ | 357 | unsigned char stream_tag; /* assigned stream */ |
358 | unsigned char index; /* stream index */ | 358 | unsigned char index; /* stream index */ |
359 | int device; /* last device number assigned to */ | ||
359 | 360 | ||
360 | unsigned int opened :1; | 361 | unsigned int opened :1; |
361 | unsigned int running :1; | 362 | unsigned int running :1; |
@@ -1441,10 +1442,13 @@ static int __devinit azx_codec_configure(struct azx *chip) | |||
1441 | */ | 1442 | */ |
1442 | 1443 | ||
1443 | /* assign a stream for the PCM */ | 1444 | /* assign a stream for the PCM */ |
1444 | static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | 1445 | static inline struct azx_dev * |
1446 | azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) | ||
1445 | { | 1447 | { |
1446 | int dev, i, nums; | 1448 | int dev, i, nums; |
1447 | if (stream == SNDRV_PCM_STREAM_PLAYBACK) { | 1449 | struct azx_dev *res = NULL; |
1450 | |||
1451 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | ||
1448 | dev = chip->playback_index_offset; | 1452 | dev = chip->playback_index_offset; |
1449 | nums = chip->playback_streams; | 1453 | nums = chip->playback_streams; |
1450 | } else { | 1454 | } else { |
@@ -1453,10 +1457,15 @@ static inline struct azx_dev *azx_assign_device(struct azx *chip, int stream) | |||
1453 | } | 1457 | } |
1454 | for (i = 0; i < nums; i++, dev++) | 1458 | for (i = 0; i < nums; i++, dev++) |
1455 | if (!chip->azx_dev[dev].opened) { | 1459 | if (!chip->azx_dev[dev].opened) { |
1456 | chip->azx_dev[dev].opened = 1; | 1460 | res = &chip->azx_dev[dev]; |
1457 | return &chip->azx_dev[dev]; | 1461 | if (res->device == substream->pcm->device) |
1462 | break; | ||
1458 | } | 1463 | } |
1459 | return NULL; | 1464 | if (res) { |
1465 | res->opened = 1; | ||
1466 | res->device = substream->pcm->device; | ||
1467 | } | ||
1468 | return res; | ||
1460 | } | 1469 | } |
1461 | 1470 | ||
1462 | /* release the assigned stream */ | 1471 | /* release the assigned stream */ |
@@ -1505,7 +1514,7 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1505 | int err; | 1514 | int err; |
1506 | 1515 | ||
1507 | mutex_lock(&chip->open_mutex); | 1516 | mutex_lock(&chip->open_mutex); |
1508 | azx_dev = azx_assign_device(chip, substream->stream); | 1517 | azx_dev = azx_assign_device(chip, substream); |
1509 | if (azx_dev == NULL) { | 1518 | if (azx_dev == NULL) { |
1510 | mutex_unlock(&chip->open_mutex); | 1519 | mutex_unlock(&chip->open_mutex); |
1511 | return -EBUSY; | 1520 | return -EBUSY; |
@@ -2322,6 +2331,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev) | |||
2322 | * white/black-list for enable_msi | 2331 | * white/black-list for enable_msi |
2323 | */ | 2332 | */ |
2324 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { | 2333 | static struct snd_pci_quirk msi_black_list[] __devinitdata = { |
2334 | SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ | ||
2325 | {} | 2335 | {} |
2326 | }; | 2336 | }; |
2327 | 2337 | ||
@@ -2694,29 +2704,10 @@ static struct pci_device_id azx_ids[] = { | |||
2694 | /* ULI M5461 */ | 2704 | /* ULI M5461 */ |
2695 | { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI }, | 2705 | { PCI_DEVICE(0x10b9, 0x5461), .driver_data = AZX_DRIVER_ULI }, |
2696 | /* NVIDIA MCP */ | 2706 | /* NVIDIA MCP */ |
2697 | { PCI_DEVICE(0x10de, 0x026c), .driver_data = AZX_DRIVER_NVIDIA }, | 2707 | { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID), |
2698 | { PCI_DEVICE(0x10de, 0x0371), .driver_data = AZX_DRIVER_NVIDIA }, | 2708 | .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, |
2699 | { PCI_DEVICE(0x10de, 0x03e4), .driver_data = AZX_DRIVER_NVIDIA }, | 2709 | .class_mask = 0xffffff, |
2700 | { PCI_DEVICE(0x10de, 0x03f0), .driver_data = AZX_DRIVER_NVIDIA }, | 2710 | .driver_data = AZX_DRIVER_NVIDIA }, |
2701 | { PCI_DEVICE(0x10de, 0x044a), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2702 | { PCI_DEVICE(0x10de, 0x044b), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2703 | { PCI_DEVICE(0x10de, 0x055c), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2704 | { PCI_DEVICE(0x10de, 0x055d), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2705 | { PCI_DEVICE(0x10de, 0x0590), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2706 | { PCI_DEVICE(0x10de, 0x0774), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2707 | { PCI_DEVICE(0x10de, 0x0775), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2708 | { PCI_DEVICE(0x10de, 0x0776), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2709 | { PCI_DEVICE(0x10de, 0x0777), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2710 | { PCI_DEVICE(0x10de, 0x07fc), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2711 | { PCI_DEVICE(0x10de, 0x07fd), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2712 | { PCI_DEVICE(0x10de, 0x0ac0), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2713 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2714 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2715 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2716 | { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2717 | { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2718 | { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2719 | { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA }, | ||
2720 | /* Teradici */ | 2711 | /* Teradici */ |
2721 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, | 2712 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, |
2722 | /* Creative X-Fi (CA0110-IBG) */ | 2713 | /* Creative X-Fi (CA0110-IBG) */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index d505d052972e..7cee364976ff 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -343,8 +343,6 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
343 | const struct snd_pci_quirk *tbl); | 343 | const struct snd_pci_quirk *tbl); |
344 | int snd_hda_add_new_ctls(struct hda_codec *codec, | 344 | int snd_hda_add_new_ctls(struct hda_codec *codec, |
345 | struct snd_kcontrol_new *knew); | 345 | struct snd_kcontrol_new *knew); |
346 | int snd_hda_add_nids(struct hda_codec *codec, struct snd_kcontrol *kctl, | ||
347 | unsigned int index, hda_nid_t *nids, unsigned int size); | ||
348 | 346 | ||
349 | /* | 347 | /* |
350 | * unsolicited event handler | 348 | * unsolicited event handler |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e75b5e5a1d55..cecd3c108990 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -244,8 +244,7 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
244 | if (!kctl) | 244 | if (!kctl) |
245 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 245 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
246 | for (i = 0; kctl && i < kctl->count; i++) { | 246 | for (i = 0; kctl && i < kctl->count; i++) { |
247 | err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids, | 247 | err = snd_hda_add_nid(codec, kctl, i, spec->capsrc_nids[i]); |
248 | spec->input_mux->num_items); | ||
249 | if (err < 0) | 248 | if (err < 0) |
250 | return err; | 249 | return err; |
251 | } | 250 | } |
@@ -442,6 +441,11 @@ static int ad198x_build_pcms(struct hda_codec *codec) | |||
442 | return 0; | 441 | return 0; |
443 | } | 442 | } |
444 | 443 | ||
444 | static inline void ad198x_shutup(struct hda_codec *codec) | ||
445 | { | ||
446 | snd_hda_shutup_pins(codec); | ||
447 | } | ||
448 | |||
445 | static void ad198x_free_kctls(struct hda_codec *codec) | 449 | static void ad198x_free_kctls(struct hda_codec *codec) |
446 | { | 450 | { |
447 | struct ad198x_spec *spec = codec->spec; | 451 | struct ad198x_spec *spec = codec->spec; |
@@ -455,6 +459,46 @@ static void ad198x_free_kctls(struct hda_codec *codec) | |||
455 | snd_array_free(&spec->kctls); | 459 | snd_array_free(&spec->kctls); |
456 | } | 460 | } |
457 | 461 | ||
462 | static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front, | ||
463 | hda_nid_t hp) | ||
464 | { | ||
465 | struct ad198x_spec *spec = codec->spec; | ||
466 | snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
467 | !spec->inv_eapd ? 0x00 : 0x02); | ||
468 | snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE, | ||
469 | !spec->inv_eapd ? 0x00 : 0x02); | ||
470 | } | ||
471 | |||
472 | static void ad198x_power_eapd(struct hda_codec *codec) | ||
473 | { | ||
474 | /* We currently only handle front, HP */ | ||
475 | switch (codec->vendor_id) { | ||
476 | case 0x11d41882: | ||
477 | case 0x11d4882a: | ||
478 | case 0x11d41884: | ||
479 | case 0x11d41984: | ||
480 | case 0x11d41883: | ||
481 | case 0x11d4184a: | ||
482 | case 0x11d4194a: | ||
483 | case 0x11d4194b: | ||
484 | ad198x_power_eapd_write(codec, 0x12, 0x11); | ||
485 | break; | ||
486 | case 0x11d41981: | ||
487 | case 0x11d41983: | ||
488 | ad198x_power_eapd_write(codec, 0x05, 0x06); | ||
489 | break; | ||
490 | case 0x11d41986: | ||
491 | ad198x_power_eapd_write(codec, 0x1b, 0x1a); | ||
492 | break; | ||
493 | case 0x11d41988: | ||
494 | case 0x11d4198b: | ||
495 | case 0x11d4989a: | ||
496 | case 0x11d4989b: | ||
497 | ad198x_power_eapd_write(codec, 0x29, 0x22); | ||
498 | break; | ||
499 | } | ||
500 | } | ||
501 | |||
458 | static void ad198x_free(struct hda_codec *codec) | 502 | static void ad198x_free(struct hda_codec *codec) |
459 | { | 503 | { |
460 | struct ad198x_spec *spec = codec->spec; | 504 | struct ad198x_spec *spec = codec->spec; |
@@ -462,11 +506,29 @@ static void ad198x_free(struct hda_codec *codec) | |||
462 | if (!spec) | 506 | if (!spec) |
463 | return; | 507 | return; |
464 | 508 | ||
509 | ad198x_shutup(codec); | ||
465 | ad198x_free_kctls(codec); | 510 | ad198x_free_kctls(codec); |
466 | kfree(spec); | 511 | kfree(spec); |
467 | snd_hda_detach_beep_device(codec); | 512 | snd_hda_detach_beep_device(codec); |
468 | } | 513 | } |
469 | 514 | ||
515 | #ifdef SND_HDA_NEEDS_RESUME | ||
516 | static int ad198x_suspend(struct hda_codec *codec, pm_message_t state) | ||
517 | { | ||
518 | ad198x_shutup(codec); | ||
519 | ad198x_power_eapd(codec); | ||
520 | return 0; | ||
521 | } | ||
522 | |||
523 | static int ad198x_resume(struct hda_codec *codec) | ||
524 | { | ||
525 | ad198x_init(codec); | ||
526 | snd_hda_codec_resume_amp(codec); | ||
527 | snd_hda_codec_resume_cache(codec); | ||
528 | return 0; | ||
529 | } | ||
530 | #endif | ||
531 | |||
470 | static struct hda_codec_ops ad198x_patch_ops = { | 532 | static struct hda_codec_ops ad198x_patch_ops = { |
471 | .build_controls = ad198x_build_controls, | 533 | .build_controls = ad198x_build_controls, |
472 | .build_pcms = ad198x_build_pcms, | 534 | .build_pcms = ad198x_build_pcms, |
@@ -475,6 +537,11 @@ static struct hda_codec_ops ad198x_patch_ops = { | |||
475 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 537 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
476 | .check_power_status = ad198x_check_power_status, | 538 | .check_power_status = ad198x_check_power_status, |
477 | #endif | 539 | #endif |
540 | #ifdef SND_HDA_NEEDS_RESUME | ||
541 | .suspend = ad198x_suspend, | ||
542 | .resume = ad198x_resume, | ||
543 | #endif | ||
544 | .reboot_notify = ad198x_shutup, | ||
478 | }; | 545 | }; |
479 | 546 | ||
480 | 547 | ||
@@ -1813,6 +1880,14 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1813 | 1880 | ||
1814 | codec->patch_ops.init = ad1981_hp_init; | 1881 | codec->patch_ops.init = ad1981_hp_init; |
1815 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; | 1882 | codec->patch_ops.unsol_event = ad1981_hp_unsol_event; |
1883 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
1884 | * possible damage by overloading | ||
1885 | */ | ||
1886 | snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, | ||
1887 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
1888 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
1889 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
1890 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
1816 | break; | 1891 | break; |
1817 | case AD1981_THINKPAD: | 1892 | case AD1981_THINKPAD: |
1818 | spec->mixers[0] = ad1981_thinkpad_mixers; | 1893 | spec->mixers[0] = ad1981_thinkpad_mixers; |
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c index eeb91f6a06c2..7de782a5b8f4 100644 --- a/sound/pci/hda/patch_cirrus.c +++ b/sound/pci/hda/patch_cirrus.c | |||
@@ -66,6 +66,7 @@ struct cs_spec { | |||
66 | /* available models */ | 66 | /* available models */ |
67 | enum { | 67 | enum { |
68 | CS420X_MBP55, | 68 | CS420X_MBP55, |
69 | CS420X_IMAC27, | ||
69 | CS420X_AUTO, | 70 | CS420X_AUTO, |
70 | CS420X_MODELS | 71 | CS420X_MODELS |
71 | }; | 72 | }; |
@@ -752,6 +753,7 @@ static int build_input(struct hda_codec *codec) | |||
752 | spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); | 753 | spec->capture_bind[1] = make_bind_capture(codec, &snd_hda_bind_vol); |
753 | for (i = 0; i < 2; i++) { | 754 | for (i = 0; i < 2; i++) { |
754 | struct snd_kcontrol *kctl; | 755 | struct snd_kcontrol *kctl; |
756 | int n; | ||
755 | if (!spec->capture_bind[i]) | 757 | if (!spec->capture_bind[i]) |
756 | return -ENOMEM; | 758 | return -ENOMEM; |
757 | kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); | 759 | kctl = snd_ctl_new1(&cs_capture_ctls[i], codec); |
@@ -761,10 +763,13 @@ static int build_input(struct hda_codec *codec) | |||
761 | err = snd_hda_ctl_add(codec, 0, kctl); | 763 | err = snd_hda_ctl_add(codec, 0, kctl); |
762 | if (err < 0) | 764 | if (err < 0) |
763 | return err; | 765 | return err; |
764 | err = snd_hda_add_nids(codec, kctl, 0, spec->adc_nid, | 766 | for (n = 0; n < AUTO_PIN_LAST; n++) { |
765 | spec->num_inputs); | 767 | if (!spec->adc_nid[n]) |
766 | if (err < 0) | 768 | continue; |
767 | return err; | 769 | err = snd_hda_add_nid(codec, kctl, 0, spec->adc_nid[i]); |
770 | if (err < 0) | ||
771 | return err; | ||
772 | } | ||
768 | } | 773 | } |
769 | 774 | ||
770 | if (spec->num_inputs > 1 && !spec->mic_detect) { | 775 | if (spec->num_inputs > 1 && !spec->mic_detect) { |
@@ -833,7 +838,8 @@ static void cs_automute(struct hda_codec *codec) | |||
833 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 838 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
834 | hp_present ? 0 : PIN_OUT); | 839 | hp_present ? 0 : PIN_OUT); |
835 | } | 840 | } |
836 | if (spec->board_config == CS420X_MBP55) { | 841 | if (spec->board_config == CS420X_MBP55 || |
842 | spec->board_config == CS420X_IMAC27) { | ||
837 | unsigned int gpio = hp_present ? 0x02 : 0x08; | 843 | unsigned int gpio = hp_present ? 0x02 : 0x08; |
838 | snd_hda_codec_write(codec, 0x01, 0, | 844 | snd_hda_codec_write(codec, 0x01, 0, |
839 | AC_VERB_SET_GPIO_DATA, gpio); | 845 | AC_VERB_SET_GPIO_DATA, gpio); |
@@ -1075,12 +1081,14 @@ static int cs_parse_auto_config(struct hda_codec *codec) | |||
1075 | 1081 | ||
1076 | static const char *cs420x_models[CS420X_MODELS] = { | 1082 | static const char *cs420x_models[CS420X_MODELS] = { |
1077 | [CS420X_MBP55] = "mbp55", | 1083 | [CS420X_MBP55] = "mbp55", |
1084 | [CS420X_IMAC27] = "imac27", | ||
1078 | [CS420X_AUTO] = "auto", | 1085 | [CS420X_AUTO] = "auto", |
1079 | }; | 1086 | }; |
1080 | 1087 | ||
1081 | 1088 | ||
1082 | static struct snd_pci_quirk cs420x_cfg_tbl[] = { | 1089 | static struct snd_pci_quirk cs420x_cfg_tbl[] = { |
1083 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), | 1090 | SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), |
1091 | SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), | ||
1084 | {} /* terminator */ | 1092 | {} /* terminator */ |
1085 | }; | 1093 | }; |
1086 | 1094 | ||
@@ -1103,8 +1111,23 @@ static struct cs_pincfg mbp55_pincfgs[] = { | |||
1103 | {} /* terminator */ | 1111 | {} /* terminator */ |
1104 | }; | 1112 | }; |
1105 | 1113 | ||
1114 | static struct cs_pincfg imac27_pincfgs[] = { | ||
1115 | { 0x09, 0x012b4050 }, | ||
1116 | { 0x0a, 0x90100140 }, | ||
1117 | { 0x0b, 0x90100142 }, | ||
1118 | { 0x0c, 0x018b3020 }, | ||
1119 | { 0x0d, 0x90a00110 }, | ||
1120 | { 0x0e, 0x400000f0 }, | ||
1121 | { 0x0f, 0x01cbe030 }, | ||
1122 | { 0x10, 0x014be060 }, | ||
1123 | { 0x12, 0x01ab9070 }, | ||
1124 | { 0x15, 0x400000f0 }, | ||
1125 | {} /* terminator */ | ||
1126 | }; | ||
1127 | |||
1106 | static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { | 1128 | static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { |
1107 | [CS420X_MBP55] = mbp55_pincfgs, | 1129 | [CS420X_MBP55] = mbp55_pincfgs, |
1130 | [CS420X_IMAC27] = imac27_pincfgs, | ||
1108 | }; | 1131 | }; |
1109 | 1132 | ||
1110 | static void fix_pincfg(struct hda_codec *codec, int model) | 1133 | static void fix_pincfg(struct hda_codec *codec, int model) |
@@ -1134,6 +1157,7 @@ static int patch_cs420x(struct hda_codec *codec) | |||
1134 | fix_pincfg(codec, spec->board_config); | 1157 | fix_pincfg(codec, spec->board_config); |
1135 | 1158 | ||
1136 | switch (spec->board_config) { | 1159 | switch (spec->board_config) { |
1160 | case CS420X_IMAC27: | ||
1137 | case CS420X_MBP55: | 1161 | case CS420X_MBP55: |
1138 | /* GPIO1 = headphones */ | 1162 | /* GPIO1 = headphones */ |
1139 | /* GPIO3 = speakers */ | 1163 | /* GPIO3 = speakers */ |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index cc1c22370a60..ff60908f4554 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -345,8 +345,7 @@ static int cmi9880_build_controls(struct hda_codec *codec) | |||
345 | /* assign Capture Source enums to NID */ | 345 | /* assign Capture Source enums to NID */ |
346 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); | 346 | kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); |
347 | for (i = 0; kctl && i < kctl->count; i++) { | 347 | for (i = 0; kctl && i < kctl->count; i++) { |
348 | err = snd_hda_add_nids(codec, kctl, i, spec->adc_nids, | 348 | err = snd_hda_add_nid(codec, kctl, i, spec->adc_nids[i]); |
349 | spec->input_mux->num_items); | ||
350 | if (err < 0) | 349 | if (err < 0) |
351 | return err; | 350 | return err; |
352 | } | 351 | } |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index b20c640f7502..01e46ba72690 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include "hda_codec.h" | 30 | #include "hda_codec.h" |
31 | #include "hda_local.h" | 31 | #include "hda_local.h" |
32 | #include "hda_beep.h" | ||
32 | 33 | ||
33 | #define CXT_PIN_DIR_IN 0x00 | 34 | #define CXT_PIN_DIR_IN 0x00 |
34 | #define CXT_PIN_DIR_OUT 0x01 | 35 | #define CXT_PIN_DIR_OUT 0x01 |
@@ -111,6 +112,7 @@ struct conexant_spec { | |||
111 | unsigned int dell_automute; | 112 | unsigned int dell_automute; |
112 | unsigned int port_d_mode; | 113 | unsigned int port_d_mode; |
113 | unsigned char ext_mic_bias; | 114 | unsigned char ext_mic_bias; |
115 | unsigned int dell_vostro; | ||
114 | }; | 116 | }; |
115 | 117 | ||
116 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, | 118 | static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, |
@@ -476,6 +478,7 @@ static void conexant_free(struct hda_codec *codec) | |||
476 | snd_array_free(&spec->jacks); | 478 | snd_array_free(&spec->jacks); |
477 | } | 479 | } |
478 | #endif | 480 | #endif |
481 | snd_hda_detach_beep_device(codec); | ||
479 | kfree(codec->spec); | 482 | kfree(codec->spec); |
480 | } | 483 | } |
481 | 484 | ||
@@ -2159,9 +2162,12 @@ static int cxt5066_mic_boost_mux_enum_get(struct snd_kcontrol *kcontrol, | |||
2159 | { | 2162 | { |
2160 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2163 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2161 | int val; | 2164 | int val; |
2165 | hda_nid_t nid = kcontrol->private_value & 0xff; | ||
2166 | int inout = (kcontrol->private_value & 0x100) ? | ||
2167 | AC_AMP_GET_INPUT : AC_AMP_GET_OUTPUT; | ||
2162 | 2168 | ||
2163 | val = snd_hda_codec_read(codec, 0x17, 0, | 2169 | val = snd_hda_codec_read(codec, nid, 0, |
2164 | AC_VERB_GET_AMP_GAIN_MUTE, AC_AMP_GET_OUTPUT); | 2170 | AC_VERB_GET_AMP_GAIN_MUTE, inout); |
2165 | 2171 | ||
2166 | ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; | 2172 | ucontrol->value.enumerated.item[0] = val & AC_AMP_GAIN; |
2167 | return 0; | 2173 | return 0; |
@@ -2173,6 +2179,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
2173 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2179 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
2174 | const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; | 2180 | const struct hda_input_mux *imux = &cxt5066_analog_mic_boost; |
2175 | unsigned int idx; | 2181 | unsigned int idx; |
2182 | hda_nid_t nid = kcontrol->private_value & 0xff; | ||
2183 | int inout = (kcontrol->private_value & 0x100) ? | ||
2184 | AC_AMP_SET_INPUT : AC_AMP_SET_OUTPUT; | ||
2176 | 2185 | ||
2177 | if (!imux->num_items) | 2186 | if (!imux->num_items) |
2178 | return 0; | 2187 | return 0; |
@@ -2180,9 +2189,9 @@ static int cxt5066_mic_boost_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
2180 | if (idx >= imux->num_items) | 2189 | if (idx >= imux->num_items) |
2181 | idx = imux->num_items - 1; | 2190 | idx = imux->num_items - 1; |
2182 | 2191 | ||
2183 | snd_hda_codec_write_cache(codec, 0x17, 0, | 2192 | snd_hda_codec_write_cache(codec, nid, 0, |
2184 | AC_VERB_SET_AMP_GAIN_MUTE, | 2193 | AC_VERB_SET_AMP_GAIN_MUTE, |
2185 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | AC_AMP_SET_OUTPUT | | 2194 | AC_AMP_SET_RIGHT | AC_AMP_SET_LEFT | inout | |
2186 | imux->items[idx].index); | 2195 | imux->items[idx].index); |
2187 | 2196 | ||
2188 | return 1; | 2197 | return 1; |
@@ -2252,10 +2261,11 @@ static struct snd_kcontrol_new cxt5066_mixers[] = { | |||
2252 | 2261 | ||
2253 | { | 2262 | { |
2254 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 2263 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
2255 | .name = "Analog Mic Boost Capture Enum", | 2264 | .name = "Ext Mic Boost Capture Enum", |
2256 | .info = cxt5066_mic_boost_mux_enum_info, | 2265 | .info = cxt5066_mic_boost_mux_enum_info, |
2257 | .get = cxt5066_mic_boost_mux_enum_get, | 2266 | .get = cxt5066_mic_boost_mux_enum_get, |
2258 | .put = cxt5066_mic_boost_mux_enum_put, | 2267 | .put = cxt5066_mic_boost_mux_enum_put, |
2268 | .private_value = 0x17, | ||
2259 | }, | 2269 | }, |
2260 | 2270 | ||
2261 | HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), | 2271 | HDA_BIND_VOL("Capture Volume", &cxt5066_bind_capture_vol_others), |
@@ -2263,6 +2273,19 @@ static struct snd_kcontrol_new cxt5066_mixers[] = { | |||
2263 | {} | 2273 | {} |
2264 | }; | 2274 | }; |
2265 | 2275 | ||
2276 | static struct snd_kcontrol_new cxt5066_vostro_mixers[] = { | ||
2277 | { | ||
2278 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2279 | .name = "Int Mic Boost Capture Enum", | ||
2280 | .info = cxt5066_mic_boost_mux_enum_info, | ||
2281 | .get = cxt5066_mic_boost_mux_enum_get, | ||
2282 | .put = cxt5066_mic_boost_mux_enum_put, | ||
2283 | .private_value = 0x23 | 0x100, | ||
2284 | }, | ||
2285 | HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT), | ||
2286 | {} | ||
2287 | }; | ||
2288 | |||
2266 | static struct hda_verb cxt5066_init_verbs[] = { | 2289 | static struct hda_verb cxt5066_init_verbs[] = { |
2267 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ | 2290 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port B */ |
2268 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ | 2291 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* Port C */ |
@@ -2448,11 +2471,16 @@ static struct hda_verb cxt5066_init_verbs_portd_lo[] = { | |||
2448 | /* initialize jack-sensing, too */ | 2471 | /* initialize jack-sensing, too */ |
2449 | static int cxt5066_init(struct hda_codec *codec) | 2472 | static int cxt5066_init(struct hda_codec *codec) |
2450 | { | 2473 | { |
2474 | struct conexant_spec *spec = codec->spec; | ||
2475 | |||
2451 | snd_printdd("CXT5066: init\n"); | 2476 | snd_printdd("CXT5066: init\n"); |
2452 | conexant_init(codec); | 2477 | conexant_init(codec); |
2453 | if (codec->patch_ops.unsol_event) { | 2478 | if (codec->patch_ops.unsol_event) { |
2454 | cxt5066_hp_automute(codec); | 2479 | cxt5066_hp_automute(codec); |
2455 | cxt5066_automic(codec); | 2480 | if (spec->dell_vostro) |
2481 | cxt5066_vostro_automic(codec); | ||
2482 | else | ||
2483 | cxt5066_automic(codec); | ||
2456 | } | 2484 | } |
2457 | return 0; | 2485 | return 0; |
2458 | } | 2486 | } |
@@ -2551,7 +2579,10 @@ static int patch_cxt5066(struct hda_codec *codec) | |||
2551 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; | 2579 | spec->init_verbs[0] = cxt5066_init_verbs_vostro; |
2552 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; | 2580 | spec->mixers[spec->num_mixers++] = cxt5066_mixer_master_olpc; |
2553 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; | 2581 | spec->mixers[spec->num_mixers++] = cxt5066_mixers; |
2582 | spec->mixers[spec->num_mixers++] = cxt5066_vostro_mixers; | ||
2554 | spec->port_d_mode = 0; | 2583 | spec->port_d_mode = 0; |
2584 | spec->dell_vostro = 1; | ||
2585 | snd_hda_attach_beep_device(codec, 0x13); | ||
2555 | 2586 | ||
2556 | /* no S/PDIF out */ | 2587 | /* no S/PDIF out */ |
2557 | spec->multiout.dig_out_nid = 0; | 2588 | spec->multiout.dig_out_nid = 0; |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index cb7679551bdc..141ff446104a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -131,8 +131,8 @@ enum { | |||
131 | enum { | 131 | enum { |
132 | ALC269_BASIC, | 132 | ALC269_BASIC, |
133 | ALC269_QUANTA_FL1, | 133 | ALC269_QUANTA_FL1, |
134 | ALC269_ASUS_EEEPC_P703, | 134 | ALC269_ASUS_AMIC, |
135 | ALC269_ASUS_EEEPC_P901, | 135 | ALC269_ASUS_DMIC, |
136 | ALC269_FUJITSU, | 136 | ALC269_FUJITSU, |
137 | ALC269_LIFEBOOK, | 137 | ALC269_LIFEBOOK, |
138 | ALC269_AUTO, | 138 | ALC269_AUTO, |
@@ -188,6 +188,8 @@ enum { | |||
188 | ALC663_ASUS_MODE4, | 188 | ALC663_ASUS_MODE4, |
189 | ALC663_ASUS_MODE5, | 189 | ALC663_ASUS_MODE5, |
190 | ALC663_ASUS_MODE6, | 190 | ALC663_ASUS_MODE6, |
191 | ALC663_ASUS_MODE7, | ||
192 | ALC663_ASUS_MODE8, | ||
191 | ALC272_DELL, | 193 | ALC272_DELL, |
192 | ALC272_DELL_ZM1, | 194 | ALC272_DELL_ZM1, |
193 | ALC272_SAMSUNG_NC10, | 195 | ALC272_SAMSUNG_NC10, |
@@ -335,6 +337,9 @@ struct alc_spec { | |||
335 | /* hooks */ | 337 | /* hooks */ |
336 | void (*init_hook)(struct hda_codec *codec); | 338 | void (*init_hook)(struct hda_codec *codec); |
337 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); | 339 | void (*unsol_event)(struct hda_codec *codec, unsigned int res); |
340 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
341 | void (*power_hook)(struct hda_codec *codec); | ||
342 | #endif | ||
338 | 343 | ||
339 | /* for pin sensing */ | 344 | /* for pin sensing */ |
340 | unsigned int sense_updated: 1; | 345 | unsigned int sense_updated: 1; |
@@ -386,6 +391,7 @@ struct alc_config_preset { | |||
386 | void (*init_hook)(struct hda_codec *); | 391 | void (*init_hook)(struct hda_codec *); |
387 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 392 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
388 | struct hda_amp_list *loopbacks; | 393 | struct hda_amp_list *loopbacks; |
394 | void (*power_hook)(struct hda_codec *codec); | ||
389 | #endif | 395 | #endif |
390 | }; | 396 | }; |
391 | 397 | ||
@@ -902,6 +908,7 @@ static void setup_preset(struct hda_codec *codec, | |||
902 | spec->unsol_event = preset->unsol_event; | 908 | spec->unsol_event = preset->unsol_event; |
903 | spec->init_hook = preset->init_hook; | 909 | spec->init_hook = preset->init_hook; |
904 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 910 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
911 | spec->power_hook = preset->power_hook; | ||
905 | spec->loopback.amplist = preset->loopbacks; | 912 | spec->loopback.amplist = preset->loopbacks; |
906 | #endif | 913 | #endif |
907 | 914 | ||
@@ -1667,9 +1674,6 @@ static struct hda_verb alc889_acer_aspire_8930g_verbs[] = { | |||
1667 | /* some bit here disables the other DACs. Init=0x4900 */ | 1674 | /* some bit here disables the other DACs. Init=0x4900 */ |
1668 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, | 1675 | {0x20, AC_VERB_SET_COEF_INDEX, 0x08}, |
1669 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, | 1676 | {0x20, AC_VERB_SET_PROC_COEF, 0x0000}, |
1670 | /* Enable amplifiers */ | ||
1671 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1672 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, | ||
1673 | /* DMIC fix | 1677 | /* DMIC fix |
1674 | * This laptop has a stereo digital microphone. The mics are only 1cm apart | 1678 | * This laptop has a stereo digital microphone. The mics are only 1cm apart |
1675 | * which makes the stereo useless. However, either the mic or the ALC889 | 1679 | * which makes the stereo useless. However, either the mic or the ALC889 |
@@ -1782,6 +1786,25 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1782 | { } /* end */ | 1786 | { } /* end */ |
1783 | }; | 1787 | }; |
1784 | 1788 | ||
1789 | static struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = { | ||
1790 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
1791 | HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), | ||
1792 | HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), | ||
1793 | HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), | ||
1794 | HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, | ||
1795 | HDA_OUTPUT), | ||
1796 | HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | ||
1797 | HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), | ||
1798 | HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), | ||
1799 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
1800 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
1801 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
1802 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
1803 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
1804 | { } /* end */ | ||
1805 | }; | ||
1806 | |||
1807 | |||
1785 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) | 1808 | static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec) |
1786 | { | 1809 | { |
1787 | struct alc_spec *spec = codec->spec; | 1810 | struct alc_spec *spec = codec->spec; |
@@ -2515,8 +2538,10 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2515 | if (!kctl) | 2538 | if (!kctl) |
2516 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 2539 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
2517 | for (i = 0; kctl && i < kctl->count; i++) { | 2540 | for (i = 0; kctl && i < kctl->count; i++) { |
2518 | err = snd_hda_add_nids(codec, kctl, i, spec->capsrc_nids, | 2541 | hda_nid_t *nids = spec->capsrc_nids; |
2519 | spec->input_mux->num_items); | 2542 | if (!nids) |
2543 | nids = spec->adc_nids; | ||
2544 | err = snd_hda_add_nid(codec, kctl, i, nids[i]); | ||
2520 | if (err < 0) | 2545 | if (err < 0) |
2521 | return err; | 2546 | return err; |
2522 | } | 2547 | } |
@@ -3658,6 +3683,11 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
3658 | return 0; | 3683 | return 0; |
3659 | } | 3684 | } |
3660 | 3685 | ||
3686 | static inline void alc_shutup(struct hda_codec *codec) | ||
3687 | { | ||
3688 | snd_hda_shutup_pins(codec); | ||
3689 | } | ||
3690 | |||
3661 | static void alc_free_kctls(struct hda_codec *codec) | 3691 | static void alc_free_kctls(struct hda_codec *codec) |
3662 | { | 3692 | { |
3663 | struct alc_spec *spec = codec->spec; | 3693 | struct alc_spec *spec = codec->spec; |
@@ -3678,11 +3708,51 @@ static void alc_free(struct hda_codec *codec) | |||
3678 | if (!spec) | 3708 | if (!spec) |
3679 | return; | 3709 | return; |
3680 | 3710 | ||
3711 | alc_shutup(codec); | ||
3681 | alc_free_kctls(codec); | 3712 | alc_free_kctls(codec); |
3682 | kfree(spec); | 3713 | kfree(spec); |
3683 | snd_hda_detach_beep_device(codec); | 3714 | snd_hda_detach_beep_device(codec); |
3684 | } | 3715 | } |
3685 | 3716 | ||
3717 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
3718 | static void alc_power_eapd(struct hda_codec *codec) | ||
3719 | { | ||
3720 | /* We currently only handle front, HP */ | ||
3721 | switch (codec->vendor_id) { | ||
3722 | case 0x10ec0260: | ||
3723 | snd_hda_codec_write(codec, 0x0f, 0, | ||
3724 | AC_VERB_SET_EAPD_BTLENABLE, 0x00); | ||
3725 | snd_hda_codec_write(codec, 0x10, 0, | ||
3726 | AC_VERB_SET_EAPD_BTLENABLE, 0x00); | ||
3727 | break; | ||
3728 | case 0x10ec0262: | ||
3729 | case 0x10ec0267: | ||
3730 | case 0x10ec0268: | ||
3731 | case 0x10ec0269: | ||
3732 | case 0x10ec0272: | ||
3733 | case 0x10ec0660: | ||
3734 | case 0x10ec0662: | ||
3735 | case 0x10ec0663: | ||
3736 | case 0x10ec0862: | ||
3737 | case 0x10ec0889: | ||
3738 | snd_hda_codec_write(codec, 0x14, 0, | ||
3739 | AC_VERB_SET_EAPD_BTLENABLE, 0x00); | ||
3740 | snd_hda_codec_write(codec, 0x15, 0, | ||
3741 | AC_VERB_SET_EAPD_BTLENABLE, 0x00); | ||
3742 | break; | ||
3743 | } | ||
3744 | } | ||
3745 | |||
3746 | static int alc_suspend(struct hda_codec *codec, pm_message_t state) | ||
3747 | { | ||
3748 | struct alc_spec *spec = codec->spec; | ||
3749 | alc_shutup(codec); | ||
3750 | if (spec && spec->power_hook) | ||
3751 | spec->power_hook(codec); | ||
3752 | return 0; | ||
3753 | } | ||
3754 | #endif | ||
3755 | |||
3686 | #ifdef SND_HDA_NEEDS_RESUME | 3756 | #ifdef SND_HDA_NEEDS_RESUME |
3687 | static int alc_resume(struct hda_codec *codec) | 3757 | static int alc_resume(struct hda_codec *codec) |
3688 | { | 3758 | { |
@@ -3705,8 +3775,10 @@ static struct hda_codec_ops alc_patch_ops = { | |||
3705 | .resume = alc_resume, | 3775 | .resume = alc_resume, |
3706 | #endif | 3776 | #endif |
3707 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 3777 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
3778 | .suspend = alc_suspend, | ||
3708 | .check_power_status = alc_check_power_status, | 3779 | .check_power_status = alc_check_power_status, |
3709 | #endif | 3780 | #endif |
3781 | .reboot_notify = alc_shutup, | ||
3710 | }; | 3782 | }; |
3711 | 3783 | ||
3712 | 3784 | ||
@@ -6334,6 +6406,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
6334 | 6406 | ||
6335 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | 6407 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
6336 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | 6408 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
6409 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer", ALC260_WILL), | ||
6337 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | 6410 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
6338 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | 6411 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), |
6339 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | 6412 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
@@ -9004,7 +9077,7 @@ static struct snd_pci_quirk alc882_cfg_tbl[] = { | |||
9004 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), | 9077 | SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG), |
9005 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), | 9078 | SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), |
9006 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ | 9079 | SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */ |
9007 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC883_TARGA_2ch_DIG), | 9080 | SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO), |
9008 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), | 9081 | SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), |
9009 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), | 9082 | SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG), |
9010 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), | 9083 | SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG), |
@@ -9367,6 +9440,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9367 | .dac_nids = alc883_dac_nids, | 9440 | .dac_nids = alc883_dac_nids, |
9368 | .adc_nids = alc883_adc_nids_alt, | 9441 | .adc_nids = alc883_adc_nids_alt, |
9369 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9442 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9443 | .capsrc_nids = alc883_capsrc_nids, | ||
9370 | .dig_out_nid = ALC883_DIGOUT_NID, | 9444 | .dig_out_nid = ALC883_DIGOUT_NID, |
9371 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9445 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9372 | .channel_mode = alc883_3ST_2ch_modes, | 9446 | .channel_mode = alc883_3ST_2ch_modes, |
@@ -9463,10 +9537,11 @@ static struct alc_config_preset alc882_presets[] = { | |||
9463 | .init_hook = alc_automute_amp, | 9537 | .init_hook = alc_automute_amp, |
9464 | }, | 9538 | }, |
9465 | [ALC888_ACER_ASPIRE_8930G] = { | 9539 | [ALC888_ACER_ASPIRE_8930G] = { |
9466 | .mixers = { alc888_base_mixer, | 9540 | .mixers = { alc889_acer_aspire_8930g_mixer, |
9467 | alc883_chmode_mixer }, | 9541 | alc883_chmode_mixer }, |
9468 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, | 9542 | .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, |
9469 | alc889_acer_aspire_8930g_verbs }, | 9543 | alc889_acer_aspire_8930g_verbs, |
9544 | alc889_eapd_verbs}, | ||
9470 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9545 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9471 | .dac_nids = alc883_dac_nids, | 9546 | .dac_nids = alc883_dac_nids, |
9472 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), | 9547 | .num_adc_nids = ARRAY_SIZE(alc889_adc_nids), |
@@ -9483,6 +9558,9 @@ static struct alc_config_preset alc882_presets[] = { | |||
9483 | .unsol_event = alc_automute_amp_unsol_event, | 9558 | .unsol_event = alc_automute_amp_unsol_event, |
9484 | .setup = alc889_acer_aspire_8930g_setup, | 9559 | .setup = alc889_acer_aspire_8930g_setup, |
9485 | .init_hook = alc_automute_amp, | 9560 | .init_hook = alc_automute_amp, |
9561 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
9562 | .power_hook = alc_power_eapd, | ||
9563 | #endif | ||
9486 | }, | 9564 | }, |
9487 | [ALC888_ACER_ASPIRE_7730G] = { | 9565 | [ALC888_ACER_ASPIRE_7730G] = { |
9488 | .mixers = { alc883_3ST_6ch_mixer, | 9566 | .mixers = { alc883_3ST_6ch_mixer, |
@@ -9513,6 +9591,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9513 | .dac_nids = alc883_dac_nids, | 9591 | .dac_nids = alc883_dac_nids, |
9514 | .adc_nids = alc883_adc_nids_alt, | 9592 | .adc_nids = alc883_adc_nids_alt, |
9515 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9593 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9594 | .capsrc_nids = alc883_capsrc_nids, | ||
9516 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 9595 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
9517 | .channel_mode = alc883_sixstack_modes, | 9596 | .channel_mode = alc883_sixstack_modes, |
9518 | .input_mux = &alc883_capture_source, | 9597 | .input_mux = &alc883_capture_source, |
@@ -9574,6 +9653,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9574 | .dac_nids = alc883_dac_nids, | 9653 | .dac_nids = alc883_dac_nids, |
9575 | .adc_nids = alc883_adc_nids_alt, | 9654 | .adc_nids = alc883_adc_nids_alt, |
9576 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), | 9655 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt), |
9656 | .capsrc_nids = alc883_capsrc_nids, | ||
9577 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), | 9657 | .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), |
9578 | .channel_mode = alc883_3ST_2ch_modes, | 9658 | .channel_mode = alc883_3ST_2ch_modes, |
9579 | .input_mux = &alc883_lenovo_101e_capture_source, | 9659 | .input_mux = &alc883_lenovo_101e_capture_source, |
@@ -9753,6 +9833,7 @@ static struct alc_config_preset alc882_presets[] = { | |||
9753 | alc880_gpio1_init_verbs }, | 9833 | alc880_gpio1_init_verbs }, |
9754 | .adc_nids = alc883_adc_nids, | 9834 | .adc_nids = alc883_adc_nids, |
9755 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), | 9835 | .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), |
9836 | .capsrc_nids = alc883_capsrc_nids, | ||
9756 | .dac_nids = alc883_dac_nids, | 9837 | .dac_nids = alc883_dac_nids, |
9757 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), | 9838 | .num_dacs = ARRAY_SIZE(alc883_dac_nids), |
9758 | .channel_mode = alc889A_mb31_6ch_modes, | 9839 | .channel_mode = alc889A_mb31_6ch_modes, |
@@ -10775,6 +10856,13 @@ static struct hda_verb alc262_lenovo_3000_unsol_verbs[] = { | |||
10775 | {} | 10856 | {} |
10776 | }; | 10857 | }; |
10777 | 10858 | ||
10859 | static struct hda_verb alc262_lenovo_3000_init_verbs[] = { | ||
10860 | /* Front Mic pin: input vref at 50% */ | ||
10861 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
10862 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
10863 | {} | ||
10864 | }; | ||
10865 | |||
10778 | static struct hda_input_mux alc262_fujitsu_capture_source = { | 10866 | static struct hda_input_mux alc262_fujitsu_capture_source = { |
10779 | .num_items = 3, | 10867 | .num_items = 3, |
10780 | .items = { | 10868 | .items = { |
@@ -11829,7 +11917,8 @@ static struct alc_config_preset alc262_presets[] = { | |||
11829 | [ALC262_LENOVO_3000] = { | 11917 | [ALC262_LENOVO_3000] = { |
11830 | .mixers = { alc262_lenovo_3000_mixer }, | 11918 | .mixers = { alc262_lenovo_3000_mixer }, |
11831 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, | 11919 | .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs, |
11832 | alc262_lenovo_3000_unsol_verbs }, | 11920 | alc262_lenovo_3000_unsol_verbs, |
11921 | alc262_lenovo_3000_init_verbs }, | ||
11833 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | 11922 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), |
11834 | .dac_nids = alc262_dac_nids, | 11923 | .dac_nids = alc262_dac_nids, |
11835 | .hp_nid = 0x03, | 11924 | .hp_nid = 0x03, |
@@ -12969,7 +13058,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
12969 | int board_config; | 13058 | int board_config; |
12970 | int i, has_beep, err; | 13059 | int i, has_beep, err; |
12971 | 13060 | ||
12972 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 13061 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
12973 | if (spec == NULL) | 13062 | if (spec == NULL) |
12974 | return -ENOMEM; | 13063 | return -ENOMEM; |
12975 | 13064 | ||
@@ -13346,10 +13435,12 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = { | |||
13346 | /* toggle speaker-output according to the hp-jack state */ | 13435 | /* toggle speaker-output according to the hp-jack state */ |
13347 | static void alc269_speaker_automute(struct hda_codec *codec) | 13436 | static void alc269_speaker_automute(struct hda_codec *codec) |
13348 | { | 13437 | { |
13438 | struct alc_spec *spec = codec->spec; | ||
13439 | unsigned int nid = spec->autocfg.hp_pins[0]; | ||
13349 | unsigned int present; | 13440 | unsigned int present; |
13350 | unsigned char bits; | 13441 | unsigned char bits; |
13351 | 13442 | ||
13352 | present = snd_hda_jack_detect(codec, 0x15); | 13443 | present = snd_hda_jack_detect(codec, nid); |
13353 | bits = present ? AMP_IN_MUTE(0) : 0; | 13444 | bits = present ? AMP_IN_MUTE(0) : 0; |
13354 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, | 13445 | snd_hda_codec_amp_stereo(codec, 0x0c, HDA_INPUT, 0, |
13355 | AMP_IN_MUTE(0), bits); | 13446 | AMP_IN_MUTE(0), bits); |
@@ -13574,8 +13665,8 @@ static void alc269_auto_init(struct hda_codec *codec) | |||
13574 | static const char *alc269_models[ALC269_MODEL_LAST] = { | 13665 | static const char *alc269_models[ALC269_MODEL_LAST] = { |
13575 | [ALC269_BASIC] = "basic", | 13666 | [ALC269_BASIC] = "basic", |
13576 | [ALC269_QUANTA_FL1] = "quanta", | 13667 | [ALC269_QUANTA_FL1] = "quanta", |
13577 | [ALC269_ASUS_EEEPC_P703] = "eeepc-p703", | 13668 | [ALC269_ASUS_AMIC] = "asus-amic", |
13578 | [ALC269_ASUS_EEEPC_P901] = "eeepc-p901", | 13669 | [ALC269_ASUS_DMIC] = "asus-dmic", |
13579 | [ALC269_FUJITSU] = "fujitsu", | 13670 | [ALC269_FUJITSU] = "fujitsu", |
13580 | [ALC269_LIFEBOOK] = "lifebook", | 13671 | [ALC269_LIFEBOOK] = "lifebook", |
13581 | [ALC269_AUTO] = "auto", | 13672 | [ALC269_AUTO] = "auto", |
@@ -13584,18 +13675,41 @@ static const char *alc269_models[ALC269_MODEL_LAST] = { | |||
13584 | static struct snd_pci_quirk alc269_cfg_tbl[] = { | 13675 | static struct snd_pci_quirk alc269_cfg_tbl[] = { |
13585 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), | 13676 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1), |
13586 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", | 13677 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
13587 | ALC269_ASUS_EEEPC_P703), | 13678 | ALC269_ASUS_AMIC), |
13588 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), | 13679 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), |
13589 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), | 13680 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), |
13590 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), | 13681 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), |
13591 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), | 13682 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), |
13592 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), | 13683 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), |
13593 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), | 13684 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), |
13685 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), | ||
13686 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), | ||
13687 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), | ||
13688 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), | ||
13689 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), | ||
13690 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), | ||
13691 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), | ||
13692 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), | ||
13693 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), | ||
13694 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), | ||
13695 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), | ||
13696 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), | ||
13697 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), | ||
13698 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), | ||
13699 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), | ||
13700 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), | ||
13701 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), | ||
13702 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), | ||
13703 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), | ||
13704 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), | ||
13705 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), | ||
13706 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), | ||
13594 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", | 13707 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", |
13595 | ALC269_ASUS_EEEPC_P901), | 13708 | ALC269_ASUS_DMIC), |
13596 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", | 13709 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", |
13597 | ALC269_ASUS_EEEPC_P901), | 13710 | ALC269_ASUS_DMIC), |
13598 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), | 13711 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), |
13712 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), | ||
13599 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), | 13713 | SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), |
13600 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), | 13714 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), |
13601 | {} | 13715 | {} |
@@ -13625,7 +13739,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13625 | .setup = alc269_quanta_fl1_setup, | 13739 | .setup = alc269_quanta_fl1_setup, |
13626 | .init_hook = alc269_quanta_fl1_init_hook, | 13740 | .init_hook = alc269_quanta_fl1_init_hook, |
13627 | }, | 13741 | }, |
13628 | [ALC269_ASUS_EEEPC_P703] = { | 13742 | [ALC269_ASUS_AMIC] = { |
13629 | .mixers = { alc269_eeepc_mixer }, | 13743 | .mixers = { alc269_eeepc_mixer }, |
13630 | .cap_mixer = alc269_epc_capture_mixer, | 13744 | .cap_mixer = alc269_epc_capture_mixer, |
13631 | .init_verbs = { alc269_init_verbs, | 13745 | .init_verbs = { alc269_init_verbs, |
@@ -13639,7 +13753,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
13639 | .setup = alc269_eeepc_amic_setup, | 13753 | .setup = alc269_eeepc_amic_setup, |
13640 | .init_hook = alc269_eeepc_inithook, | 13754 | .init_hook = alc269_eeepc_inithook, |
13641 | }, | 13755 | }, |
13642 | [ALC269_ASUS_EEEPC_P901] = { | 13756 | [ALC269_ASUS_DMIC] = { |
13643 | .mixers = { alc269_eeepc_mixer }, | 13757 | .mixers = { alc269_eeepc_mixer }, |
13644 | .cap_mixer = alc269_epc_capture_mixer, | 13758 | .cap_mixer = alc269_epc_capture_mixer, |
13645 | .init_verbs = { alc269_init_verbs, | 13759 | .init_verbs = { alc269_init_verbs, |
@@ -14882,9 +14996,13 @@ static int patch_alc861(struct hda_codec *codec) | |||
14882 | spec->vmaster_nid = 0x03; | 14996 | spec->vmaster_nid = 0x03; |
14883 | 14997 | ||
14884 | codec->patch_ops = alc_patch_ops; | 14998 | codec->patch_ops = alc_patch_ops; |
14885 | if (board_config == ALC861_AUTO) | 14999 | if (board_config == ALC861_AUTO) { |
14886 | spec->init_hook = alc861_auto_init; | 15000 | spec->init_hook = alc861_auto_init; |
14887 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 15001 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
15002 | spec->power_hook = alc_power_eapd; | ||
15003 | #endif | ||
15004 | } | ||
15005 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
14888 | if (!spec->loopback.amplist) | 15006 | if (!spec->loopback.amplist) |
14889 | spec->loopback.amplist = alc861_loopbacks; | 15007 | spec->loopback.amplist = alc861_loopbacks; |
14890 | #endif | 15008 | #endif |
@@ -16274,6 +16392,52 @@ static struct snd_kcontrol_new alc663_g50v_mixer[] = { | |||
16274 | { } /* end */ | 16392 | { } /* end */ |
16275 | }; | 16393 | }; |
16276 | 16394 | ||
16395 | static struct hda_bind_ctls alc663_asus_mode7_8_all_bind_switch = { | ||
16396 | .ops = &snd_hda_bind_sw, | ||
16397 | .values = { | ||
16398 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
16399 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
16400 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
16401 | HDA_COMPOSE_AMP_VAL(0x1b, 3, 0, HDA_OUTPUT), | ||
16402 | HDA_COMPOSE_AMP_VAL(0x21, 3, 0, HDA_OUTPUT), | ||
16403 | 0 | ||
16404 | }, | ||
16405 | }; | ||
16406 | |||
16407 | static struct hda_bind_ctls alc663_asus_mode7_8_sp_bind_switch = { | ||
16408 | .ops = &snd_hda_bind_sw, | ||
16409 | .values = { | ||
16410 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | ||
16411 | HDA_COMPOSE_AMP_VAL(0x17, 3, 0, HDA_OUTPUT), | ||
16412 | 0 | ||
16413 | }, | ||
16414 | }; | ||
16415 | |||
16416 | static struct snd_kcontrol_new alc663_mode7_mixer[] = { | ||
16417 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
16418 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
16419 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
16420 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | ||
16421 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
16422 | HDA_CODEC_VOLUME("IntMic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
16423 | HDA_CODEC_MUTE("IntMic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
16424 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | ||
16425 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | ||
16426 | { } /* end */ | ||
16427 | }; | ||
16428 | |||
16429 | static struct snd_kcontrol_new alc663_mode8_mixer[] = { | ||
16430 | HDA_BIND_SW("Master Playback Switch", &alc663_asus_mode7_8_all_bind_switch), | ||
16431 | HDA_BIND_VOL("Speaker Playback Volume", &alc663_asus_bind_master_vol), | ||
16432 | HDA_BIND_SW("Speaker Playback Switch", &alc663_asus_mode7_8_sp_bind_switch), | ||
16433 | HDA_CODEC_MUTE("Headphone1 Playback Switch", 0x15, 0x0, HDA_OUTPUT), | ||
16434 | HDA_CODEC_MUTE("Headphone2 Playback Switch", 0x21, 0x0, HDA_OUTPUT), | ||
16435 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
16436 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
16437 | { } /* end */ | ||
16438 | }; | ||
16439 | |||
16440 | |||
16277 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { | 16441 | static struct snd_kcontrol_new alc662_chmode_mixer[] = { |
16278 | { | 16442 | { |
16279 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 16443 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -16561,6 +16725,45 @@ static struct hda_verb alc272_dell_init_verbs[] = { | |||
16561 | {} | 16725 | {} |
16562 | }; | 16726 | }; |
16563 | 16727 | ||
16728 | static struct hda_verb alc663_mode7_init_verbs[] = { | ||
16729 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16730 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16731 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
16732 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16733 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16734 | {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16735 | {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
16736 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16737 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16738 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
16739 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
16740 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
16741 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
16742 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16743 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16744 | {} | ||
16745 | }; | ||
16746 | |||
16747 | static struct hda_verb alc663_mode8_init_verbs[] = { | ||
16748 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16749 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16750 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16751 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | ||
16752 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16753 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
16754 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16755 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
16756 | {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
16757 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
16758 | {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ | ||
16759 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
16760 | {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, | ||
16761 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16762 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, | ||
16763 | {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
16764 | {} | ||
16765 | }; | ||
16766 | |||
16564 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { | 16767 | static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { |
16565 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), | 16768 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), |
16566 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), | 16769 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), |
@@ -16740,6 +16943,54 @@ static void alc663_two_hp_m2_speaker_automute(struct hda_codec *codec) | |||
16740 | } | 16943 | } |
16741 | } | 16944 | } |
16742 | 16945 | ||
16946 | static void alc663_two_hp_m7_speaker_automute(struct hda_codec *codec) | ||
16947 | { | ||
16948 | unsigned int present1, present2; | ||
16949 | |||
16950 | present1 = snd_hda_codec_read(codec, 0x1b, 0, | ||
16951 | AC_VERB_GET_PIN_SENSE, 0) | ||
16952 | & AC_PINSENSE_PRESENCE; | ||
16953 | present2 = snd_hda_codec_read(codec, 0x21, 0, | ||
16954 | AC_VERB_GET_PIN_SENSE, 0) | ||
16955 | & AC_PINSENSE_PRESENCE; | ||
16956 | |||
16957 | if (present1 || present2) { | ||
16958 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16959 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16960 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16961 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16962 | } else { | ||
16963 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16964 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16965 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16966 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16967 | } | ||
16968 | } | ||
16969 | |||
16970 | static void alc663_two_hp_m8_speaker_automute(struct hda_codec *codec) | ||
16971 | { | ||
16972 | unsigned int present1, present2; | ||
16973 | |||
16974 | present1 = snd_hda_codec_read(codec, 0x21, 0, | ||
16975 | AC_VERB_GET_PIN_SENSE, 0) | ||
16976 | & AC_PINSENSE_PRESENCE; | ||
16977 | present2 = snd_hda_codec_read(codec, 0x15, 0, | ||
16978 | AC_VERB_GET_PIN_SENSE, 0) | ||
16979 | & AC_PINSENSE_PRESENCE; | ||
16980 | |||
16981 | if (present1 || present2) { | ||
16982 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16983 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16984 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16985 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
16986 | } else { | ||
16987 | snd_hda_codec_write_cache(codec, 0x14, 0, | ||
16988 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16989 | snd_hda_codec_write_cache(codec, 0x17, 0, | ||
16990 | AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT); | ||
16991 | } | ||
16992 | } | ||
16993 | |||
16743 | static void alc663_m51va_unsol_event(struct hda_codec *codec, | 16994 | static void alc663_m51va_unsol_event(struct hda_codec *codec, |
16744 | unsigned int res) | 16995 | unsigned int res) |
16745 | { | 16996 | { |
@@ -16759,7 +17010,7 @@ static void alc663_m51va_setup(struct hda_codec *codec) | |||
16759 | spec->ext_mic.pin = 0x18; | 17010 | spec->ext_mic.pin = 0x18; |
16760 | spec->ext_mic.mux_idx = 0; | 17011 | spec->ext_mic.mux_idx = 0; |
16761 | spec->int_mic.pin = 0x12; | 17012 | spec->int_mic.pin = 0x12; |
16762 | spec->int_mic.mux_idx = 1; | 17013 | spec->int_mic.mux_idx = 9; |
16763 | spec->auto_mic = 1; | 17014 | spec->auto_mic = 1; |
16764 | } | 17015 | } |
16765 | 17016 | ||
@@ -16771,7 +17022,17 @@ static void alc663_m51va_inithook(struct hda_codec *codec) | |||
16771 | 17022 | ||
16772 | /* ***************** Mode1 ******************************/ | 17023 | /* ***************** Mode1 ******************************/ |
16773 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event | 17024 | #define alc663_mode1_unsol_event alc663_m51va_unsol_event |
16774 | #define alc663_mode1_setup alc663_m51va_setup | 17025 | |
17026 | static void alc663_mode1_setup(struct hda_codec *codec) | ||
17027 | { | ||
17028 | struct alc_spec *spec = codec->spec; | ||
17029 | spec->ext_mic.pin = 0x18; | ||
17030 | spec->ext_mic.mux_idx = 0; | ||
17031 | spec->int_mic.pin = 0x19; | ||
17032 | spec->int_mic.mux_idx = 1; | ||
17033 | spec->auto_mic = 1; | ||
17034 | } | ||
17035 | |||
16775 | #define alc663_mode1_inithook alc663_m51va_inithook | 17036 | #define alc663_mode1_inithook alc663_m51va_inithook |
16776 | 17037 | ||
16777 | /* ***************** Mode2 ******************************/ | 17038 | /* ***************** Mode2 ******************************/ |
@@ -16788,7 +17049,7 @@ static void alc662_mode2_unsol_event(struct hda_codec *codec, | |||
16788 | } | 17049 | } |
16789 | } | 17050 | } |
16790 | 17051 | ||
16791 | #define alc662_mode2_setup alc663_m51va_setup | 17052 | #define alc662_mode2_setup alc663_mode1_setup |
16792 | 17053 | ||
16793 | static void alc662_mode2_inithook(struct hda_codec *codec) | 17054 | static void alc662_mode2_inithook(struct hda_codec *codec) |
16794 | { | 17055 | { |
@@ -16809,7 +17070,7 @@ static void alc663_mode3_unsol_event(struct hda_codec *codec, | |||
16809 | } | 17070 | } |
16810 | } | 17071 | } |
16811 | 17072 | ||
16812 | #define alc663_mode3_setup alc663_m51va_setup | 17073 | #define alc663_mode3_setup alc663_mode1_setup |
16813 | 17074 | ||
16814 | static void alc663_mode3_inithook(struct hda_codec *codec) | 17075 | static void alc663_mode3_inithook(struct hda_codec *codec) |
16815 | { | 17076 | { |
@@ -16830,7 +17091,7 @@ static void alc663_mode4_unsol_event(struct hda_codec *codec, | |||
16830 | } | 17091 | } |
16831 | } | 17092 | } |
16832 | 17093 | ||
16833 | #define alc663_mode4_setup alc663_m51va_setup | 17094 | #define alc663_mode4_setup alc663_mode1_setup |
16834 | 17095 | ||
16835 | static void alc663_mode4_inithook(struct hda_codec *codec) | 17096 | static void alc663_mode4_inithook(struct hda_codec *codec) |
16836 | { | 17097 | { |
@@ -16851,7 +17112,7 @@ static void alc663_mode5_unsol_event(struct hda_codec *codec, | |||
16851 | } | 17112 | } |
16852 | } | 17113 | } |
16853 | 17114 | ||
16854 | #define alc663_mode5_setup alc663_m51va_setup | 17115 | #define alc663_mode5_setup alc663_mode1_setup |
16855 | 17116 | ||
16856 | static void alc663_mode5_inithook(struct hda_codec *codec) | 17117 | static void alc663_mode5_inithook(struct hda_codec *codec) |
16857 | { | 17118 | { |
@@ -16872,7 +17133,7 @@ static void alc663_mode6_unsol_event(struct hda_codec *codec, | |||
16872 | } | 17133 | } |
16873 | } | 17134 | } |
16874 | 17135 | ||
16875 | #define alc663_mode6_setup alc663_m51va_setup | 17136 | #define alc663_mode6_setup alc663_mode1_setup |
16876 | 17137 | ||
16877 | static void alc663_mode6_inithook(struct hda_codec *codec) | 17138 | static void alc663_mode6_inithook(struct hda_codec *codec) |
16878 | { | 17139 | { |
@@ -16880,6 +17141,50 @@ static void alc663_mode6_inithook(struct hda_codec *codec) | |||
16880 | alc_mic_automute(codec); | 17141 | alc_mic_automute(codec); |
16881 | } | 17142 | } |
16882 | 17143 | ||
17144 | /* ***************** Mode7 ******************************/ | ||
17145 | static void alc663_mode7_unsol_event(struct hda_codec *codec, | ||
17146 | unsigned int res) | ||
17147 | { | ||
17148 | switch (res >> 26) { | ||
17149 | case ALC880_HP_EVENT: | ||
17150 | alc663_two_hp_m7_speaker_automute(codec); | ||
17151 | break; | ||
17152 | case ALC880_MIC_EVENT: | ||
17153 | alc_mic_automute(codec); | ||
17154 | break; | ||
17155 | } | ||
17156 | } | ||
17157 | |||
17158 | #define alc663_mode7_setup alc663_mode1_setup | ||
17159 | |||
17160 | static void alc663_mode7_inithook(struct hda_codec *codec) | ||
17161 | { | ||
17162 | alc663_two_hp_m7_speaker_automute(codec); | ||
17163 | alc_mic_automute(codec); | ||
17164 | } | ||
17165 | |||
17166 | /* ***************** Mode8 ******************************/ | ||
17167 | static void alc663_mode8_unsol_event(struct hda_codec *codec, | ||
17168 | unsigned int res) | ||
17169 | { | ||
17170 | switch (res >> 26) { | ||
17171 | case ALC880_HP_EVENT: | ||
17172 | alc663_two_hp_m8_speaker_automute(codec); | ||
17173 | break; | ||
17174 | case ALC880_MIC_EVENT: | ||
17175 | alc_mic_automute(codec); | ||
17176 | break; | ||
17177 | } | ||
17178 | } | ||
17179 | |||
17180 | #define alc663_mode8_setup alc663_m51va_setup | ||
17181 | |||
17182 | static void alc663_mode8_inithook(struct hda_codec *codec) | ||
17183 | { | ||
17184 | alc663_two_hp_m8_speaker_automute(codec); | ||
17185 | alc_mic_automute(codec); | ||
17186 | } | ||
17187 | |||
16883 | static void alc663_g71v_hp_automute(struct hda_codec *codec) | 17188 | static void alc663_g71v_hp_automute(struct hda_codec *codec) |
16884 | { | 17189 | { |
16885 | unsigned int present; | 17190 | unsigned int present; |
@@ -17014,6 +17319,8 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
17014 | [ALC663_ASUS_MODE4] = "asus-mode4", | 17319 | [ALC663_ASUS_MODE4] = "asus-mode4", |
17015 | [ALC663_ASUS_MODE5] = "asus-mode5", | 17320 | [ALC663_ASUS_MODE5] = "asus-mode5", |
17016 | [ALC663_ASUS_MODE6] = "asus-mode6", | 17321 | [ALC663_ASUS_MODE6] = "asus-mode6", |
17322 | [ALC663_ASUS_MODE7] = "asus-mode7", | ||
17323 | [ALC663_ASUS_MODE8] = "asus-mode8", | ||
17017 | [ALC272_DELL] = "dell", | 17324 | [ALC272_DELL] = "dell", |
17018 | [ALC272_DELL_ZM1] = "dell-zm1", | 17325 | [ALC272_DELL_ZM1] = "dell-zm1", |
17019 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", | 17326 | [ALC272_SAMSUNG_NC10] = "samsung-nc10", |
@@ -17030,12 +17337,22 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = { | |||
17030 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | 17337 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
17031 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | 17338 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), |
17032 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | 17339 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
17340 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC663_ASUS_MODE1), | ||
17341 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC663_ASUS_MODE1), | ||
17033 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | 17342 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
17343 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC663_ASUS_MODE7), | ||
17344 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC663_ASUS_MODE7), | ||
17345 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC663_ASUS_MODE8), | ||
17346 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC663_ASUS_MODE3), | ||
17347 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC663_ASUS_MODE1), | ||
17034 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | 17348 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
17349 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_ASUS_MODE2), | ||
17350 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC663_ASUS_MODE1), | ||
17035 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | 17351 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
17036 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | 17352 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), |
17037 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | 17353 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), |
17038 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | 17354 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), |
17355 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC663_ASUS_MODE1), | ||
17039 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), | 17356 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), |
17040 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), | 17357 | SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), |
17041 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), | 17358 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), |
@@ -17319,6 +17636,36 @@ static struct alc_config_preset alc662_presets[] = { | |||
17319 | .setup = alc663_mode6_setup, | 17636 | .setup = alc663_mode6_setup, |
17320 | .init_hook = alc663_mode6_inithook, | 17637 | .init_hook = alc663_mode6_inithook, |
17321 | }, | 17638 | }, |
17639 | [ALC663_ASUS_MODE7] = { | ||
17640 | .mixers = { alc663_mode7_mixer }, | ||
17641 | .cap_mixer = alc662_auto_capture_mixer, | ||
17642 | .init_verbs = { alc662_init_verbs, | ||
17643 | alc663_mode7_init_verbs }, | ||
17644 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
17645 | .hp_nid = 0x03, | ||
17646 | .dac_nids = alc662_dac_nids, | ||
17647 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
17648 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
17649 | .channel_mode = alc662_3ST_2ch_modes, | ||
17650 | .unsol_event = alc663_mode7_unsol_event, | ||
17651 | .setup = alc663_mode7_setup, | ||
17652 | .init_hook = alc663_mode7_inithook, | ||
17653 | }, | ||
17654 | [ALC663_ASUS_MODE8] = { | ||
17655 | .mixers = { alc663_mode8_mixer }, | ||
17656 | .cap_mixer = alc662_auto_capture_mixer, | ||
17657 | .init_verbs = { alc662_init_verbs, | ||
17658 | alc663_mode8_init_verbs }, | ||
17659 | .num_dacs = ARRAY_SIZE(alc662_dac_nids), | ||
17660 | .hp_nid = 0x03, | ||
17661 | .dac_nids = alc662_dac_nids, | ||
17662 | .dig_out_nid = ALC662_DIGOUT_NID, | ||
17663 | .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), | ||
17664 | .channel_mode = alc662_3ST_2ch_modes, | ||
17665 | .unsol_event = alc663_mode8_unsol_event, | ||
17666 | .setup = alc663_mode8_setup, | ||
17667 | .init_hook = alc663_mode8_inithook, | ||
17668 | }, | ||
17322 | [ALC272_DELL] = { | 17669 | [ALC272_DELL] = { |
17323 | .mixers = { alc663_m51va_mixer }, | 17670 | .mixers = { alc663_m51va_mixer }, |
17324 | .cap_mixer = alc272_auto_capture_mixer, | 17671 | .cap_mixer = alc272_auto_capture_mixer, |
@@ -17802,7 +18149,9 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = { | |||
17802 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, | 18149 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
17803 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, | 18150 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
17804 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, | 18151 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
18152 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, | ||
17805 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, | 18153 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
18154 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, | ||
17806 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", | 18155 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
17807 | .patch = patch_alc861 }, | 18156 | .patch = patch_alc861 }, |
17808 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, | 18157 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 0bafea9d5106..e28c810bc00c 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -2104,6 +2104,7 @@ static unsigned int ref9205_pin_configs[12] = { | |||
2104 | 10280204 | 2104 | 10280204 |
2105 | 1028021F | 2105 | 1028021F |
2106 | 10280228 (Dell Vostro 1500) | 2106 | 10280228 (Dell Vostro 1500) |
2107 | 10280229 (Dell Vostro 1700) | ||
2107 | */ | 2108 | */ |
2108 | static unsigned int dell_9205_m42_pin_configs[12] = { | 2109 | static unsigned int dell_9205_m42_pin_configs[12] = { |
2109 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, | 2110 | 0x0321101F, 0x03A11020, 0x400003FA, 0x90170310, |
@@ -2189,6 +2190,8 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { | |||
2189 | "Dell Inspiron", STAC_9205_DELL_M44), | 2190 | "Dell Inspiron", STAC_9205_DELL_M44), |
2190 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, | 2191 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
2191 | "Dell Vostro 1500", STAC_9205_DELL_M42), | 2192 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
2193 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0229, | ||
2194 | "Dell Vostro 1700", STAC_9205_DELL_M42), | ||
2192 | /* Gateway */ | 2195 | /* Gateway */ |
2193 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), | 2196 | SND_PCI_QUIRK(0x107b, 0x0560, "Gateway T6834c", STAC_9205_EAPD), |
2194 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), | 2197 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), |
@@ -3778,15 +3781,16 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3778 | err = snd_hda_attach_beep_device(codec, nid); | 3781 | err = snd_hda_attach_beep_device(codec, nid); |
3779 | if (err < 0) | 3782 | if (err < 0) |
3780 | return err; | 3783 | return err; |
3781 | /* IDT/STAC codecs have linear beep tone parameter */ | 3784 | if (codec->beep) { |
3782 | codec->beep->linear_tone = 1; | 3785 | /* IDT/STAC codecs have linear beep tone parameter */ |
3783 | /* if no beep switch is available, make its own one */ | 3786 | codec->beep->linear_tone = 1; |
3784 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | 3787 | /* if no beep switch is available, make its own one */ |
3785 | if (codec->beep && | 3788 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); |
3786 | !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { | 3789 | if (!(caps & AC_AMPCAP_MUTE)) { |
3787 | err = stac92xx_beep_switch_ctl(codec); | 3790 | err = stac92xx_beep_switch_ctl(codec); |
3788 | if (err < 0) | 3791 | if (err < 0) |
3789 | return err; | 3792 | return err; |
3793 | } | ||
3790 | } | 3794 | } |
3791 | } | 3795 | } |
3792 | #endif | 3796 | #endif |
@@ -4155,34 +4159,52 @@ static void stac92xx_power_down(struct hda_codec *codec) | |||
4155 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | 4159 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
4156 | int enable); | 4160 | int enable); |
4157 | 4161 | ||
4162 | static inline int get_int_hint(struct hda_codec *codec, const char *key, | ||
4163 | int *valp) | ||
4164 | { | ||
4165 | const char *p; | ||
4166 | p = snd_hda_get_hint(codec, key); | ||
4167 | if (p) { | ||
4168 | unsigned long val; | ||
4169 | if (!strict_strtoul(p, 0, &val)) { | ||
4170 | *valp = val; | ||
4171 | return 1; | ||
4172 | } | ||
4173 | } | ||
4174 | return 0; | ||
4175 | } | ||
4176 | |||
4158 | /* override some hints from the hwdep entry */ | 4177 | /* override some hints from the hwdep entry */ |
4159 | static void stac_store_hints(struct hda_codec *codec) | 4178 | static void stac_store_hints(struct hda_codec *codec) |
4160 | { | 4179 | { |
4161 | struct sigmatel_spec *spec = codec->spec; | 4180 | struct sigmatel_spec *spec = codec->spec; |
4162 | const char *p; | ||
4163 | int val; | 4181 | int val; |
4164 | 4182 | ||
4165 | val = snd_hda_get_bool_hint(codec, "hp_detect"); | 4183 | val = snd_hda_get_bool_hint(codec, "hp_detect"); |
4166 | if (val >= 0) | 4184 | if (val >= 0) |
4167 | spec->hp_detect = val; | 4185 | spec->hp_detect = val; |
4168 | p = snd_hda_get_hint(codec, "gpio_mask"); | 4186 | if (get_int_hint(codec, "gpio_mask", &spec->gpio_mask)) { |
4169 | if (p) { | ||
4170 | spec->gpio_mask = simple_strtoul(p, NULL, 0); | ||
4171 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = | 4187 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = |
4172 | spec->gpio_mask; | 4188 | spec->gpio_mask; |
4173 | } | 4189 | } |
4174 | p = snd_hda_get_hint(codec, "gpio_dir"); | 4190 | if (get_int_hint(codec, "gpio_dir", &spec->gpio_dir)) |
4175 | if (p) | 4191 | spec->gpio_mask &= spec->gpio_mask; |
4176 | spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | 4192 | if (get_int_hint(codec, "gpio_data", &spec->gpio_data)) |
4177 | p = snd_hda_get_hint(codec, "gpio_data"); | 4193 | spec->gpio_dir &= spec->gpio_mask; |
4178 | if (p) | 4194 | if (get_int_hint(codec, "eapd_mask", &spec->eapd_mask)) |
4179 | spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | 4195 | spec->eapd_mask &= spec->gpio_mask; |
4180 | p = snd_hda_get_hint(codec, "eapd_mask"); | 4196 | if (get_int_hint(codec, "gpio_mute", &spec->gpio_mute)) |
4181 | if (p) | 4197 | spec->gpio_mute &= spec->gpio_mask; |
4182 | spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | ||
4183 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); | 4198 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); |
4184 | if (val >= 0) | 4199 | if (val >= 0) |
4185 | spec->eapd_switch = val; | 4200 | spec->eapd_switch = val; |
4201 | get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); | ||
4202 | if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { | ||
4203 | spec->gpio_mask |= spec->gpio_led; | ||
4204 | spec->gpio_dir |= spec->gpio_led; | ||
4205 | if (spec->gpio_led_polarity) | ||
4206 | spec->gpio_data |= spec->gpio_led; | ||
4207 | } | ||
4186 | } | 4208 | } |
4187 | 4209 | ||
4188 | static int stac92xx_init(struct hda_codec *codec) | 4210 | static int stac92xx_init(struct hda_codec *codec) |
@@ -4367,18 +4389,8 @@ static void stac92xx_free_kctls(struct hda_codec *codec) | |||
4367 | static void stac92xx_shutup(struct hda_codec *codec) | 4389 | static void stac92xx_shutup(struct hda_codec *codec) |
4368 | { | 4390 | { |
4369 | struct sigmatel_spec *spec = codec->spec; | 4391 | struct sigmatel_spec *spec = codec->spec; |
4370 | int i; | ||
4371 | hda_nid_t nid; | ||
4372 | 4392 | ||
4373 | /* reset each pin before powering down DAC/ADC to avoid click noise */ | 4393 | snd_hda_shutup_pins(codec); |
4374 | nid = codec->start_nid; | ||
4375 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
4376 | unsigned int wcaps = get_wcaps(codec, nid); | ||
4377 | unsigned int wid_type = get_wcaps_type(wcaps); | ||
4378 | if (wid_type == AC_WID_PIN) | ||
4379 | snd_hda_codec_read(codec, nid, 0, | ||
4380 | AC_VERB_SET_PIN_WIDGET_CONTROL, 0); | ||
4381 | } | ||
4382 | 4394 | ||
4383 | if (spec->eapd_mask) | 4395 | if (spec->eapd_mask) |
4384 | stac_gpio_set(codec, spec->gpio_mask, | 4396 | stac_gpio_set(codec, spec->gpio_mask, |
@@ -5402,6 +5414,54 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, | |||
5402 | return 0; | 5414 | return 0; |
5403 | } | 5415 | } |
5404 | 5416 | ||
5417 | /* HP dv7 bass switch - GPIO5 */ | ||
5418 | #define stac_hp_bass_gpio_info snd_ctl_boolean_mono_info | ||
5419 | static int stac_hp_bass_gpio_get(struct snd_kcontrol *kcontrol, | ||
5420 | struct snd_ctl_elem_value *ucontrol) | ||
5421 | { | ||
5422 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
5423 | struct sigmatel_spec *spec = codec->spec; | ||
5424 | ucontrol->value.integer.value[0] = !!(spec->gpio_data & 0x20); | ||
5425 | return 0; | ||
5426 | } | ||
5427 | |||
5428 | static int stac_hp_bass_gpio_put(struct snd_kcontrol *kcontrol, | ||
5429 | struct snd_ctl_elem_value *ucontrol) | ||
5430 | { | ||
5431 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | ||
5432 | struct sigmatel_spec *spec = codec->spec; | ||
5433 | unsigned int gpio_data; | ||
5434 | |||
5435 | gpio_data = (spec->gpio_data & ~0x20) | | ||
5436 | (ucontrol->value.integer.value[0] ? 0x20 : 0); | ||
5437 | if (gpio_data == spec->gpio_data) | ||
5438 | return 0; | ||
5439 | spec->gpio_data = gpio_data; | ||
5440 | stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data); | ||
5441 | return 1; | ||
5442 | } | ||
5443 | |||
5444 | static struct snd_kcontrol_new stac_hp_bass_sw_ctrl = { | ||
5445 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
5446 | .info = stac_hp_bass_gpio_info, | ||
5447 | .get = stac_hp_bass_gpio_get, | ||
5448 | .put = stac_hp_bass_gpio_put, | ||
5449 | }; | ||
5450 | |||
5451 | static int stac_add_hp_bass_switch(struct hda_codec *codec) | ||
5452 | { | ||
5453 | struct sigmatel_spec *spec = codec->spec; | ||
5454 | |||
5455 | if (!stac_control_new(spec, &stac_hp_bass_sw_ctrl, | ||
5456 | "Bass Speaker Playback Switch", 0)) | ||
5457 | return -ENOMEM; | ||
5458 | |||
5459 | spec->gpio_mask |= 0x20; | ||
5460 | spec->gpio_dir |= 0x20; | ||
5461 | spec->gpio_data |= 0x20; | ||
5462 | return 0; | ||
5463 | } | ||
5464 | |||
5405 | static int patch_stac92hd71bxx(struct hda_codec *codec) | 5465 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
5406 | { | 5466 | { |
5407 | struct sigmatel_spec *spec; | 5467 | struct sigmatel_spec *spec; |
@@ -5642,6 +5702,15 @@ again: | |||
5642 | return err; | 5702 | return err; |
5643 | } | 5703 | } |
5644 | 5704 | ||
5705 | /* enable bass on HP dv7 */ | ||
5706 | if (spec->board_config == STAC_HP_DV5) { | ||
5707 | unsigned int cap; | ||
5708 | cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP); | ||
5709 | cap &= AC_GPIO_IO_COUNT; | ||
5710 | if (cap >= 6) | ||
5711 | stac_add_hp_bass_switch(codec); | ||
5712 | } | ||
5713 | |||
5645 | codec->proc_widget_hook = stac92hd7x_proc_hook; | 5714 | codec->proc_widget_hook = stac92hd7x_proc_hook; |
5646 | 5715 | ||
5647 | return 0; | 5716 | return 0; |
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index de4839e46762..9ddc37300f6b 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1907,8 +1907,7 @@ static int via_build_controls(struct hda_codec *codec) | |||
1907 | /* assign Capture Source enums to NID */ | 1907 | /* assign Capture Source enums to NID */ |
1908 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); | 1908 | kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); |
1909 | for (i = 0; kctl && i < kctl->count; i++) { | 1909 | for (i = 0; kctl && i < kctl->count; i++) { |
1910 | err = snd_hda_add_nids(codec, kctl, i, spec->mux_nids, | 1910 | err = snd_hda_add_nid(codec, kctl, i, spec->mux_nids[i]); |
1911 | spec->input_mux->num_items); | ||
1912 | if (err < 0) | 1911 | if (err < 0) |
1913 | return err; | 1912 | return err; |
1914 | } | 1913 | } |