Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 4 | * HD audio interface patch for Realtek ALC codecs |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 5 | * |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 6 | * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw> |
| 7 | * PeiSen Hou <pshou@realtek.com.tw> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 8 | * Takashi Iwai <tiwai@suse.de> |
Jonathan Woithe | 409a3e9 | 2012-03-27 13:01:01 +1030 | [diff] [blame] | 9 | * Jonathan Woithe <jwoithe@just42.net> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | * |
| 11 | * This driver is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License as published by |
| 13 | * the Free Software Foundation; either version 2 of the License, or |
| 14 | * (at your option) any later version. |
| 15 | * |
| 16 | * This driver is distributed in the hope that it will be useful, |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | * GNU General Public License for more details. |
| 20 | * |
| 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software |
| 23 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | #include <linux/init.h> |
| 27 | #include <linux/delay.h> |
| 28 | #include <linux/slab.h> |
| 29 | #include <linux/pci.h> |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 30 | #include <linux/dmi.h> |
Paul Gortmaker | da155d5 | 2011-07-15 12:38:28 -0400 | [diff] [blame] | 31 | #include <linux/module.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | #include <sound/core.h> |
Kailang Yang | 9ad0e49 | 2010-09-14 23:22:00 +0200 | [diff] [blame] | 33 | #include <sound/jack.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 34 | #include "hda_codec.h" |
| 35 | #include "hda_local.h" |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 36 | #include "hda_auto_parser.h" |
Takashi Iwai | 1835a0f | 2011-10-27 22:12:46 +0200 | [diff] [blame] | 37 | #include "hda_jack.h" |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 38 | #include "hda_generic.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 40 | /* unsol event tags */ |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 41 | #define ALC_DCVOL_EVENT 0x08 |
Takashi Iwai | d4a86d8 | 2010-06-23 17:51:26 +0200 | [diff] [blame] | 42 | |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 43 | /* for GPIO Poll */ |
| 44 | #define GPIO_MASK 0x03 |
| 45 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 46 | /* extra amp-initialization sequence types */ |
| 47 | enum { |
| 48 | ALC_INIT_NONE, |
| 49 | ALC_INIT_DEFAULT, |
| 50 | ALC_INIT_GPIO1, |
| 51 | ALC_INIT_GPIO2, |
| 52 | ALC_INIT_GPIO3, |
| 53 | }; |
| 54 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 55 | struct alc_customize_define { |
| 56 | unsigned int sku_cfg; |
| 57 | unsigned char port_connectivity; |
| 58 | unsigned char check_sum; |
| 59 | unsigned char customization; |
| 60 | unsigned char external_amp; |
| 61 | unsigned int enable_pcbeep:1; |
| 62 | unsigned int platform_type:1; |
| 63 | unsigned int swap:1; |
| 64 | unsigned int override:1; |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 65 | unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 66 | }; |
| 67 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | struct alc_spec { |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 69 | struct hda_gen_spec gen; /* must be at head */ |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 70 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | /* codec parameterization */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 72 | const struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | unsigned int num_mixers; |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 74 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 76 | struct alc_customize_define cdefine; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 77 | unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */ |
| 78 | |
| 79 | /* inverted dmic fix */ |
| 80 | unsigned int inv_dmic_fixup:1; /* has inverted digital-mic workaround */ |
| 81 | unsigned int inv_dmic_muted:1; /* R-ch of inv d-mic is muted? */ |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 82 | hda_nid_t inv_dmic_pin; |
Takashi Iwai | 834be88 | 2006-03-01 14:16:17 +0100 | [diff] [blame] | 83 | |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 84 | /* mute LED for HP laptops, see alc269_fixup_mic_mute_hook() */ |
| 85 | int mute_led_polarity; |
| 86 | hda_nid_t mute_led_nid; |
| 87 | |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 88 | unsigned int gpio_led; /* used for alc269_fixup_hp_gpio_led() */ |
| 89 | |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 90 | /* hooks */ |
| 91 | void (*init_hook)(struct hda_codec *codec); |
Takashi Iwai | 83012a7 | 2012-08-24 18:38:08 +0200 | [diff] [blame] | 92 | #ifdef CONFIG_PM |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 93 | void (*power_hook)(struct hda_codec *codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 94 | #endif |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 95 | void (*shutup)(struct hda_codec *codec); |
Takashi Iwai | d922b51 | 2011-04-28 12:18:53 +0200 | [diff] [blame] | 96 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 97 | int init_amp; |
Takashi Iwai | d433a67 | 2010-09-20 15:11:54 +0200 | [diff] [blame] | 98 | int codec_variant; /* flag for other variants */ |
Takashi Iwai | e64f14f | 2009-01-20 18:32:55 +0100 | [diff] [blame] | 99 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 100 | /* for PLL fix */ |
| 101 | hda_nid_t pll_nid; |
| 102 | unsigned int pll_coef_idx, pll_coef_bit; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 103 | unsigned int coef0; |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 104 | }; |
| 105 | |
Takashi Iwai | 23f0c04 | 2009-02-26 13:03:58 +0100 | [diff] [blame] | 106 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 107 | * Append the given mixer and verb elements for the later use |
| 108 | * The mixer array is referred in build_controls(), and init_verbs are |
| 109 | * called in init(). |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 110 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 111 | static void add_mixer(struct alc_spec *spec, const struct snd_kcontrol_new *mix) |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 112 | { |
| 113 | if (snd_BUG_ON(spec->num_mixers >= ARRAY_SIZE(spec->mixers))) |
| 114 | return; |
| 115 | spec->mixers[spec->num_mixers++] = mix; |
| 116 | } |
| 117 | |
Takashi Iwai | d88897e | 2008-10-31 15:01:37 +0100 | [diff] [blame] | 118 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 119 | * GPIO setup tables, used in initialization |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 120 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 121 | /* Enable GPIO mask and set output */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 122 | static const struct hda_verb alc_gpio1_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 123 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, |
| 124 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 125 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 126 | { } |
| 127 | }; |
| 128 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 129 | static const struct hda_verb alc_gpio2_init_verbs[] = { |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 130 | {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, |
| 131 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, |
| 132 | {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, |
| 133 | { } |
| 134 | }; |
| 135 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 136 | static const struct hda_verb alc_gpio3_init_verbs[] = { |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 137 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 138 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, |
| 139 | {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, |
| 140 | { } |
| 141 | }; |
| 142 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 143 | /* |
| 144 | * Fix hardware PLL issue |
| 145 | * On some codecs, the analog PLL gating control must be off while |
| 146 | * the default value is 1. |
| 147 | */ |
| 148 | static void alc_fix_pll(struct hda_codec *codec) |
| 149 | { |
| 150 | struct alc_spec *spec = codec->spec; |
| 151 | unsigned int val; |
| 152 | |
| 153 | if (!spec->pll_nid) |
| 154 | return; |
| 155 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 156 | spec->pll_coef_idx); |
| 157 | val = snd_hda_codec_read(codec, spec->pll_nid, 0, |
| 158 | AC_VERB_GET_PROC_COEF, 0); |
| 159 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, |
| 160 | spec->pll_coef_idx); |
| 161 | snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, |
| 162 | val & ~(1 << spec->pll_coef_bit)); |
| 163 | } |
| 164 | |
| 165 | static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, |
| 166 | unsigned int coef_idx, unsigned int coef_bit) |
| 167 | { |
| 168 | struct alc_spec *spec = codec->spec; |
| 169 | spec->pll_nid = nid; |
| 170 | spec->pll_coef_idx = coef_idx; |
| 171 | spec->pll_coef_bit = coef_bit; |
| 172 | alc_fix_pll(codec); |
| 173 | } |
| 174 | |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 175 | /* update the master volume per volume-knob's unsol event */ |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 176 | static void alc_update_knob_master(struct hda_codec *codec, struct hda_jack_tbl *jack) |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 177 | { |
| 178 | unsigned int val; |
| 179 | struct snd_kcontrol *kctl; |
| 180 | struct snd_ctl_elem_value *uctl; |
| 181 | |
| 182 | kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); |
| 183 | if (!kctl) |
| 184 | return; |
| 185 | uctl = kzalloc(sizeof(*uctl), GFP_KERNEL); |
| 186 | if (!uctl) |
| 187 | return; |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 188 | val = snd_hda_codec_read(codec, jack->nid, 0, |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 189 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 190 | val &= HDA_AMP_VOLMASK; |
| 191 | uctl->value.integer.value[0] = val; |
| 192 | uctl->value.integer.value[1] = val; |
| 193 | kctl->put(kctl, uctl); |
| 194 | kfree(uctl); |
| 195 | } |
| 196 | |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 197 | static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) |
Takashi Iwai | f21d78e | 2012-01-19 12:10:29 +0100 | [diff] [blame] | 198 | { |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 199 | /* For some reason, the res given from ALC880 is broken. |
| 200 | Here we adjust it properly. */ |
| 201 | snd_hda_jack_unsol_event(codec, res >> 2); |
Takashi Iwai | f21d78e | 2012-01-19 12:10:29 +0100 | [diff] [blame] | 202 | } |
| 203 | |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 204 | /* additional initialization for ALC888 variants */ |
| 205 | static void alc888_coef_init(struct hda_codec *codec) |
| 206 | { |
| 207 | unsigned int tmp; |
| 208 | |
| 209 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
| 210 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 211 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
Takashi Iwai | 37db623 | 2009-03-05 09:40:16 +0100 | [diff] [blame] | 212 | if ((tmp & 0xf0) == 0x20) |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 213 | /* alc888S-VC */ |
| 214 | snd_hda_codec_read(codec, 0x20, 0, |
| 215 | AC_VERB_SET_PROC_COEF, 0x830); |
| 216 | else |
| 217 | /* alc888-VB */ |
| 218 | snd_hda_codec_read(codec, 0x20, 0, |
| 219 | AC_VERB_SET_PROC_COEF, 0x3030); |
| 220 | } |
| 221 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 222 | /* additional initialization for ALC889 variants */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 223 | static void alc889_coef_init(struct hda_codec *codec) |
| 224 | { |
| 225 | unsigned int tmp; |
| 226 | |
| 227 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 228 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 229 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 230 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); |
| 231 | } |
| 232 | |
Takashi Iwai | 3fb4a50 | 2010-01-19 15:46:37 +0100 | [diff] [blame] | 233 | /* turn on/off EAPD control (only if available) */ |
| 234 | static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) |
| 235 | { |
| 236 | if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) |
| 237 | return; |
| 238 | if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) |
| 239 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, |
| 240 | on ? 2 : 0); |
| 241 | } |
| 242 | |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 243 | /* turn on/off EAPD controls of the codec */ |
| 244 | static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) |
| 245 | { |
| 246 | /* We currently only handle front, HP */ |
Takashi Iwai | 39fa84e | 2011-06-27 15:28:57 +0200 | [diff] [blame] | 247 | static hda_nid_t pins[] = { |
| 248 | 0x0f, 0x10, 0x14, 0x15, 0 |
| 249 | }; |
| 250 | hda_nid_t *p; |
| 251 | for (p = pins; *p; p++) |
| 252 | set_eapd(codec, *p, on); |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 253 | } |
| 254 | |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 255 | /* generic shutup callback; |
| 256 | * just turning off EPAD and a little pause for avoiding pop-noise |
| 257 | */ |
| 258 | static void alc_eapd_shutup(struct hda_codec *codec) |
| 259 | { |
| 260 | alc_auto_setup_eapd(codec, false); |
| 261 | msleep(200); |
| 262 | } |
| 263 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 264 | /* generic EAPD initialization */ |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 265 | static void alc_auto_init_amp(struct hda_codec *codec, int type) |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 266 | { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 267 | unsigned int tmp; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 268 | |
Takashi Iwai | 39fa84e | 2011-06-27 15:28:57 +0200 | [diff] [blame] | 269 | alc_auto_setup_eapd(codec, true); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 270 | switch (type) { |
| 271 | case ALC_INIT_GPIO1: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 272 | snd_hda_sequence_write(codec, alc_gpio1_init_verbs); |
| 273 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 274 | case ALC_INIT_GPIO2: |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 275 | snd_hda_sequence_write(codec, alc_gpio2_init_verbs); |
| 276 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 277 | case ALC_INIT_GPIO3: |
Kailang Yang | bdd148a | 2007-05-08 15:19:08 +0200 | [diff] [blame] | 278 | snd_hda_sequence_write(codec, alc_gpio3_init_verbs); |
| 279 | break; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 280 | case ALC_INIT_DEFAULT: |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 281 | switch (codec->vendor_id) { |
| 282 | case 0x10ec0260: |
| 283 | snd_hda_codec_write(codec, 0x1a, 0, |
| 284 | AC_VERB_SET_COEF_INDEX, 7); |
| 285 | tmp = snd_hda_codec_read(codec, 0x1a, 0, |
| 286 | AC_VERB_GET_PROC_COEF, 0); |
| 287 | snd_hda_codec_write(codec, 0x1a, 0, |
| 288 | AC_VERB_SET_COEF_INDEX, 7); |
| 289 | snd_hda_codec_write(codec, 0x1a, 0, |
| 290 | AC_VERB_SET_PROC_COEF, |
| 291 | tmp | 0x2010); |
| 292 | break; |
| 293 | case 0x10ec0262: |
| 294 | case 0x10ec0880: |
| 295 | case 0x10ec0882: |
| 296 | case 0x10ec0883: |
| 297 | case 0x10ec0885: |
Takashi Iwai | 4a5a4c5 | 2009-02-06 12:46:59 +0100 | [diff] [blame] | 298 | case 0x10ec0887: |
Takashi Iwai | 20b67dd | 2011-03-23 22:54:32 +0100 | [diff] [blame] | 299 | /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ |
Jaroslav Kysela | 87a8c37 | 2009-07-23 10:58:29 +0200 | [diff] [blame] | 300 | alc889_coef_init(codec); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 301 | break; |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 302 | case 0x10ec0888: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 303 | alc888_coef_init(codec); |
Kailang Yang | f9423e7 | 2008-05-27 12:32:25 +0200 | [diff] [blame] | 304 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 305 | #if 0 /* XXX: This may cause the silent output on speaker on some machines */ |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 306 | case 0x10ec0267: |
| 307 | case 0x10ec0268: |
| 308 | snd_hda_codec_write(codec, 0x20, 0, |
| 309 | AC_VERB_SET_COEF_INDEX, 7); |
| 310 | tmp = snd_hda_codec_read(codec, 0x20, 0, |
| 311 | AC_VERB_GET_PROC_COEF, 0); |
| 312 | snd_hda_codec_write(codec, 0x20, 0, |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 313 | AC_VERB_SET_COEF_INDEX, 7); |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 314 | snd_hda_codec_write(codec, 0x20, 0, |
| 315 | AC_VERB_SET_PROC_COEF, |
| 316 | tmp | 0x3000); |
| 317 | break; |
Takashi Iwai | 0aea778 | 2010-01-25 15:44:11 +0100 | [diff] [blame] | 318 | #endif /* XXX */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 319 | } |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 320 | break; |
| 321 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 322 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 323 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 324 | |
| 325 | /* |
| 326 | * Realtek SSID verification |
| 327 | */ |
| 328 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 329 | /* Could be any non-zero and even value. When used as fixup, tells |
| 330 | * the driver to ignore any present sku defines. |
| 331 | */ |
| 332 | #define ALC_FIXUP_SKU_IGNORE (2) |
| 333 | |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 334 | static void alc_fixup_sku_ignore(struct hda_codec *codec, |
| 335 | const struct hda_fixup *fix, int action) |
| 336 | { |
| 337 | struct alc_spec *spec = codec->spec; |
| 338 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 339 | spec->cdefine.fixup = 1; |
| 340 | spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; |
| 341 | } |
| 342 | } |
| 343 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 344 | static int alc_auto_parse_customize_define(struct hda_codec *codec) |
| 345 | { |
| 346 | unsigned int ass, tmp, i; |
Takashi Iwai | 7fb5622 | 2010-03-22 17:09:47 +0100 | [diff] [blame] | 347 | unsigned nid = 0; |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 348 | struct alc_spec *spec = codec->spec; |
| 349 | |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 350 | spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ |
| 351 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 352 | if (spec->cdefine.fixup) { |
| 353 | ass = spec->cdefine.sku_cfg; |
| 354 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 355 | return -1; |
| 356 | goto do_sku; |
| 357 | } |
| 358 | |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 359 | ass = codec->subsystem_id & 0xffff; |
Takashi Iwai | b6cbe51 | 2010-07-28 17:43:36 +0200 | [diff] [blame] | 360 | if (ass != codec->bus->pci->subsystem_device && (ass & 1)) |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 361 | goto do_sku; |
| 362 | |
| 363 | nid = 0x1d; |
| 364 | if (codec->vendor_id == 0x10ec0260) |
| 365 | nid = 0x17; |
| 366 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 367 | |
| 368 | if (!(ass & 1)) { |
| 369 | printk(KERN_INFO "hda_codec: %s: SKU not ready 0x%08x\n", |
| 370 | codec->chip_name, ass); |
| 371 | return -1; |
| 372 | } |
| 373 | |
| 374 | /* check sum */ |
| 375 | tmp = 0; |
| 376 | for (i = 1; i < 16; i++) { |
| 377 | if ((ass >> i) & 1) |
| 378 | tmp++; |
| 379 | } |
| 380 | if (((ass >> 16) & 0xf) != tmp) |
| 381 | return -1; |
| 382 | |
| 383 | spec->cdefine.port_connectivity = ass >> 30; |
| 384 | spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; |
| 385 | spec->cdefine.check_sum = (ass >> 16) & 0xf; |
| 386 | spec->cdefine.customization = ass >> 8; |
| 387 | do_sku: |
| 388 | spec->cdefine.sku_cfg = ass; |
| 389 | spec->cdefine.external_amp = (ass & 0x38) >> 3; |
| 390 | spec->cdefine.platform_type = (ass & 0x4) >> 2; |
| 391 | spec->cdefine.swap = (ass & 0x2) >> 1; |
| 392 | spec->cdefine.override = ass & 0x1; |
| 393 | |
| 394 | snd_printd("SKU: Nid=0x%x sku_cfg=0x%08x\n", |
| 395 | nid, spec->cdefine.sku_cfg); |
| 396 | snd_printd("SKU: port_connectivity=0x%x\n", |
| 397 | spec->cdefine.port_connectivity); |
| 398 | snd_printd("SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); |
| 399 | snd_printd("SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); |
| 400 | snd_printd("SKU: customization=0x%08x\n", spec->cdefine.customization); |
| 401 | snd_printd("SKU: external_amp=0x%x\n", spec->cdefine.external_amp); |
| 402 | snd_printd("SKU: platform_type=0x%x\n", spec->cdefine.platform_type); |
| 403 | snd_printd("SKU: swap=0x%x\n", spec->cdefine.swap); |
| 404 | snd_printd("SKU: override=0x%x\n", spec->cdefine.override); |
| 405 | |
| 406 | return 0; |
| 407 | } |
| 408 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 409 | /* return the position of NID in the list, or -1 if not found */ |
| 410 | static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
| 411 | { |
| 412 | int i; |
| 413 | for (i = 0; i < nums; i++) |
| 414 | if (list[i] == nid) |
| 415 | return i; |
| 416 | return -1; |
| 417 | } |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 418 | /* return true if the given NID is found in the list */ |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 419 | static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums) |
| 420 | { |
Takashi Iwai | 2126896 | 2011-07-07 15:01:13 +0200 | [diff] [blame] | 421 | return find_idx_in_nid_list(nid, list, nums) >= 0; |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 422 | } |
| 423 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 424 | /* check subsystem ID and set up device-specific initialization; |
| 425 | * return 1 if initialized, 0 if invalid SSID |
| 426 | */ |
| 427 | /* 32-bit subsystem ID for BIOS loading in HD Audio codec. |
| 428 | * 31 ~ 16 : Manufacture ID |
| 429 | * 15 ~ 8 : SKU ID |
| 430 | * 7 ~ 0 : Assembly ID |
| 431 | * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36 |
| 432 | */ |
| 433 | static int alc_subsystem_id(struct hda_codec *codec, |
| 434 | hda_nid_t porta, hda_nid_t porte, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 435 | hda_nid_t portd, hda_nid_t porti) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 436 | { |
| 437 | unsigned int ass, tmp, i; |
| 438 | unsigned nid; |
| 439 | struct alc_spec *spec = codec->spec; |
| 440 | |
David Henningsson | 9062291 | 2010-10-14 14:50:18 +0200 | [diff] [blame] | 441 | if (spec->cdefine.fixup) { |
| 442 | ass = spec->cdefine.sku_cfg; |
| 443 | if (ass == ALC_FIXUP_SKU_IGNORE) |
| 444 | return 0; |
| 445 | goto do_sku; |
| 446 | } |
| 447 | |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 448 | ass = codec->subsystem_id & 0xffff; |
| 449 | if ((ass != codec->bus->pci->subsystem_device) && (ass & 1)) |
| 450 | goto do_sku; |
| 451 | |
| 452 | /* invalid SSID, check the special NID pin defcfg instead */ |
| 453 | /* |
Sasha Alexandr | def319f | 2009-06-16 16:00:15 -0400 | [diff] [blame] | 454 | * 31~30 : port connectivity |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 455 | * 29~21 : reserve |
| 456 | * 20 : PCBEEP input |
| 457 | * 19~16 : Check sum (15:1) |
| 458 | * 15~1 : Custom |
| 459 | * 0 : override |
| 460 | */ |
| 461 | nid = 0x1d; |
| 462 | if (codec->vendor_id == 0x10ec0260) |
| 463 | nid = 0x17; |
| 464 | ass = snd_hda_codec_get_pincfg(codec, nid); |
| 465 | snd_printd("realtek: No valid SSID, " |
| 466 | "checking pincfg 0x%08x for NID 0x%x\n", |
Takashi Iwai | cb6605c | 2009-04-28 13:03:19 +0200 | [diff] [blame] | 467 | ass, nid); |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 468 | if (!(ass & 1)) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 469 | return 0; |
| 470 | if ((ass >> 30) != 1) /* no physical connection */ |
| 471 | return 0; |
| 472 | |
| 473 | /* check sum */ |
| 474 | tmp = 0; |
| 475 | for (i = 1; i < 16; i++) { |
| 476 | if ((ass >> i) & 1) |
| 477 | tmp++; |
| 478 | } |
| 479 | if (((ass >> 16) & 0xf) != tmp) |
| 480 | return 0; |
| 481 | do_sku: |
| 482 | snd_printd("realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", |
| 483 | ass & 0xffff, codec->vendor_id); |
| 484 | /* |
| 485 | * 0 : override |
| 486 | * 1 : Swap Jack |
| 487 | * 2 : 0 --> Desktop, 1 --> Laptop |
| 488 | * 3~5 : External Amplifier control |
| 489 | * 7~6 : Reserved |
| 490 | */ |
| 491 | tmp = (ass & 0x38) >> 3; /* external Amp control */ |
| 492 | switch (tmp) { |
| 493 | case 1: |
| 494 | spec->init_amp = ALC_INIT_GPIO1; |
| 495 | break; |
| 496 | case 3: |
| 497 | spec->init_amp = ALC_INIT_GPIO2; |
| 498 | break; |
| 499 | case 7: |
| 500 | spec->init_amp = ALC_INIT_GPIO3; |
| 501 | break; |
| 502 | case 5: |
Takashi Iwai | 5a8cfb4 | 2010-11-26 17:11:18 +0100 | [diff] [blame] | 503 | default: |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 504 | spec->init_amp = ALC_INIT_DEFAULT; |
| 505 | break; |
| 506 | } |
| 507 | |
| 508 | /* is laptop or Desktop and enable the function "Mute internal speaker |
| 509 | * when the external headphone out jack is plugged" |
| 510 | */ |
| 511 | if (!(ass & 0x8000)) |
| 512 | return 1; |
| 513 | /* |
| 514 | * 10~8 : Jack location |
| 515 | * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered |
| 516 | * 14~13: Resvered |
| 517 | * 15 : 1 --> enable the function "Mute internal speaker |
| 518 | * when the external headphone out jack is plugged" |
| 519 | */ |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 520 | if (!spec->gen.autocfg.hp_pins[0] && |
| 521 | !(spec->gen.autocfg.line_out_pins[0] && |
| 522 | spec->gen.autocfg.line_out_type == AUTO_PIN_HP_OUT)) { |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 523 | hda_nid_t nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 524 | tmp = (ass >> 11) & 0x3; /* HP to chassis */ |
| 525 | if (tmp == 0) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 526 | nid = porta; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 527 | else if (tmp == 1) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 528 | nid = porte; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 529 | else if (tmp == 2) |
Takashi Iwai | 01d4825 | 2009-10-06 13:21:54 +0200 | [diff] [blame] | 530 | nid = portd; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 531 | else if (tmp == 3) |
| 532 | nid = porti; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 533 | else |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 534 | return 1; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 535 | if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, |
| 536 | spec->gen.autocfg.line_outs)) |
Takashi Iwai | 3af9ee6 | 2011-06-27 12:34:01 +0200 | [diff] [blame] | 537 | return 1; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 538 | spec->gen.autocfg.hp_pins[0] = nid; |
Kailang Yang | c9b5800 | 2007-10-16 14:30:01 +0200 | [diff] [blame] | 539 | } |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 540 | return 1; |
| 541 | } |
Kailang Yang | ea1fb29 | 2008-08-26 12:58:38 +0200 | [diff] [blame] | 542 | |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 543 | /* Check the validity of ALC subsystem-id |
| 544 | * ports contains an array of 4 pin NIDs for port-A, E, D and I */ |
| 545 | static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 546 | { |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 547 | if (!alc_subsystem_id(codec, ports[0], ports[1], ports[2], ports[3])) { |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 548 | struct alc_spec *spec = codec->spec; |
| 549 | snd_printd("realtek: " |
| 550 | "Enable default setup for auto mode as fallback\n"); |
| 551 | spec->init_amp = ALC_INIT_DEFAULT; |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 552 | } |
Takashi Iwai | 2126896 | 2011-07-07 15:01:13 +0200 | [diff] [blame] | 553 | } |
Takashi Iwai | 1a1455d | 2011-04-28 17:36:18 +0200 | [diff] [blame] | 554 | |
Takashi Iwai | 41e41f1 | 2005-06-08 14:48:49 +0200 | [diff] [blame] | 555 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 556 | * COEF access helper functions |
| 557 | */ |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 558 | static int alc_read_coef_idx(struct hda_codec *codec, |
| 559 | unsigned int coef_idx) |
| 560 | { |
| 561 | unsigned int val; |
| 562 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 563 | coef_idx); |
| 564 | val = snd_hda_codec_read(codec, 0x20, 0, |
| 565 | AC_VERB_GET_PROC_COEF, 0); |
| 566 | return val; |
| 567 | } |
| 568 | |
Kailang Yang | 977ddd6 | 2010-09-15 10:02:29 +0200 | [diff] [blame] | 569 | static void alc_write_coef_idx(struct hda_codec *codec, unsigned int coef_idx, |
| 570 | unsigned int coef_val) |
| 571 | { |
| 572 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, |
| 573 | coef_idx); |
| 574 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, |
| 575 | coef_val); |
| 576 | } |
| 577 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 578 | /* a special bypass for COEF 0; read the cached value at the second time */ |
| 579 | static unsigned int alc_get_coef0(struct hda_codec *codec) |
| 580 | { |
| 581 | struct alc_spec *spec = codec->spec; |
| 582 | if (!spec->coef0) |
| 583 | spec->coef0 = alc_read_coef_idx(codec, 0); |
| 584 | return spec->coef0; |
| 585 | } |
| 586 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 587 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 588 | */ |
| 589 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 590 | static hda_nid_t get_adc_nid(struct hda_codec *codec, int adc_idx, int imux_idx) |
Takashi Iwai | 757899a | 2010-07-30 10:48:14 +0200 | [diff] [blame] | 591 | { |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 592 | struct hda_gen_spec *spec = codec->spec; |
| 593 | if (spec->dyn_adc_switch) |
| 594 | adc_idx = spec->dyn_adc_idx[imux_idx]; |
| 595 | return spec->adc_nids[adc_idx]; |
Takashi Iwai | f9e336f | 2008-10-31 16:37:07 +0100 | [diff] [blame] | 596 | } |
| 597 | |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 598 | static void alc_inv_dmic_sync_adc(struct hda_codec *codec, int adc_idx) |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 599 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 600 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 601 | struct hda_input_mux *imux = &spec->gen.input_mux; |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 602 | struct nid_path *path; |
| 603 | hda_nid_t nid; |
| 604 | int i, dir, parm; |
| 605 | unsigned int val; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 606 | |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 607 | for (i = 0; i < imux->num_items; i++) { |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 608 | if (spec->gen.imux_pins[i] == spec->inv_dmic_pin) |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 609 | break; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 610 | } |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 611 | if (i >= imux->num_items) |
| 612 | return; |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 613 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 614 | path = snd_hda_get_nid_path(codec, spec->inv_dmic_pin, |
| 615 | get_adc_nid(codec, adc_idx, i)); |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 616 | val = path->ctls[NID_PATH_MUTE_CTL]; |
| 617 | if (!val) |
| 618 | return; |
| 619 | nid = get_amp_nid_(val); |
| 620 | dir = get_amp_direction_(val); |
| 621 | parm = AC_AMP_SET_RIGHT | |
| 622 | (dir == HDA_OUTPUT ? AC_AMP_SET_OUTPUT : AC_AMP_SET_INPUT); |
Takashi Iwai | a23b688 | 2009-03-23 15:21:36 +0100 | [diff] [blame] | 623 | |
Takashi Iwai | c4f3ebe | 2012-12-20 11:33:20 +0100 | [diff] [blame] | 624 | /* flush all cached amps at first */ |
Takashi Iwai | dc870f3 | 2013-01-22 15:24:30 +0100 | [diff] [blame] | 625 | snd_hda_codec_flush_cache(codec); |
Takashi Iwai | c4f3ebe | 2012-12-20 11:33:20 +0100 | [diff] [blame] | 626 | |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 627 | /* we care only right channel */ |
| 628 | val = snd_hda_codec_amp_read(codec, nid, 1, dir, 0); |
| 629 | if (val & 0x80) /* if already muted, we don't need to touch */ |
| 630 | return; |
| 631 | val |= 0x80; |
| 632 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, |
| 633 | parm | val); |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 634 | } |
| 635 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 636 | /* |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 637 | * Inverted digital-mic handling |
| 638 | * |
| 639 | * First off, it's a bit tricky. The "Inverted Internal Mic Capture Switch" |
| 640 | * gives the additional mute only to the right channel of the digital mic |
| 641 | * capture stream. This is a workaround for avoiding the almost silence |
| 642 | * by summing the stereo stream from some (known to be ForteMedia) |
| 643 | * digital mic unit. |
| 644 | * |
| 645 | * The logic is to call alc_inv_dmic_sync() after each action (possibly) |
| 646 | * modifying ADC amp. When the mute flag is set, it mutes the R-channel |
| 647 | * without caching so that the cache can still keep the original value. |
| 648 | * The cached value is then restored when the flag is set off or any other |
| 649 | * than d-mic is used as the current input source. |
| 650 | */ |
| 651 | static void alc_inv_dmic_sync(struct hda_codec *codec, bool force) |
| 652 | { |
| 653 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 654 | int src, nums; |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 655 | |
| 656 | if (!spec->inv_dmic_fixup) |
| 657 | return; |
| 658 | if (!spec->inv_dmic_muted && !force) |
| 659 | return; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 660 | nums = spec->gen.dyn_adc_switch ? 1 : spec->gen.num_adc_nids; |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 661 | for (src = 0; src < nums; src++) { |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 662 | bool dmic_fixup = false; |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 663 | |
| 664 | if (spec->inv_dmic_muted && |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 665 | spec->gen.imux_pins[spec->gen.cur_mux[src]] == spec->inv_dmic_pin) |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 666 | dmic_fixup = true; |
| 667 | if (!dmic_fixup && !force) |
| 668 | continue; |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 669 | alc_inv_dmic_sync_adc(codec, src); |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 670 | } |
| 671 | } |
| 672 | |
Takashi Iwai | a90229e | 2013-01-18 14:10:00 +0100 | [diff] [blame] | 673 | static void alc_inv_dmic_hook(struct hda_codec *codec, |
| 674 | struct snd_ctl_elem_value *ucontrol) |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 675 | { |
| 676 | alc_inv_dmic_sync(codec, false); |
| 677 | } |
| 678 | |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 679 | static int alc_inv_dmic_sw_get(struct snd_kcontrol *kcontrol, |
| 680 | struct snd_ctl_elem_value *ucontrol) |
| 681 | { |
| 682 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 683 | struct alc_spec *spec = codec->spec; |
| 684 | |
| 685 | ucontrol->value.integer.value[0] = !spec->inv_dmic_muted; |
| 686 | return 0; |
| 687 | } |
| 688 | |
| 689 | static int alc_inv_dmic_sw_put(struct snd_kcontrol *kcontrol, |
| 690 | struct snd_ctl_elem_value *ucontrol) |
| 691 | { |
| 692 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
| 693 | struct alc_spec *spec = codec->spec; |
| 694 | unsigned int val = !ucontrol->value.integer.value[0]; |
| 695 | |
| 696 | if (val == spec->inv_dmic_muted) |
| 697 | return 0; |
| 698 | spec->inv_dmic_muted = val; |
| 699 | alc_inv_dmic_sync(codec, true); |
| 700 | return 0; |
| 701 | } |
| 702 | |
| 703 | static const struct snd_kcontrol_new alc_inv_dmic_sw = { |
| 704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
Takashi Iwai | bc54976 | 2012-12-18 15:35:11 +0100 | [diff] [blame] | 705 | .name = "Inverted Internal Mic Capture Switch", |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 706 | .info = snd_ctl_boolean_mono_info, |
| 707 | .get = alc_inv_dmic_sw_get, |
| 708 | .put = alc_inv_dmic_sw_put, |
| 709 | }; |
| 710 | |
| 711 | static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid) |
| 712 | { |
| 713 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 668d1e9 | 2012-11-29 14:10:17 +0100 | [diff] [blame] | 714 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 715 | if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &alc_inv_dmic_sw)) |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 716 | return -ENOMEM; |
| 717 | spec->inv_dmic_fixup = 1; |
| 718 | spec->inv_dmic_muted = 0; |
| 719 | spec->inv_dmic_pin = nid; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 720 | spec->gen.cap_sync_hook = alc_inv_dmic_hook; |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 721 | return 0; |
| 722 | } |
| 723 | |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 724 | /* typically the digital mic is put at node 0x12 */ |
| 725 | static void alc_fixup_inv_dmic_0x12(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 726 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 727 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 728 | if (action == HDA_FIXUP_ACT_PROBE) |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 729 | alc_add_inv_dmic_mixer(codec, 0x12); |
| 730 | } |
| 731 | |
Takashi Iwai | 603c401 | 2008-07-30 15:01:44 +0200 | [diff] [blame] | 732 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 733 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 734 | /* additional beep mixers; the actual parameters are overwritten at build */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 735 | static const struct snd_kcontrol_new alc_beep_mixer[] = { |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 736 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), |
Jaroslav Kysela | 123c07a | 2009-10-21 14:48:23 +0200 | [diff] [blame] | 737 | HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT), |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 738 | { } /* end */ |
| 739 | }; |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 740 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 741 | |
Takashi Iwai | 2eab694 | 2012-12-18 15:30:41 +0100 | [diff] [blame] | 742 | static int alc_build_controls(struct hda_codec *codec) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 743 | { |
| 744 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 666a70d | 2012-12-17 20:29:29 +0100 | [diff] [blame] | 745 | int i, err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 746 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 747 | err = snd_hda_gen_build_controls(codec); |
| 748 | if (err < 0) |
| 749 | return err; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 750 | |
| 751 | for (i = 0; i < spec->num_mixers; i++) { |
| 752 | err = snd_hda_add_new_ctls(codec, spec->mixers[i]); |
| 753 | if (err < 0) |
| 754 | return err; |
| 755 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 756 | |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 757 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 758 | /* create beep controls if needed */ |
| 759 | if (spec->beep_amp) { |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 760 | const struct snd_kcontrol_new *knew; |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 761 | for (knew = alc_beep_mixer; knew->name; knew++) { |
| 762 | struct snd_kcontrol *kctl; |
| 763 | kctl = snd_ctl_new1(knew, codec); |
| 764 | if (!kctl) |
| 765 | return -ENOMEM; |
| 766 | kctl->private_value = spec->beep_amp; |
Jaroslav Kysela | 5e26dfd | 2009-12-10 13:57:01 +0100 | [diff] [blame] | 767 | err = snd_hda_ctl_add(codec, 0, kctl); |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 768 | if (err < 0) |
| 769 | return err; |
| 770 | } |
| 771 | } |
Takashi Iwai | 67d634c | 2009-11-16 15:35:59 +0100 | [diff] [blame] | 772 | #endif |
Takashi Iwai | 45bdd1c | 2009-02-06 16:11:25 +0100 | [diff] [blame] | 773 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 774 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); |
Takashi Iwai | 420b0fe | 2012-03-12 12:35:27 +0100 | [diff] [blame] | 775 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 776 | } |
| 777 | |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 778 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 779 | /* |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 780 | * Common callbacks |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 781 | */ |
Takashi Iwai | 16ded52 | 2005-06-10 19:58:24 +0200 | [diff] [blame] | 782 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 783 | static int alc_init(struct hda_codec *codec) |
| 784 | { |
| 785 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | e9edcee | 2005-06-13 14:16:38 +0200 | [diff] [blame] | 786 | |
Takashi Iwai | 546bb67 | 2012-03-07 08:37:19 +0100 | [diff] [blame] | 787 | if (spec->init_hook) |
| 788 | spec->init_hook(codec); |
Kailang Yang | 526af6e | 2012-03-07 08:25:20 +0100 | [diff] [blame] | 789 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 790 | alc_fix_pll(codec); |
Takashi Iwai | 4a79ba3 | 2009-04-22 16:31:35 +0200 | [diff] [blame] | 791 | alc_auto_init_amp(codec, spec->init_amp); |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 792 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 793 | snd_hda_gen_init(codec); |
Takashi Iwai | ae6b813 | 2006-03-03 16:47:17 +0100 | [diff] [blame] | 794 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 795 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); |
Takashi Iwai | e08a007 | 2006-09-07 17:52:14 +0200 | [diff] [blame] | 796 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 797 | return 0; |
| 798 | } |
| 799 | |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 800 | static inline void alc_shutup(struct hda_codec *codec) |
| 801 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 802 | struct alc_spec *spec = codec->spec; |
| 803 | |
| 804 | if (spec && spec->shutup) |
| 805 | spec->shutup(codec); |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 806 | snd_hda_shutup_pins(codec); |
| 807 | } |
| 808 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 809 | #define alc_free snd_hda_gen_free |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 810 | |
Takashi Iwai | 83012a7 | 2012-08-24 18:38:08 +0200 | [diff] [blame] | 811 | #ifdef CONFIG_PM |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 812 | static void alc_power_eapd(struct hda_codec *codec) |
| 813 | { |
Takashi Iwai | 691f1fc | 2011-04-07 10:31:43 +0200 | [diff] [blame] | 814 | alc_auto_setup_eapd(codec, false); |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 815 | } |
| 816 | |
Takashi Iwai | 68cb2b5 | 2012-07-02 15:20:37 +0200 | [diff] [blame] | 817 | static int alc_suspend(struct hda_codec *codec) |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 818 | { |
| 819 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | a4e09aa | 2009-12-27 11:22:24 +0100 | [diff] [blame] | 820 | alc_shutup(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 821 | if (spec && spec->power_hook) |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 822 | spec->power_hook(codec); |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 823 | return 0; |
| 824 | } |
| 825 | #endif |
| 826 | |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 827 | #ifdef CONFIG_PM |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 828 | static int alc_resume(struct hda_codec *codec) |
| 829 | { |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 830 | msleep(150); /* to avoid pop noise */ |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 831 | codec->patch_ops.init(codec); |
| 832 | snd_hda_codec_resume_amp(codec); |
| 833 | snd_hda_codec_resume_cache(codec); |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 834 | alc_inv_dmic_sync(codec, true); |
Takashi Iwai | 9e5341b | 2010-09-21 09:57:06 +0200 | [diff] [blame] | 835 | hda_call_check_power_status(codec, 0x01); |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 836 | return 0; |
| 837 | } |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 838 | #endif |
| 839 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 840 | /* |
| 841 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 842 | static const struct hda_codec_ops alc_patch_ops = { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 843 | .build_controls = alc_build_controls, |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 844 | .build_pcms = snd_hda_gen_build_pcms, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 845 | .init = alc_init, |
| 846 | .free = alc_free, |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 847 | .unsol_event = snd_hda_jack_unsol_event, |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 848 | #ifdef CONFIG_PM |
Takashi Iwai | e044c39 | 2008-10-27 16:56:24 +0100 | [diff] [blame] | 849 | .resume = alc_resume, |
Hector Martin | f5de24b | 2009-12-20 22:51:31 +0100 | [diff] [blame] | 850 | .suspend = alc_suspend, |
Takashi Iwai | fce52a3 | 2013-01-07 12:42:48 +0100 | [diff] [blame] | 851 | .check_power_status = snd_hda_gen_check_power_status, |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 852 | #endif |
Daniel T Chen | c97259d | 2009-12-27 18:52:08 -0500 | [diff] [blame] | 853 | .reboot_notify = alc_shutup, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 854 | }; |
| 855 | |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 856 | |
Kailang Yang | c027ddc | 2010-03-19 11:33:06 +0100 | [diff] [blame] | 857 | /* replace the codec chip_name with the given string */ |
| 858 | static int alc_codec_rename(struct hda_codec *codec, const char *name) |
| 859 | { |
| 860 | kfree(codec->chip_name); |
| 861 | codec->chip_name = kstrdup(name, GFP_KERNEL); |
| 862 | if (!codec->chip_name) { |
| 863 | alc_free(codec); |
| 864 | return -ENOMEM; |
| 865 | } |
| 866 | return 0; |
| 867 | } |
| 868 | |
Takashi Iwai | 2fa522b | 2005-05-12 14:51:12 +0200 | [diff] [blame] | 869 | /* |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 870 | * Rename codecs appropriately from COEF value |
| 871 | */ |
| 872 | struct alc_codec_rename_table { |
| 873 | unsigned int vendor_id; |
| 874 | unsigned short coef_mask; |
| 875 | unsigned short coef_bits; |
| 876 | const char *name; |
| 877 | }; |
| 878 | |
| 879 | static struct alc_codec_rename_table rename_tbl[] = { |
| 880 | { 0x10ec0269, 0xfff0, 0x3010, "ALC277" }, |
| 881 | { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" }, |
| 882 | { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" }, |
| 883 | { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" }, |
| 884 | { 0x10ec0269, 0xffff, 0xa023, "ALC259" }, |
| 885 | { 0x10ec0269, 0xffff, 0x6023, "ALC281X" }, |
| 886 | { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" }, |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 887 | { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" }, |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 888 | { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" }, |
| 889 | { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" }, |
| 890 | { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" }, |
| 891 | { 0x10ec0899, 0x2000, 0x2000, "ALC899" }, |
| 892 | { 0x10ec0892, 0xffff, 0x8020, "ALC661" }, |
| 893 | { 0x10ec0892, 0xffff, 0x8011, "ALC661" }, |
| 894 | { 0x10ec0892, 0xffff, 0x4011, "ALC656" }, |
| 895 | { } /* terminator */ |
| 896 | }; |
| 897 | |
| 898 | static int alc_codec_rename_from_preset(struct hda_codec *codec) |
| 899 | { |
| 900 | const struct alc_codec_rename_table *p; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 901 | |
| 902 | for (p = rename_tbl; p->vendor_id; p++) { |
| 903 | if (p->vendor_id != codec->vendor_id) |
| 904 | continue; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 905 | if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 906 | return alc_codec_rename(codec, p->name); |
| 907 | } |
| 908 | return 0; |
| 909 | } |
| 910 | |
Takashi Iwai | e477062 | 2011-07-08 11:11:35 +0200 | [diff] [blame] | 911 | |
| 912 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 913 | * Digital-beep handlers |
| 914 | */ |
| 915 | #ifdef CONFIG_SND_HDA_INPUT_BEEP |
| 916 | #define set_beep_amp(spec, nid, idx, dir) \ |
| 917 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) |
| 918 | |
| 919 | static const struct snd_pci_quirk beep_white_list[] = { |
Duncan Roe | 7110005 | 2012-10-10 14:19:50 +0200 | [diff] [blame] | 920 | SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 921 | SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1), |
Takashi Iwai | 8554ee4 | 2013-02-25 09:54:43 +0100 | [diff] [blame] | 922 | SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 923 | SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1), |
| 924 | SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1), |
| 925 | SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1), |
Takashi Iwai | 78f8baf | 2012-03-06 14:02:32 +0100 | [diff] [blame] | 926 | SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 927 | SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1), |
| 928 | {} |
| 929 | }; |
| 930 | |
| 931 | static inline int has_cdefine_beep(struct hda_codec *codec) |
| 932 | { |
| 933 | struct alc_spec *spec = codec->spec; |
| 934 | const struct snd_pci_quirk *q; |
| 935 | q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); |
| 936 | if (q) |
| 937 | return q->value; |
| 938 | return spec->cdefine.enable_pcbeep; |
| 939 | } |
| 940 | #else |
| 941 | #define set_beep_amp(spec, nid, idx, dir) /* NOP */ |
| 942 | #define has_cdefine_beep(codec) 0 |
| 943 | #endif |
| 944 | |
| 945 | /* parse the BIOS configuration and set up the alc_spec */ |
| 946 | /* return 1 if successful, 0 if the proper config is not found, |
| 947 | * or a negative error code |
| 948 | */ |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 949 | static int alc_parse_auto_config(struct hda_codec *codec, |
| 950 | const hda_nid_t *ignore_nids, |
| 951 | const hda_nid_t *ssid_nids) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 952 | { |
| 953 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 954 | struct auto_pin_cfg *cfg = &spec->gen.autocfg; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 955 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 956 | |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 957 | err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, |
| 958 | spec->parse_flags); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 959 | if (err < 0) |
| 960 | return err; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 961 | |
| 962 | if (ssid_nids) |
| 963 | alc_ssid_check(codec, ssid_nids); |
| 964 | |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 965 | err = snd_hda_gen_parse_auto_config(codec, cfg); |
| 966 | if (err < 0) |
| 967 | return err; |
Takashi Iwai | 070cff4 | 2012-02-21 12:54:17 +0100 | [diff] [blame] | 968 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 969 | return 1; |
| 970 | } |
| 971 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 972 | /* common preparation job for alc_spec */ |
| 973 | static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) |
| 974 | { |
| 975 | struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
| 976 | int err; |
| 977 | |
| 978 | if (!spec) |
| 979 | return -ENOMEM; |
| 980 | codec->spec = spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 981 | snd_hda_gen_spec_init(&spec->gen); |
| 982 | spec->gen.mixer_nid = mixer_nid; |
| 983 | spec->gen.own_eapd_ctl = 1; |
Takashi Iwai | 1098b7c | 2012-12-17 20:03:15 +0100 | [diff] [blame] | 984 | codec->single_adc_amp = 1; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 985 | /* FIXME: do we need this for all Realtek codec models? */ |
| 986 | codec->spdif_status_reset = 1; |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 987 | |
| 988 | err = alc_codec_rename_from_preset(codec); |
| 989 | if (err < 0) { |
| 990 | kfree(spec); |
| 991 | return err; |
| 992 | } |
| 993 | return 0; |
| 994 | } |
| 995 | |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 996 | static int alc880_parse_auto_config(struct hda_codec *codec) |
| 997 | { |
| 998 | static const hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
Jesper Juhl | 7d7eb9e | 2012-04-12 22:11:25 +0200 | [diff] [blame] | 999 | static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 1000 | return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); |
| 1001 | } |
| 1002 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1003 | /* |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1004 | * ALC880 fix-ups |
| 1005 | */ |
| 1006 | enum { |
Takashi Iwai | 411225a | 2012-02-20 17:48:19 +0100 | [diff] [blame] | 1007 | ALC880_FIXUP_GPIO1, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1008 | ALC880_FIXUP_GPIO2, |
| 1009 | ALC880_FIXUP_MEDION_RIM, |
Takashi Iwai | dc6af52 | 2012-02-17 16:18:59 +0100 | [diff] [blame] | 1010 | ALC880_FIXUP_LG, |
Takashi Iwai | f02aab5 | 2012-02-17 16:33:56 +0100 | [diff] [blame] | 1011 | ALC880_FIXUP_W810, |
Takashi Iwai | 27e917f | 2012-02-17 17:49:54 +0100 | [diff] [blame] | 1012 | ALC880_FIXUP_EAPD_COEF, |
Takashi Iwai | b9368f5 | 2012-02-17 17:54:44 +0100 | [diff] [blame] | 1013 | ALC880_FIXUP_TCL_S700, |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1014 | ALC880_FIXUP_VOL_KNOB, |
| 1015 | ALC880_FIXUP_FUJITSU, |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1016 | ALC880_FIXUP_F1734, |
Takashi Iwai | 817de92 | 2012-02-20 17:20:48 +0100 | [diff] [blame] | 1017 | ALC880_FIXUP_UNIWILL, |
Takashi Iwai | 967b88c | 2012-02-20 17:31:02 +0100 | [diff] [blame] | 1018 | ALC880_FIXUP_UNIWILL_DIG, |
Takashi Iwai | 96e225f | 2012-02-20 17:41:51 +0100 | [diff] [blame] | 1019 | ALC880_FIXUP_Z71V, |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1020 | ALC880_FIXUP_3ST_BASE, |
| 1021 | ALC880_FIXUP_3ST, |
| 1022 | ALC880_FIXUP_3ST_DIG, |
| 1023 | ALC880_FIXUP_5ST_BASE, |
| 1024 | ALC880_FIXUP_5ST, |
| 1025 | ALC880_FIXUP_5ST_DIG, |
| 1026 | ALC880_FIXUP_6ST_BASE, |
| 1027 | ALC880_FIXUP_6ST, |
| 1028 | ALC880_FIXUP_6ST_DIG, |
Takashi Iwai | 5397145 | 2013-01-23 18:21:37 +0100 | [diff] [blame] | 1029 | ALC880_FIXUP_6ST_AUTOMUTE, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1030 | }; |
| 1031 | |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1032 | /* enable the volume-knob widget support on NID 0x21 */ |
| 1033 | static void alc880_fixup_vol_knob(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1034 | const struct hda_fixup *fix, int action) |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1035 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1036 | if (action == HDA_FIXUP_ACT_PROBE) |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 1037 | snd_hda_jack_detect_enable_callback(codec, 0x21, ALC_DCVOL_EVENT, alc_update_knob_master); |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1038 | } |
| 1039 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1040 | static const struct hda_fixup alc880_fixups[] = { |
Takashi Iwai | 411225a | 2012-02-20 17:48:19 +0100 | [diff] [blame] | 1041 | [ALC880_FIXUP_GPIO1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1042 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 411225a | 2012-02-20 17:48:19 +0100 | [diff] [blame] | 1043 | .v.verbs = alc_gpio1_init_verbs, |
| 1044 | }, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1045 | [ALC880_FIXUP_GPIO2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1046 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1047 | .v.verbs = alc_gpio2_init_verbs, |
| 1048 | }, |
| 1049 | [ALC880_FIXUP_MEDION_RIM] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1050 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1051 | .v.verbs = (const struct hda_verb[]) { |
| 1052 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1053 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, |
| 1054 | { } |
| 1055 | }, |
| 1056 | .chained = true, |
| 1057 | .chain_id = ALC880_FIXUP_GPIO2, |
| 1058 | }, |
Takashi Iwai | dc6af52 | 2012-02-17 16:18:59 +0100 | [diff] [blame] | 1059 | [ALC880_FIXUP_LG] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1060 | .type = HDA_FIXUP_PINS, |
| 1061 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | dc6af52 | 2012-02-17 16:18:59 +0100 | [diff] [blame] | 1062 | /* disable bogus unused pins */ |
| 1063 | { 0x16, 0x411111f0 }, |
| 1064 | { 0x18, 0x411111f0 }, |
| 1065 | { 0x1a, 0x411111f0 }, |
| 1066 | { } |
| 1067 | } |
| 1068 | }, |
Takashi Iwai | f02aab5 | 2012-02-17 16:33:56 +0100 | [diff] [blame] | 1069 | [ALC880_FIXUP_W810] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1070 | .type = HDA_FIXUP_PINS, |
| 1071 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | f02aab5 | 2012-02-17 16:33:56 +0100 | [diff] [blame] | 1072 | /* disable bogus unused pins */ |
| 1073 | { 0x17, 0x411111f0 }, |
| 1074 | { } |
| 1075 | }, |
| 1076 | .chained = true, |
| 1077 | .chain_id = ALC880_FIXUP_GPIO2, |
| 1078 | }, |
Takashi Iwai | 27e917f | 2012-02-17 17:49:54 +0100 | [diff] [blame] | 1079 | [ALC880_FIXUP_EAPD_COEF] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1080 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 27e917f | 2012-02-17 17:49:54 +0100 | [diff] [blame] | 1081 | .v.verbs = (const struct hda_verb[]) { |
| 1082 | /* change to EAPD mode */ |
| 1083 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1084 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, |
| 1085 | {} |
| 1086 | }, |
| 1087 | }, |
Takashi Iwai | b9368f5 | 2012-02-17 17:54:44 +0100 | [diff] [blame] | 1088 | [ALC880_FIXUP_TCL_S700] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1089 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | b9368f5 | 2012-02-17 17:54:44 +0100 | [diff] [blame] | 1090 | .v.verbs = (const struct hda_verb[]) { |
| 1091 | /* change to EAPD mode */ |
| 1092 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1093 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, |
| 1094 | {} |
| 1095 | }, |
| 1096 | .chained = true, |
| 1097 | .chain_id = ALC880_FIXUP_GPIO2, |
| 1098 | }, |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1099 | [ALC880_FIXUP_VOL_KNOB] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1100 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1101 | .v.func = alc880_fixup_vol_knob, |
| 1102 | }, |
| 1103 | [ALC880_FIXUP_FUJITSU] = { |
| 1104 | /* override all pins as BIOS on old Amilo is broken */ |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1105 | .type = HDA_FIXUP_PINS, |
| 1106 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1107 | { 0x14, 0x0121411f }, /* HP */ |
| 1108 | { 0x15, 0x99030120 }, /* speaker */ |
| 1109 | { 0x16, 0x99030130 }, /* bass speaker */ |
| 1110 | { 0x17, 0x411111f0 }, /* N/A */ |
| 1111 | { 0x18, 0x411111f0 }, /* N/A */ |
| 1112 | { 0x19, 0x01a19950 }, /* mic-in */ |
| 1113 | { 0x1a, 0x411111f0 }, /* N/A */ |
| 1114 | { 0x1b, 0x411111f0 }, /* N/A */ |
| 1115 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1116 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1117 | { 0x1e, 0x01454140 }, /* SPDIF out */ |
| 1118 | { } |
| 1119 | }, |
| 1120 | .chained = true, |
| 1121 | .chain_id = ALC880_FIXUP_VOL_KNOB, |
| 1122 | }, |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1123 | [ALC880_FIXUP_F1734] = { |
| 1124 | /* almost compatible with FUJITSU, but no bass and SPDIF */ |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1125 | .type = HDA_FIXUP_PINS, |
| 1126 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1127 | { 0x14, 0x0121411f }, /* HP */ |
| 1128 | { 0x15, 0x99030120 }, /* speaker */ |
| 1129 | { 0x16, 0x411111f0 }, /* N/A */ |
| 1130 | { 0x17, 0x411111f0 }, /* N/A */ |
| 1131 | { 0x18, 0x411111f0 }, /* N/A */ |
| 1132 | { 0x19, 0x01a19950 }, /* mic-in */ |
| 1133 | { 0x1a, 0x411111f0 }, /* N/A */ |
| 1134 | { 0x1b, 0x411111f0 }, /* N/A */ |
| 1135 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1136 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1137 | { 0x1e, 0x411111f0 }, /* N/A */ |
| 1138 | { } |
| 1139 | }, |
| 1140 | .chained = true, |
| 1141 | .chain_id = ALC880_FIXUP_VOL_KNOB, |
| 1142 | }, |
Takashi Iwai | 817de92 | 2012-02-20 17:20:48 +0100 | [diff] [blame] | 1143 | [ALC880_FIXUP_UNIWILL] = { |
| 1144 | /* need to fix HP and speaker pins to be parsed correctly */ |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1145 | .type = HDA_FIXUP_PINS, |
| 1146 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 817de92 | 2012-02-20 17:20:48 +0100 | [diff] [blame] | 1147 | { 0x14, 0x0121411f }, /* HP */ |
| 1148 | { 0x15, 0x99030120 }, /* speaker */ |
| 1149 | { 0x16, 0x99030130 }, /* bass speaker */ |
| 1150 | { } |
| 1151 | }, |
| 1152 | }, |
Takashi Iwai | 967b88c | 2012-02-20 17:31:02 +0100 | [diff] [blame] | 1153 | [ALC880_FIXUP_UNIWILL_DIG] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1154 | .type = HDA_FIXUP_PINS, |
| 1155 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 967b88c | 2012-02-20 17:31:02 +0100 | [diff] [blame] | 1156 | /* disable bogus unused pins */ |
| 1157 | { 0x17, 0x411111f0 }, |
| 1158 | { 0x19, 0x411111f0 }, |
| 1159 | { 0x1b, 0x411111f0 }, |
| 1160 | { 0x1f, 0x411111f0 }, |
| 1161 | { } |
| 1162 | } |
| 1163 | }, |
Takashi Iwai | 96e225f | 2012-02-20 17:41:51 +0100 | [diff] [blame] | 1164 | [ALC880_FIXUP_Z71V] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1165 | .type = HDA_FIXUP_PINS, |
| 1166 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 96e225f | 2012-02-20 17:41:51 +0100 | [diff] [blame] | 1167 | /* set up the whole pins as BIOS is utterly broken */ |
| 1168 | { 0x14, 0x99030120 }, /* speaker */ |
| 1169 | { 0x15, 0x0121411f }, /* HP */ |
| 1170 | { 0x16, 0x411111f0 }, /* N/A */ |
| 1171 | { 0x17, 0x411111f0 }, /* N/A */ |
| 1172 | { 0x18, 0x01a19950 }, /* mic-in */ |
| 1173 | { 0x19, 0x411111f0 }, /* N/A */ |
| 1174 | { 0x1a, 0x01813031 }, /* line-in */ |
| 1175 | { 0x1b, 0x411111f0 }, /* N/A */ |
| 1176 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1177 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1178 | { 0x1e, 0x0144111e }, /* SPDIF */ |
| 1179 | { } |
| 1180 | } |
| 1181 | }, |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1182 | [ALC880_FIXUP_3ST_BASE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1183 | .type = HDA_FIXUP_PINS, |
| 1184 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1185 | { 0x14, 0x01014010 }, /* line-out */ |
| 1186 | { 0x15, 0x411111f0 }, /* N/A */ |
| 1187 | { 0x16, 0x411111f0 }, /* N/A */ |
| 1188 | { 0x17, 0x411111f0 }, /* N/A */ |
| 1189 | { 0x18, 0x01a19c30 }, /* mic-in */ |
| 1190 | { 0x19, 0x0121411f }, /* HP */ |
| 1191 | { 0x1a, 0x01813031 }, /* line-in */ |
| 1192 | { 0x1b, 0x02a19c40 }, /* front-mic */ |
| 1193 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1194 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1195 | /* 0x1e is filled in below */ |
| 1196 | { 0x1f, 0x411111f0 }, /* N/A */ |
| 1197 | { } |
| 1198 | } |
| 1199 | }, |
| 1200 | [ALC880_FIXUP_3ST] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1201 | .type = HDA_FIXUP_PINS, |
| 1202 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1203 | { 0x1e, 0x411111f0 }, /* N/A */ |
| 1204 | { } |
| 1205 | }, |
| 1206 | .chained = true, |
| 1207 | .chain_id = ALC880_FIXUP_3ST_BASE, |
| 1208 | }, |
| 1209 | [ALC880_FIXUP_3ST_DIG] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1210 | .type = HDA_FIXUP_PINS, |
| 1211 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1212 | { 0x1e, 0x0144111e }, /* SPDIF */ |
| 1213 | { } |
| 1214 | }, |
| 1215 | .chained = true, |
| 1216 | .chain_id = ALC880_FIXUP_3ST_BASE, |
| 1217 | }, |
| 1218 | [ALC880_FIXUP_5ST_BASE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1219 | .type = HDA_FIXUP_PINS, |
| 1220 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1221 | { 0x14, 0x01014010 }, /* front */ |
| 1222 | { 0x15, 0x411111f0 }, /* N/A */ |
| 1223 | { 0x16, 0x01011411 }, /* CLFE */ |
| 1224 | { 0x17, 0x01016412 }, /* surr */ |
| 1225 | { 0x18, 0x01a19c30 }, /* mic-in */ |
| 1226 | { 0x19, 0x0121411f }, /* HP */ |
| 1227 | { 0x1a, 0x01813031 }, /* line-in */ |
| 1228 | { 0x1b, 0x02a19c40 }, /* front-mic */ |
| 1229 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1230 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1231 | /* 0x1e is filled in below */ |
| 1232 | { 0x1f, 0x411111f0 }, /* N/A */ |
| 1233 | { } |
| 1234 | } |
| 1235 | }, |
| 1236 | [ALC880_FIXUP_5ST] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1237 | .type = HDA_FIXUP_PINS, |
| 1238 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1239 | { 0x1e, 0x411111f0 }, /* N/A */ |
| 1240 | { } |
| 1241 | }, |
| 1242 | .chained = true, |
| 1243 | .chain_id = ALC880_FIXUP_5ST_BASE, |
| 1244 | }, |
| 1245 | [ALC880_FIXUP_5ST_DIG] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1246 | .type = HDA_FIXUP_PINS, |
| 1247 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1248 | { 0x1e, 0x0144111e }, /* SPDIF */ |
| 1249 | { } |
| 1250 | }, |
| 1251 | .chained = true, |
| 1252 | .chain_id = ALC880_FIXUP_5ST_BASE, |
| 1253 | }, |
| 1254 | [ALC880_FIXUP_6ST_BASE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1255 | .type = HDA_FIXUP_PINS, |
| 1256 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1257 | { 0x14, 0x01014010 }, /* front */ |
| 1258 | { 0x15, 0x01016412 }, /* surr */ |
| 1259 | { 0x16, 0x01011411 }, /* CLFE */ |
| 1260 | { 0x17, 0x01012414 }, /* side */ |
| 1261 | { 0x18, 0x01a19c30 }, /* mic-in */ |
| 1262 | { 0x19, 0x02a19c40 }, /* front-mic */ |
| 1263 | { 0x1a, 0x01813031 }, /* line-in */ |
| 1264 | { 0x1b, 0x0121411f }, /* HP */ |
| 1265 | { 0x1c, 0x411111f0 }, /* N/A */ |
| 1266 | { 0x1d, 0x411111f0 }, /* N/A */ |
| 1267 | /* 0x1e is filled in below */ |
| 1268 | { 0x1f, 0x411111f0 }, /* N/A */ |
| 1269 | { } |
| 1270 | } |
| 1271 | }, |
| 1272 | [ALC880_FIXUP_6ST] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1273 | .type = HDA_FIXUP_PINS, |
| 1274 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1275 | { 0x1e, 0x411111f0 }, /* N/A */ |
| 1276 | { } |
| 1277 | }, |
| 1278 | .chained = true, |
| 1279 | .chain_id = ALC880_FIXUP_6ST_BASE, |
| 1280 | }, |
| 1281 | [ALC880_FIXUP_6ST_DIG] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1282 | .type = HDA_FIXUP_PINS, |
| 1283 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1284 | { 0x1e, 0x0144111e }, /* SPDIF */ |
| 1285 | { } |
| 1286 | }, |
| 1287 | .chained = true, |
| 1288 | .chain_id = ALC880_FIXUP_6ST_BASE, |
| 1289 | }, |
Takashi Iwai | 5397145 | 2013-01-23 18:21:37 +0100 | [diff] [blame] | 1290 | [ALC880_FIXUP_6ST_AUTOMUTE] = { |
| 1291 | .type = HDA_FIXUP_PINS, |
| 1292 | .v.pins = (const struct hda_pintbl[]) { |
| 1293 | { 0x1b, 0x0121401f }, /* HP with jack detect */ |
| 1294 | { } |
| 1295 | }, |
| 1296 | .chained_before = true, |
| 1297 | .chain_id = ALC880_FIXUP_6ST_BASE, |
| 1298 | }, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1299 | }; |
| 1300 | |
| 1301 | static const struct snd_pci_quirk alc880_fixup_tbl[] = { |
Takashi Iwai | f02aab5 | 2012-02-17 16:33:56 +0100 | [diff] [blame] | 1302 | SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810), |
Takashi Iwai | 96e225f | 2012-02-20 17:41:51 +0100 | [diff] [blame] | 1303 | SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V), |
Takashi Iwai | 29e3fdc | 2012-02-20 17:56:57 +0100 | [diff] [blame] | 1304 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1), |
| 1305 | SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2), |
Takashi Iwai | 27e917f | 2012-02-17 17:49:54 +0100 | [diff] [blame] | 1306 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF), |
Takashi Iwai | 967b88c | 2012-02-20 17:31:02 +0100 | [diff] [blame] | 1307 | SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG), |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1308 | SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734), |
Takashi Iwai | 817de92 | 2012-02-20 17:20:48 +0100 | [diff] [blame] | 1309 | SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL), |
Takashi Iwai | 7833c7e | 2012-02-20 17:11:38 +0100 | [diff] [blame] | 1310 | SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB), |
Takashi Iwai | f02aab5 | 2012-02-17 16:33:56 +0100 | [diff] [blame] | 1311 | SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1312 | SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), |
Takashi Iwai | 5397145 | 2013-01-23 18:21:37 +0100 | [diff] [blame] | 1313 | SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE), |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1314 | SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1315 | SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), |
Takashi Iwai | ba53381 | 2012-02-20 16:36:52 +0100 | [diff] [blame] | 1316 | SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), |
Takashi Iwai | cf5a227 | 2012-02-20 16:31:07 +0100 | [diff] [blame] | 1317 | SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU), |
Takashi Iwai | dc6af52 | 2012-02-17 16:18:59 +0100 | [diff] [blame] | 1318 | SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG), |
| 1319 | SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG), |
| 1320 | SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG), |
Takashi Iwai | b9368f5 | 2012-02-17 17:54:44 +0100 | [diff] [blame] | 1321 | SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700), |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1322 | |
| 1323 | /* Below is the copied entries from alc880_quirks.c. |
| 1324 | * It's not quite sure whether BIOS sets the correct pin-config table |
| 1325 | * on these machines, thus they are kept to be compatible with |
| 1326 | * the old static quirks. Once when it's confirmed to work without |
| 1327 | * these overrides, it'd be better to remove. |
| 1328 | */ |
| 1329 | SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG), |
| 1330 | SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST), |
| 1331 | SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG), |
| 1332 | SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG), |
| 1333 | SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG), |
| 1334 | SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG), |
| 1335 | SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG), |
| 1336 | SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST), |
| 1337 | SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG), |
| 1338 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST), |
| 1339 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST), |
| 1340 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST), |
| 1341 | SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST), |
| 1342 | SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST), |
| 1343 | SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG), |
| 1344 | SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG), |
| 1345 | SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG), |
| 1346 | SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG), |
| 1347 | SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG), |
| 1348 | SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG), |
| 1349 | SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG), |
| 1350 | SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */ |
| 1351 | SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG), |
| 1352 | SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1353 | SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1354 | SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1355 | SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG), |
| 1356 | SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1357 | SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG), |
| 1358 | SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG), |
| 1359 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1360 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1361 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG), |
| 1362 | /* default Intel */ |
| 1363 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST), |
| 1364 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG), |
| 1365 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG), |
| 1366 | {} |
| 1367 | }; |
| 1368 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1369 | static const struct hda_model_fixup alc880_fixup_models[] = { |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1370 | {.id = ALC880_FIXUP_3ST, .name = "3stack"}, |
| 1371 | {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"}, |
| 1372 | {.id = ALC880_FIXUP_5ST, .name = "5stack"}, |
| 1373 | {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"}, |
| 1374 | {.id = ALC880_FIXUP_6ST, .name = "6stack"}, |
| 1375 | {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"}, |
Takashi Iwai | 5397145 | 2013-01-23 18:21:37 +0100 | [diff] [blame] | 1376 | {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"}, |
Takashi Iwai | ee3b296 | 2011-11-15 14:26:54 +0100 | [diff] [blame] | 1377 | {} |
| 1378 | }; |
| 1379 | |
| 1380 | |
| 1381 | /* |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1382 | * OK, here we have finally the patch for ALC880 |
| 1383 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1384 | static int patch_alc880(struct hda_codec *codec) |
| 1385 | { |
| 1386 | struct alc_spec *spec; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1387 | int err; |
| 1388 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 1389 | err = alc_alloc_spec(codec, 0x0b); |
| 1390 | if (err < 0) |
| 1391 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1392 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 1393 | spec = codec->spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1394 | spec->gen.need_dac_fix = 1; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 1395 | spec->gen.beep_nid = 0x01; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1396 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1397 | snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1398 | alc880_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1399 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1400 | |
Takashi Iwai | 67b6ec3 | 2012-02-20 18:20:42 +0100 | [diff] [blame] | 1401 | /* automatic parse from the BIOS config */ |
| 1402 | err = alc880_parse_auto_config(codec); |
| 1403 | if (err < 0) |
| 1404 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1405 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 1406 | if (!spec->gen.no_analog) |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 1407 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1408 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1409 | codec->patch_ops = alc_patch_ops; |
David Henningsson | 29adc4b | 2012-09-25 11:31:00 +0200 | [diff] [blame] | 1410 | codec->patch_ops.unsol_event = alc880_unsol_event; |
| 1411 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1412 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1413 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 1414 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1415 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 1416 | |
| 1417 | error: |
| 1418 | alc_free(codec); |
| 1419 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1420 | } |
| 1421 | |
| 1422 | |
| 1423 | /* |
| 1424 | * ALC260 support |
| 1425 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1426 | static int alc260_parse_auto_config(struct hda_codec *codec) |
| 1427 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1428 | static const hda_nid_t alc260_ignore[] = { 0x17, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 1429 | static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 }; |
| 1430 | return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1431 | } |
| 1432 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1433 | /* |
| 1434 | * Pin config fixes |
| 1435 | */ |
| 1436 | enum { |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1437 | ALC260_FIXUP_HP_DC5750, |
| 1438 | ALC260_FIXUP_HP_PIN_0F, |
| 1439 | ALC260_FIXUP_COEF, |
Takashi Iwai | 15317ab | 2012-02-16 12:02:53 +0100 | [diff] [blame] | 1440 | ALC260_FIXUP_GPIO1, |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1441 | ALC260_FIXUP_GPIO1_TOGGLE, |
| 1442 | ALC260_FIXUP_REPLACER, |
Takashi Iwai | 0a1c4fa | 2012-02-16 12:42:30 +0100 | [diff] [blame] | 1443 | ALC260_FIXUP_HP_B1900, |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1444 | ALC260_FIXUP_KN1, |
Takashi Iwai | 39aedee | 2013-01-10 17:10:40 +0100 | [diff] [blame] | 1445 | ALC260_FIXUP_FSC_S7020, |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1446 | ALC260_FIXUP_FSC_S7020_JWSE, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1447 | }; |
| 1448 | |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1449 | static void alc260_gpio1_automute(struct hda_codec *codec) |
| 1450 | { |
| 1451 | struct alc_spec *spec = codec->spec; |
| 1452 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1453 | spec->gen.hp_jack_present); |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1454 | } |
| 1455 | |
| 1456 | static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1457 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1458 | { |
| 1459 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1460 | if (action == HDA_FIXUP_ACT_PROBE) { |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1461 | /* although the machine has only one output pin, we need to |
| 1462 | * toggle GPIO1 according to the jack state |
| 1463 | */ |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1464 | spec->gen.automute_hook = alc260_gpio1_automute; |
| 1465 | spec->gen.detect_hp = 1; |
| 1466 | spec->gen.automute_speaker = 1; |
| 1467 | spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ |
| 1468 | snd_hda_jack_detect_enable_callback(codec, 0x0f, HDA_GEN_HP_EVENT, |
| 1469 | snd_hda_gen_hp_automute); |
Takashi Iwai | c9ce6b2 | 2012-12-18 18:12:44 +0100 | [diff] [blame] | 1470 | snd_hda_add_verbs(codec, alc_gpio1_init_verbs); |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1471 | } |
| 1472 | } |
| 1473 | |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1474 | static void alc260_fixup_kn1(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1475 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1476 | { |
| 1477 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1478 | static const struct hda_pintbl pincfgs[] = { |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1479 | { 0x0f, 0x02214000 }, /* HP/speaker */ |
| 1480 | { 0x12, 0x90a60160 }, /* int mic */ |
| 1481 | { 0x13, 0x02a19000 }, /* ext mic */ |
| 1482 | { 0x18, 0x01446000 }, /* SPDIF out */ |
| 1483 | /* disable bogus I/O pins */ |
| 1484 | { 0x10, 0x411111f0 }, |
| 1485 | { 0x11, 0x411111f0 }, |
| 1486 | { 0x14, 0x411111f0 }, |
| 1487 | { 0x15, 0x411111f0 }, |
| 1488 | { 0x16, 0x411111f0 }, |
| 1489 | { 0x17, 0x411111f0 }, |
| 1490 | { 0x19, 0x411111f0 }, |
| 1491 | { } |
| 1492 | }; |
| 1493 | |
| 1494 | switch (action) { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1495 | case HDA_FIXUP_ACT_PRE_PROBE: |
| 1496 | snd_hda_apply_pincfgs(codec, pincfgs); |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1497 | break; |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1498 | case HDA_FIXUP_ACT_PROBE: |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1499 | spec->init_amp = ALC_INIT_NONE; |
| 1500 | break; |
| 1501 | } |
| 1502 | } |
| 1503 | |
Takashi Iwai | 39aedee | 2013-01-10 17:10:40 +0100 | [diff] [blame] | 1504 | static void alc260_fixup_fsc_s7020(struct hda_codec *codec, |
| 1505 | const struct hda_fixup *fix, int action) |
| 1506 | { |
| 1507 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1508 | if (action == HDA_FIXUP_ACT_PROBE) |
Takashi Iwai | e6e0ee5 | 2013-02-18 17:04:20 +0100 | [diff] [blame] | 1509 | spec->init_amp = ALC_INIT_NONE; |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1510 | } |
| 1511 | |
| 1512 | static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, |
| 1513 | const struct hda_fixup *fix, int action) |
| 1514 | { |
| 1515 | struct alc_spec *spec = codec->spec; |
| 1516 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
Takashi Iwai | f811c3c | 2013-03-07 18:32:59 +0100 | [diff] [blame] | 1517 | spec->gen.add_jack_modes = 1; |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1518 | spec->gen.hp_mic = 1; |
Takashi Iwai | e6e0ee5 | 2013-02-18 17:04:20 +0100 | [diff] [blame] | 1519 | } |
Takashi Iwai | 39aedee | 2013-01-10 17:10:40 +0100 | [diff] [blame] | 1520 | } |
| 1521 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1522 | static const struct hda_fixup alc260_fixups[] = { |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1523 | [ALC260_FIXUP_HP_DC5750] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1524 | .type = HDA_FIXUP_PINS, |
| 1525 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1526 | { 0x11, 0x90130110 }, /* speaker */ |
| 1527 | { } |
| 1528 | } |
| 1529 | }, |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1530 | [ALC260_FIXUP_HP_PIN_0F] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1531 | .type = HDA_FIXUP_PINS, |
| 1532 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1533 | { 0x0f, 0x01214000 }, /* HP */ |
| 1534 | { } |
| 1535 | } |
| 1536 | }, |
| 1537 | [ALC260_FIXUP_COEF] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1538 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1539 | .v.verbs = (const struct hda_verb[]) { |
| 1540 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1541 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3040 }, |
| 1542 | { } |
| 1543 | }, |
| 1544 | .chained = true, |
| 1545 | .chain_id = ALC260_FIXUP_HP_PIN_0F, |
| 1546 | }, |
Takashi Iwai | 15317ab | 2012-02-16 12:02:53 +0100 | [diff] [blame] | 1547 | [ALC260_FIXUP_GPIO1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1548 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 15317ab | 2012-02-16 12:02:53 +0100 | [diff] [blame] | 1549 | .v.verbs = alc_gpio1_init_verbs, |
| 1550 | }, |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1551 | [ALC260_FIXUP_GPIO1_TOGGLE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1552 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1553 | .v.func = alc260_fixup_gpio1_toggle, |
| 1554 | .chained = true, |
| 1555 | .chain_id = ALC260_FIXUP_HP_PIN_0F, |
| 1556 | }, |
| 1557 | [ALC260_FIXUP_REPLACER] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1558 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1559 | .v.verbs = (const struct hda_verb[]) { |
| 1560 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1561 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, |
| 1562 | { } |
| 1563 | }, |
| 1564 | .chained = true, |
| 1565 | .chain_id = ALC260_FIXUP_GPIO1_TOGGLE, |
| 1566 | }, |
Takashi Iwai | 0a1c4fa | 2012-02-16 12:42:30 +0100 | [diff] [blame] | 1567 | [ALC260_FIXUP_HP_B1900] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1568 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 0a1c4fa | 2012-02-16 12:42:30 +0100 | [diff] [blame] | 1569 | .v.func = alc260_fixup_gpio1_toggle, |
| 1570 | .chained = true, |
| 1571 | .chain_id = ALC260_FIXUP_COEF, |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1572 | }, |
| 1573 | [ALC260_FIXUP_KN1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1574 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1575 | .v.func = alc260_fixup_kn1, |
| 1576 | }, |
Takashi Iwai | 39aedee | 2013-01-10 17:10:40 +0100 | [diff] [blame] | 1577 | [ALC260_FIXUP_FSC_S7020] = { |
| 1578 | .type = HDA_FIXUP_FUNC, |
| 1579 | .v.func = alc260_fixup_fsc_s7020, |
| 1580 | }, |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1581 | [ALC260_FIXUP_FSC_S7020_JWSE] = { |
| 1582 | .type = HDA_FIXUP_FUNC, |
| 1583 | .v.func = alc260_fixup_fsc_s7020_jwse, |
| 1584 | .chained = true, |
| 1585 | .chain_id = ALC260_FIXUP_FSC_S7020, |
| 1586 | }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1587 | }; |
| 1588 | |
| 1589 | static const struct snd_pci_quirk alc260_fixup_tbl[] = { |
Takashi Iwai | 15317ab | 2012-02-16 12:02:53 +0100 | [diff] [blame] | 1590 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1), |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1591 | SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF), |
Takashi Iwai | 15317ab | 2012-02-16 12:02:53 +0100 | [diff] [blame] | 1592 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1), |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1593 | SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750), |
Takashi Iwai | 0a1c4fa | 2012-02-16 12:42:30 +0100 | [diff] [blame] | 1594 | SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900), |
Takashi Iwai | 39aedee | 2013-01-10 17:10:40 +0100 | [diff] [blame] | 1595 | SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020), |
Takashi Iwai | b1f5808 | 2012-02-16 12:45:03 +0100 | [diff] [blame] | 1596 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1), |
Takashi Iwai | 118cb4a | 2012-04-19 07:33:27 +0200 | [diff] [blame] | 1597 | SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1), |
Takashi Iwai | 20f7d92 | 2012-02-16 12:35:16 +0100 | [diff] [blame] | 1598 | SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER), |
Takashi Iwai | ca8f042 | 2012-02-16 11:51:19 +0100 | [diff] [blame] | 1599 | SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1600 | {} |
| 1601 | }; |
| 1602 | |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1603 | static const struct hda_model_fixup alc260_fixup_models[] = { |
| 1604 | {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"}, |
| 1605 | {.id = ALC260_FIXUP_COEF, .name = "coef"}, |
| 1606 | {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"}, |
| 1607 | {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"}, |
| 1608 | {} |
| 1609 | }; |
| 1610 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1611 | /* |
| 1612 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1613 | static int patch_alc260(struct hda_codec *codec) |
| 1614 | { |
| 1615 | struct alc_spec *spec; |
Takashi Iwai | c3c2c9e | 2012-02-16 12:59:55 +0100 | [diff] [blame] | 1616 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1617 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 1618 | err = alc_alloc_spec(codec, 0x07); |
| 1619 | if (err < 0) |
| 1620 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1621 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 1622 | spec = codec->spec; |
Takashi Iwai | ea46c3c | 2013-01-15 18:45:53 +0100 | [diff] [blame] | 1623 | /* as quite a few machines require HP amp for speaker outputs, |
| 1624 | * it's easier to enable it unconditionally; even if it's unneeded, |
| 1625 | * it's almost harmless. |
| 1626 | */ |
| 1627 | spec->gen.prefer_hp_amp = 1; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 1628 | spec->gen.beep_nid = 0x01; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1629 | |
Takashi Iwai | 5ebd3bb | 2013-02-19 18:23:31 +0100 | [diff] [blame] | 1630 | snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, |
| 1631 | alc260_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1632 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1633 | |
Takashi Iwai | c3c2c9e | 2012-02-16 12:59:55 +0100 | [diff] [blame] | 1634 | /* automatic parse from the BIOS config */ |
| 1635 | err = alc260_parse_auto_config(codec); |
| 1636 | if (err < 0) |
| 1637 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1638 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 1639 | if (!spec->gen.no_analog) |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 1640 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1641 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1642 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1643 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1644 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1645 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 1646 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1647 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 1648 | |
| 1649 | error: |
| 1650 | alc_free(codec); |
| 1651 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1652 | } |
| 1653 | |
| 1654 | |
| 1655 | /* |
| 1656 | * ALC882/883/885/888/889 support |
| 1657 | * |
| 1658 | * ALC882 is almost identical with ALC880 but has cleaner and more flexible |
| 1659 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 1660 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 1661 | * 6-channel independent captures. |
| 1662 | * |
| 1663 | * In addition, an independent DAC for the multi-playback (not used in this |
| 1664 | * driver yet). |
| 1665 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1666 | |
| 1667 | /* |
| 1668 | * Pin config fixes |
| 1669 | */ |
| 1670 | enum { |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1671 | ALC882_FIXUP_ABIT_AW9D_MAX, |
| 1672 | ALC882_FIXUP_LENOVO_Y530, |
| 1673 | ALC882_FIXUP_PB_M5210, |
| 1674 | ALC882_FIXUP_ACER_ASPIRE_7736, |
| 1675 | ALC882_FIXUP_ASUS_W90V, |
Marton Balint | 8f23921 | 2012-03-05 21:33:23 +0100 | [diff] [blame] | 1676 | ALC889_FIXUP_CD, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1677 | ALC889_FIXUP_VAIO_TT, |
Takashi Iwai | 0e7cc2e | 2011-11-09 12:42:48 +0100 | [diff] [blame] | 1678 | ALC888_FIXUP_EEE1601, |
Takashi Iwai | 177943a | 2011-11-09 12:55:18 +0100 | [diff] [blame] | 1679 | ALC882_FIXUP_EAPD, |
Takashi Iwai | 7a6069b | 2011-11-09 15:22:01 +0100 | [diff] [blame] | 1680 | ALC883_FIXUP_EAPD, |
Takashi Iwai | 8812c4f | 2011-11-09 17:39:15 +0100 | [diff] [blame] | 1681 | ALC883_FIXUP_ACER_EAPD, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1682 | ALC882_FIXUP_GPIO1, |
| 1683 | ALC882_FIXUP_GPIO2, |
Takashi Iwai | eb844d5 | 2011-11-09 18:03:07 +0100 | [diff] [blame] | 1684 | ALC882_FIXUP_GPIO3, |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1685 | ALC889_FIXUP_COEF, |
| 1686 | ALC882_FIXUP_ASUS_W2JC, |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1687 | ALC882_FIXUP_ACER_ASPIRE_4930G, |
| 1688 | ALC882_FIXUP_ACER_ASPIRE_8930G, |
| 1689 | ALC882_FIXUP_ASPIRE_8930G_VERBS, |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1690 | ALC885_FIXUP_MACPRO_GPIO, |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1691 | ALC889_FIXUP_DAC_ROUTE, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1692 | ALC889_FIXUP_MBP_VREF, |
| 1693 | ALC889_FIXUP_IMAC91_VREF, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 1694 | ALC882_FIXUP_INV_DMIC, |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 1695 | ALC882_FIXUP_NO_PRIMARY_HP, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1696 | }; |
| 1697 | |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1698 | static void alc889_fixup_coef(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1699 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1700 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1701 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1702 | return; |
| 1703 | alc889_coef_init(codec); |
| 1704 | } |
| 1705 | |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1706 | /* toggle speaker-output according to the hp-jack state */ |
| 1707 | static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) |
| 1708 | { |
| 1709 | unsigned int gpiostate, gpiomask, gpiodir; |
| 1710 | |
| 1711 | gpiostate = snd_hda_codec_read(codec, codec->afg, 0, |
| 1712 | AC_VERB_GET_GPIO_DATA, 0); |
| 1713 | |
| 1714 | if (!muted) |
| 1715 | gpiostate |= (1 << pin); |
| 1716 | else |
| 1717 | gpiostate &= ~(1 << pin); |
| 1718 | |
| 1719 | gpiomask = snd_hda_codec_read(codec, codec->afg, 0, |
| 1720 | AC_VERB_GET_GPIO_MASK, 0); |
| 1721 | gpiomask |= (1 << pin); |
| 1722 | |
| 1723 | gpiodir = snd_hda_codec_read(codec, codec->afg, 0, |
| 1724 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 1725 | gpiodir |= (1 << pin); |
| 1726 | |
| 1727 | |
| 1728 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1729 | AC_VERB_SET_GPIO_MASK, gpiomask); |
| 1730 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1731 | AC_VERB_SET_GPIO_DIRECTION, gpiodir); |
| 1732 | |
| 1733 | msleep(1); |
| 1734 | |
| 1735 | snd_hda_codec_write(codec, codec->afg, 0, |
| 1736 | AC_VERB_SET_GPIO_DATA, gpiostate); |
| 1737 | } |
| 1738 | |
| 1739 | /* set up GPIO at initialization */ |
| 1740 | static void alc885_fixup_macpro_gpio(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1741 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1742 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1743 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1744 | return; |
| 1745 | alc882_gpio_mute(codec, 0, 0); |
| 1746 | alc882_gpio_mute(codec, 1, 0); |
| 1747 | } |
| 1748 | |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1749 | /* Fix the connection of some pins for ALC889: |
| 1750 | * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't |
| 1751 | * work correctly (bko#42740) |
| 1752 | */ |
| 1753 | static void alc889_fixup_dac_route(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1754 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1755 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1756 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
Takashi Iwai | ef8d60f | 2012-02-17 10:12:38 +0100 | [diff] [blame] | 1757 | /* fake the connections during parsing the tree */ |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1758 | hda_nid_t conn1[2] = { 0x0c, 0x0d }; |
| 1759 | hda_nid_t conn2[2] = { 0x0e, 0x0f }; |
| 1760 | snd_hda_override_conn_list(codec, 0x14, 2, conn1); |
| 1761 | snd_hda_override_conn_list(codec, 0x15, 2, conn1); |
| 1762 | snd_hda_override_conn_list(codec, 0x18, 2, conn2); |
| 1763 | snd_hda_override_conn_list(codec, 0x1a, 2, conn2); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1764 | } else if (action == HDA_FIXUP_ACT_PROBE) { |
Takashi Iwai | ef8d60f | 2012-02-17 10:12:38 +0100 | [diff] [blame] | 1765 | /* restore the connections */ |
| 1766 | hda_nid_t conn[5] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 }; |
| 1767 | snd_hda_override_conn_list(codec, 0x14, 5, conn); |
| 1768 | snd_hda_override_conn_list(codec, 0x15, 5, conn); |
| 1769 | snd_hda_override_conn_list(codec, 0x18, 5, conn); |
| 1770 | snd_hda_override_conn_list(codec, 0x1a, 5, conn); |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1771 | } |
| 1772 | } |
| 1773 | |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1774 | /* Set VREF on HP pin */ |
| 1775 | static void alc889_fixup_mbp_vref(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1776 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1777 | { |
| 1778 | struct alc_spec *spec = codec->spec; |
| 1779 | static hda_nid_t nids[2] = { 0x14, 0x15 }; |
| 1780 | int i; |
| 1781 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1782 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1783 | return; |
| 1784 | for (i = 0; i < ARRAY_SIZE(nids); i++) { |
| 1785 | unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); |
| 1786 | if (get_defcfg_device(val) != AC_JACK_HP_OUT) |
| 1787 | continue; |
Takashi Iwai | d3f02d6 | 2013-01-10 10:12:22 +0100 | [diff] [blame] | 1788 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1789 | val |= AC_PINCTL_VREF_80; |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 1790 | snd_hda_set_pin_ctl(codec, nids[i], val); |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1791 | spec->gen.keep_vref_in_automute = 1; |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1792 | break; |
| 1793 | } |
| 1794 | } |
| 1795 | |
| 1796 | /* Set VREF on speaker pins on imac91 */ |
| 1797 | static void alc889_fixup_imac91_vref(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1798 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1799 | { |
| 1800 | struct alc_spec *spec = codec->spec; |
| 1801 | static hda_nid_t nids[2] = { 0x18, 0x1a }; |
| 1802 | int i; |
| 1803 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1804 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1805 | return; |
| 1806 | for (i = 0; i < ARRAY_SIZE(nids); i++) { |
| 1807 | unsigned int val; |
Takashi Iwai | d3f02d6 | 2013-01-10 10:12:22 +0100 | [diff] [blame] | 1808 | val = snd_hda_codec_get_pin_target(codec, nids[i]); |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1809 | val |= AC_PINCTL_VREF_50; |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 1810 | snd_hda_set_pin_ctl(codec, nids[i], val); |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1811 | } |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1812 | spec->gen.keep_vref_in_automute = 1; |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1813 | } |
| 1814 | |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 1815 | /* Don't take HP output as primary |
Fernando Luis Vázquez Cao | d911149 | 2013-02-12 16:49:46 +0900 | [diff] [blame] | 1816 | * Strangely, the speaker output doesn't work on Vaio Z and some Vaio |
| 1817 | * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05 |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 1818 | */ |
| 1819 | static void alc882_fixup_no_primary_hp(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1820 | const struct hda_fixup *fix, int action) |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 1821 | { |
| 1822 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1823 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 1824 | spec->gen.no_primary_hp = 1; |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 1825 | } |
| 1826 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1827 | static const struct hda_fixup alc882_fixups[] = { |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1828 | [ALC882_FIXUP_ABIT_AW9D_MAX] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1829 | .type = HDA_FIXUP_PINS, |
| 1830 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1831 | { 0x15, 0x01080104 }, /* side */ |
| 1832 | { 0x16, 0x01011012 }, /* rear */ |
| 1833 | { 0x17, 0x01016011 }, /* clfe */ |
| 1834 | { } |
| 1835 | } |
| 1836 | }, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1837 | [ALC882_FIXUP_LENOVO_Y530] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1838 | .type = HDA_FIXUP_PINS, |
| 1839 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1840 | { 0x15, 0x99130112 }, /* rear int speakers */ |
| 1841 | { 0x16, 0x99130111 }, /* subwoofer */ |
| 1842 | { } |
| 1843 | } |
| 1844 | }, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1845 | [ALC882_FIXUP_PB_M5210] = { |
Takashi Iwai | fd10821 | 2013-01-10 10:18:14 +0100 | [diff] [blame] | 1846 | .type = HDA_FIXUP_PINCTLS, |
| 1847 | .v.pins = (const struct hda_pintbl[]) { |
| 1848 | { 0x19, PIN_VREF50 }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1849 | {} |
| 1850 | } |
| 1851 | }, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1852 | [ALC882_FIXUP_ACER_ASPIRE_7736] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1853 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 1854 | .v.func = alc_fixup_sku_ignore, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 1855 | }, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1856 | [ALC882_FIXUP_ASUS_W90V] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1857 | .type = HDA_FIXUP_PINS, |
| 1858 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 5cdf745 | 2011-10-26 23:04:08 +0200 | [diff] [blame] | 1859 | { 0x16, 0x99130110 }, /* fix sequence for CLFE */ |
| 1860 | { } |
| 1861 | } |
| 1862 | }, |
Marton Balint | 8f23921 | 2012-03-05 21:33:23 +0100 | [diff] [blame] | 1863 | [ALC889_FIXUP_CD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1864 | .type = HDA_FIXUP_PINS, |
| 1865 | .v.pins = (const struct hda_pintbl[]) { |
Marton Balint | 8f23921 | 2012-03-05 21:33:23 +0100 | [diff] [blame] | 1866 | { 0x1c, 0x993301f0 }, /* CD */ |
| 1867 | { } |
| 1868 | } |
| 1869 | }, |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1870 | [ALC889_FIXUP_VAIO_TT] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1871 | .type = HDA_FIXUP_PINS, |
| 1872 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 1873 | { 0x17, 0x90170111 }, /* hidden surround speaker */ |
| 1874 | { } |
| 1875 | } |
| 1876 | }, |
Takashi Iwai | 0e7cc2e | 2011-11-09 12:42:48 +0100 | [diff] [blame] | 1877 | [ALC888_FIXUP_EEE1601] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1878 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 0e7cc2e | 2011-11-09 12:42:48 +0100 | [diff] [blame] | 1879 | .v.verbs = (const struct hda_verb[]) { |
| 1880 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, |
| 1881 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 }, |
| 1882 | { } |
| 1883 | } |
Takashi Iwai | 177943a | 2011-11-09 12:55:18 +0100 | [diff] [blame] | 1884 | }, |
| 1885 | [ALC882_FIXUP_EAPD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1886 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 177943a | 2011-11-09 12:55:18 +0100 | [diff] [blame] | 1887 | .v.verbs = (const struct hda_verb[]) { |
| 1888 | /* change to EAPD mode */ |
| 1889 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1890 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 }, |
| 1891 | { } |
| 1892 | } |
| 1893 | }, |
Takashi Iwai | 7a6069b | 2011-11-09 15:22:01 +0100 | [diff] [blame] | 1894 | [ALC883_FIXUP_EAPD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1895 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 7a6069b | 2011-11-09 15:22:01 +0100 | [diff] [blame] | 1896 | .v.verbs = (const struct hda_verb[]) { |
| 1897 | /* change to EAPD mode */ |
| 1898 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1899 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, |
| 1900 | { } |
| 1901 | } |
| 1902 | }, |
Takashi Iwai | 8812c4f | 2011-11-09 17:39:15 +0100 | [diff] [blame] | 1903 | [ALC883_FIXUP_ACER_EAPD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1904 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 8812c4f | 2011-11-09 17:39:15 +0100 | [diff] [blame] | 1905 | .v.verbs = (const struct hda_verb[]) { |
| 1906 | /* eanable EAPD on Acer laptops */ |
| 1907 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1908 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, |
| 1909 | { } |
| 1910 | } |
| 1911 | }, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1912 | [ALC882_FIXUP_GPIO1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1913 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1914 | .v.verbs = alc_gpio1_init_verbs, |
| 1915 | }, |
| 1916 | [ALC882_FIXUP_GPIO2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1917 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1918 | .v.verbs = alc_gpio2_init_verbs, |
| 1919 | }, |
Takashi Iwai | eb844d5 | 2011-11-09 18:03:07 +0100 | [diff] [blame] | 1920 | [ALC882_FIXUP_GPIO3] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1921 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | eb844d5 | 2011-11-09 18:03:07 +0100 | [diff] [blame] | 1922 | .v.verbs = alc_gpio3_init_verbs, |
| 1923 | }, |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1924 | [ALC882_FIXUP_ASUS_W2JC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1925 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1926 | .v.verbs = alc_gpio1_init_verbs, |
| 1927 | .chained = true, |
| 1928 | .chain_id = ALC882_FIXUP_EAPD, |
| 1929 | }, |
| 1930 | [ALC889_FIXUP_COEF] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1931 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 1932 | .v.func = alc889_fixup_coef, |
| 1933 | }, |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1934 | [ALC882_FIXUP_ACER_ASPIRE_4930G] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1935 | .type = HDA_FIXUP_PINS, |
| 1936 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1937 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
| 1938 | { 0x17, 0x99130112 }, /* surround speaker */ |
| 1939 | { } |
Takashi Iwai | 038d4fe | 2012-04-11 17:18:12 +0200 | [diff] [blame] | 1940 | }, |
| 1941 | .chained = true, |
| 1942 | .chain_id = ALC882_FIXUP_GPIO1, |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1943 | }, |
| 1944 | [ALC882_FIXUP_ACER_ASPIRE_8930G] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1945 | .type = HDA_FIXUP_PINS, |
| 1946 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1947 | { 0x16, 0x99130111 }, /* CLFE speaker */ |
| 1948 | { 0x1b, 0x99130112 }, /* surround speaker */ |
| 1949 | { } |
| 1950 | }, |
| 1951 | .chained = true, |
| 1952 | .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS, |
| 1953 | }, |
| 1954 | [ALC882_FIXUP_ASPIRE_8930G_VERBS] = { |
| 1955 | /* additional init verbs for Acer Aspire 8930G */ |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1956 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1957 | .v.verbs = (const struct hda_verb[]) { |
| 1958 | /* Enable all DACs */ |
| 1959 | /* DAC DISABLE/MUTE 1? */ |
| 1960 | /* setting bits 1-5 disables DAC nids 0x02-0x06 |
| 1961 | * apparently. Init=0x38 */ |
| 1962 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 }, |
| 1963 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, |
| 1964 | /* DAC DISABLE/MUTE 2? */ |
| 1965 | /* some bit here disables the other DACs. |
| 1966 | * Init=0x4900 */ |
| 1967 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 }, |
| 1968 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 }, |
| 1969 | /* DMIC fix |
| 1970 | * This laptop has a stereo digital microphone. |
| 1971 | * The mics are only 1cm apart which makes the stereo |
| 1972 | * useless. However, either the mic or the ALC889 |
| 1973 | * makes the signal become a difference/sum signal |
| 1974 | * instead of standard stereo, which is annoying. |
| 1975 | * So instead we flip this bit which makes the |
| 1976 | * codec replicate the sum signal to both channels, |
| 1977 | * turning it into a normal mono mic. |
| 1978 | */ |
| 1979 | /* DMIC_CONTROL? Init value = 0x0001 */ |
| 1980 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b }, |
| 1981 | { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 }, |
| 1982 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 1983 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, |
| 1984 | { } |
Takashi Iwai | 038d4fe | 2012-04-11 17:18:12 +0200 | [diff] [blame] | 1985 | }, |
| 1986 | .chained = true, |
| 1987 | .chain_id = ALC882_FIXUP_GPIO1, |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 1988 | }, |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1989 | [ALC885_FIXUP_MACPRO_GPIO] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1990 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 1991 | .v.func = alc885_fixup_macpro_gpio, |
| 1992 | }, |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1993 | [ALC889_FIXUP_DAC_ROUTE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1994 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 1995 | .v.func = alc889_fixup_dac_route, |
| 1996 | }, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1997 | [ALC889_FIXUP_MBP_VREF] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 1998 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 1999 | .v.func = alc889_fixup_mbp_vref, |
| 2000 | .chained = true, |
| 2001 | .chain_id = ALC882_FIXUP_GPIO1, |
| 2002 | }, |
| 2003 | [ALC889_FIXUP_IMAC91_VREF] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2004 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2005 | .v.func = alc889_fixup_imac91_vref, |
| 2006 | .chained = true, |
| 2007 | .chain_id = ALC882_FIXUP_GPIO1, |
| 2008 | }, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2009 | [ALC882_FIXUP_INV_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2010 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2011 | .v.func = alc_fixup_inv_dmic_0x12, |
| 2012 | }, |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 2013 | [ALC882_FIXUP_NO_PRIMARY_HP] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2014 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 2015 | .v.func = alc882_fixup_no_primary_hp, |
| 2016 | }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2017 | }; |
| 2018 | |
| 2019 | static const struct snd_pci_quirk alc882_fixup_tbl[] = { |
Takashi Iwai | 8812c4f | 2011-11-09 17:39:15 +0100 | [diff] [blame] | 2020 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD), |
| 2021 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
| 2022 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD), |
| 2023 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD), |
| 2024 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD), |
| 2025 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD), |
Takashi Iwai | c3e837b | 2011-11-10 16:01:47 +0100 | [diff] [blame] | 2026 | SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", |
| 2027 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
| 2028 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
| 2029 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
| 2030 | SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G", |
| 2031 | ALC882_FIXUP_ACER_ASPIRE_8930G), |
| 2032 | SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G", |
| 2033 | ALC882_FIXUP_ACER_ASPIRE_8930G), |
| 2034 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
| 2035 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
| 2036 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
| 2037 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
| 2038 | SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G", |
| 2039 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 2040 | SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210), |
Takashi Iwai | f5c53d8 | 2012-05-07 10:07:33 +0200 | [diff] [blame] | 2041 | SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G", |
| 2042 | ALC882_FIXUP_ACER_ASPIRE_4930G), |
Takashi Iwai | 02a237b | 2012-02-13 15:25:07 +0100 | [diff] [blame] | 2043 | SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE), |
Takashi Iwai | fe97da1 | 2012-04-12 08:00:19 +0200 | [diff] [blame] | 2044 | SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G), |
Takashi Iwai | ac9b1cd | 2011-11-09 17:45:55 +0100 | [diff] [blame] | 2045 | SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736), |
Takashi Iwai | 177943a | 2011-11-09 12:55:18 +0100 | [diff] [blame] | 2046 | SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD), |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 2047 | SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V), |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 2048 | SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC), |
Takashi Iwai | 0e7cc2e | 2011-11-09 12:42:48 +0100 | [diff] [blame] | 2049 | SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601), |
Takashi Iwai | ac9b1cd | 2011-11-09 17:45:55 +0100 | [diff] [blame] | 2050 | SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT), |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 2051 | SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP), |
Fernando Luis Vázquez Cao | 12e31a7 | 2013-02-12 16:47:44 +0900 | [diff] [blame] | 2052 | SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP), |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 2053 | |
| 2054 | /* All Apple entries are in codec SSIDs */ |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2055 | SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), |
| 2056 | SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF), |
| 2057 | SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 2058 | SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), |
| 2059 | SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), |
| 2060 | SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2061 | SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF), |
| 2062 | SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF), |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 2063 | SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD), |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2064 | SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF), |
| 2065 | SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBP_VREF), |
| 2066 | SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF), |
| 2067 | SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 2068 | SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO), |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2069 | SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF), |
| 2070 | SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF), |
| 2071 | SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF), |
Josh Boyer | 29ebe40 | 2012-04-12 13:55:36 -0400 | [diff] [blame] | 2072 | SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO), |
Takashi Iwai | 0519363 | 2012-11-12 10:07:36 +0100 | [diff] [blame] | 2073 | SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF), |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2074 | SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF), |
| 2075 | SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF), |
| 2076 | SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF), |
Takashi Iwai | 5671087 | 2011-11-14 17:42:11 +0100 | [diff] [blame] | 2077 | |
Takashi Iwai | 7a6069b | 2011-11-09 15:22:01 +0100 | [diff] [blame] | 2078 | SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD), |
Takashi Iwai | bca4013 | 2012-05-07 11:13:14 +0200 | [diff] [blame] | 2079 | SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), |
Takashi Iwai | eb844d5 | 2011-11-09 18:03:07 +0100 | [diff] [blame] | 2080 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), |
Marton Balint | 8f23921 | 2012-03-05 21:33:23 +0100 | [diff] [blame] | 2081 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3", ALC889_FIXUP_CD), |
Takashi Iwai | 5c0ebfb | 2011-11-07 17:59:13 +0100 | [diff] [blame] | 2082 | SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), |
Takashi Iwai | 7a6069b | 2011-11-09 15:22:01 +0100 | [diff] [blame] | 2083 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), |
| 2084 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), |
Takashi Iwai | ac9b1cd | 2011-11-09 17:45:55 +0100 | [diff] [blame] | 2085 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530), |
Takashi Iwai | 68ef056 | 2011-11-09 18:24:44 +0100 | [diff] [blame] | 2086 | SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2087 | {} |
| 2088 | }; |
| 2089 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2090 | static const struct hda_model_fixup alc882_fixup_models[] = { |
Takashi Iwai | 912093b | 2012-04-11 14:03:41 +0200 | [diff] [blame] | 2091 | {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"}, |
| 2092 | {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"}, |
| 2093 | {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"}, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2094 | {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
Takashi Iwai | e427c23 | 2012-07-29 10:04:08 +0200 | [diff] [blame] | 2095 | {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"}, |
Takashi Iwai | 912093b | 2012-04-11 14:03:41 +0200 | [diff] [blame] | 2096 | {} |
| 2097 | }; |
| 2098 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2099 | /* |
| 2100 | * BIOS auto configuration |
| 2101 | */ |
| 2102 | /* almost identical with ALC880 parser... */ |
| 2103 | static int alc882_parse_auto_config(struct hda_codec *codec) |
| 2104 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2105 | static const hda_nid_t alc882_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2106 | static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
| 2107 | return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2108 | } |
| 2109 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2110 | /* |
| 2111 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2112 | static int patch_alc882(struct hda_codec *codec) |
| 2113 | { |
| 2114 | struct alc_spec *spec; |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2115 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2116 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 2117 | err = alc_alloc_spec(codec, 0x0b); |
| 2118 | if (err < 0) |
| 2119 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2120 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 2121 | spec = codec->spec; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2122 | |
| 2123 | switch (codec->vendor_id) { |
| 2124 | case 0x10ec0882: |
| 2125 | case 0x10ec0885: |
| 2126 | break; |
| 2127 | default: |
| 2128 | /* ALC883 and variants */ |
| 2129 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 2130 | break; |
| 2131 | } |
| 2132 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2133 | snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, |
Takashi Iwai | 912093b | 2012-04-11 14:03:41 +0200 | [diff] [blame] | 2134 | alc882_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2135 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2136 | |
| 2137 | alc_auto_parse_customize_define(codec); |
| 2138 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2139 | if (has_cdefine_beep(codec)) |
| 2140 | spec->gen.beep_nid = 0x01; |
| 2141 | |
Takashi Iwai | 1a97b7f | 2012-02-21 11:11:48 +0100 | [diff] [blame] | 2142 | /* automatic parse from the BIOS config */ |
| 2143 | err = alc882_parse_auto_config(codec); |
| 2144 | if (err < 0) |
| 2145 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2146 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2147 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2148 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 2149 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2150 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2151 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2152 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 2153 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2154 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 2155 | |
| 2156 | error: |
| 2157 | alc_free(codec); |
| 2158 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2159 | } |
| 2160 | |
| 2161 | |
| 2162 | /* |
| 2163 | * ALC262 support |
| 2164 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2165 | static int alc262_parse_auto_config(struct hda_codec *codec) |
| 2166 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2167 | static const hda_nid_t alc262_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2168 | static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
| 2169 | return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2170 | } |
| 2171 | |
| 2172 | /* |
| 2173 | * Pin config fixes |
| 2174 | */ |
| 2175 | enum { |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2176 | ALC262_FIXUP_FSC_H270, |
Takashi Iwai | 7513e6d | 2013-01-18 15:41:34 +0100 | [diff] [blame] | 2177 | ALC262_FIXUP_FSC_S7110, |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2178 | ALC262_FIXUP_HP_Z200, |
| 2179 | ALC262_FIXUP_TYAN, |
Takashi Iwai | c470150 | 2011-11-07 14:20:07 +0100 | [diff] [blame] | 2180 | ALC262_FIXUP_LENOVO_3000, |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2181 | ALC262_FIXUP_BENQ, |
| 2182 | ALC262_FIXUP_BENQ_T31, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2183 | ALC262_FIXUP_INV_DMIC, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2184 | }; |
| 2185 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2186 | static const struct hda_fixup alc262_fixups[] = { |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2187 | [ALC262_FIXUP_FSC_H270] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2188 | .type = HDA_FIXUP_PINS, |
| 2189 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2190 | { 0x14, 0x99130110 }, /* speaker */ |
| 2191 | { 0x15, 0x0221142f }, /* front HP */ |
| 2192 | { 0x1b, 0x0121141f }, /* rear HP */ |
| 2193 | { } |
| 2194 | } |
| 2195 | }, |
Takashi Iwai | 7513e6d | 2013-01-18 15:41:34 +0100 | [diff] [blame] | 2196 | [ALC262_FIXUP_FSC_S7110] = { |
| 2197 | .type = HDA_FIXUP_PINS, |
| 2198 | .v.pins = (const struct hda_pintbl[]) { |
| 2199 | { 0x15, 0x90170110 }, /* speaker */ |
| 2200 | { } |
| 2201 | }, |
| 2202 | .chained = true, |
| 2203 | .chain_id = ALC262_FIXUP_BENQ, |
| 2204 | }, |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2205 | [ALC262_FIXUP_HP_Z200] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2206 | .type = HDA_FIXUP_PINS, |
| 2207 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2208 | { 0x16, 0x99130120 }, /* internal speaker */ |
| 2209 | { } |
| 2210 | } |
| 2211 | }, |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2212 | [ALC262_FIXUP_TYAN] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2213 | .type = HDA_FIXUP_PINS, |
| 2214 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2215 | { 0x14, 0x1993e1f0 }, /* int AUX */ |
| 2216 | { } |
| 2217 | } |
| 2218 | }, |
Takashi Iwai | c470150 | 2011-11-07 14:20:07 +0100 | [diff] [blame] | 2219 | [ALC262_FIXUP_LENOVO_3000] = { |
Takashi Iwai | fd10821 | 2013-01-10 10:18:14 +0100 | [diff] [blame] | 2220 | .type = HDA_FIXUP_PINCTLS, |
| 2221 | .v.pins = (const struct hda_pintbl[]) { |
| 2222 | { 0x19, PIN_VREF50 }, |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2223 | {} |
| 2224 | }, |
| 2225 | .chained = true, |
| 2226 | .chain_id = ALC262_FIXUP_BENQ, |
| 2227 | }, |
| 2228 | [ALC262_FIXUP_BENQ] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2229 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2230 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | c470150 | 2011-11-07 14:20:07 +0100 | [diff] [blame] | 2231 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 2232 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 }, |
| 2233 | {} |
| 2234 | } |
| 2235 | }, |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2236 | [ALC262_FIXUP_BENQ_T31] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2237 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2238 | .v.verbs = (const struct hda_verb[]) { |
| 2239 | { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 }, |
| 2240 | { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 }, |
| 2241 | {} |
| 2242 | } |
| 2243 | }, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2244 | [ALC262_FIXUP_INV_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2245 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2246 | .v.func = alc_fixup_inv_dmic_0x12, |
| 2247 | }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2248 | }; |
| 2249 | |
| 2250 | static const struct snd_pci_quirk alc262_fixup_tbl[] = { |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2251 | SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200), |
Takashi Iwai | 7513e6d | 2013-01-18 15:41:34 +0100 | [diff] [blame] | 2252 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110), |
Takashi Iwai | 3dcd3be | 2011-11-07 14:59:40 +0100 | [diff] [blame] | 2253 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ), |
Takashi Iwai | ea4e7af | 2011-11-07 12:23:55 +0100 | [diff] [blame] | 2254 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN), |
| 2255 | SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270), |
Takashi Iwai | c470150 | 2011-11-07 14:20:07 +0100 | [diff] [blame] | 2256 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000), |
Takashi Iwai | b42590b | 2011-11-07 14:41:01 +0100 | [diff] [blame] | 2257 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ), |
| 2258 | SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2259 | {} |
| 2260 | }; |
| 2261 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2262 | static const struct hda_model_fixup alc262_fixup_models[] = { |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2263 | {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
| 2264 | {} |
| 2265 | }; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2266 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2267 | /* |
| 2268 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2269 | static int patch_alc262(struct hda_codec *codec) |
| 2270 | { |
| 2271 | struct alc_spec *spec; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2272 | int err; |
| 2273 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 2274 | err = alc_alloc_spec(codec, 0x0b); |
| 2275 | if (err < 0) |
| 2276 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2277 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 2278 | spec = codec->spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2279 | spec->gen.shared_mic_vref_pin = 0x18; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2280 | |
| 2281 | #if 0 |
| 2282 | /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is |
| 2283 | * under-run |
| 2284 | */ |
| 2285 | { |
| 2286 | int tmp; |
| 2287 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 2288 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
| 2289 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); |
| 2290 | snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); |
| 2291 | } |
| 2292 | #endif |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2293 | alc_fix_pll_init(codec, 0x20, 0x0a, 10); |
| 2294 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2295 | snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2296 | alc262_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2297 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2298 | |
Takashi Iwai | af741c1 | 2012-05-07 18:09:48 +0200 | [diff] [blame] | 2299 | alc_auto_parse_customize_define(codec); |
| 2300 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2301 | if (has_cdefine_beep(codec)) |
| 2302 | spec->gen.beep_nid = 0x01; |
| 2303 | |
Takashi Iwai | 42399f7 | 2011-11-07 17:18:44 +0100 | [diff] [blame] | 2304 | /* automatic parse from the BIOS config */ |
| 2305 | err = alc262_parse_auto_config(codec); |
| 2306 | if (err < 0) |
| 2307 | goto error; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2308 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2309 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2310 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 2311 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2312 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2313 | spec->shutup = alc_eapd_shutup; |
| 2314 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2315 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 2316 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2317 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 2318 | |
| 2319 | error: |
| 2320 | alc_free(codec); |
| 2321 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2322 | } |
| 2323 | |
| 2324 | /* |
| 2325 | * ALC268 |
| 2326 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2327 | /* bind Beep switches of both NID 0x0f and 0x10 */ |
| 2328 | static const struct hda_bind_ctls alc268_bind_beep_sw = { |
| 2329 | .ops = &snd_hda_bind_sw, |
| 2330 | .values = { |
| 2331 | HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT), |
| 2332 | HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT), |
| 2333 | 0 |
| 2334 | }, |
| 2335 | }; |
| 2336 | |
| 2337 | static const struct snd_kcontrol_new alc268_beep_mixer[] = { |
| 2338 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT), |
| 2339 | HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw), |
| 2340 | { } |
| 2341 | }; |
| 2342 | |
| 2343 | /* set PCBEEP vol = 0, mute connections */ |
| 2344 | static const struct hda_verb alc268_beep_init_verbs[] = { |
| 2345 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
| 2346 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2347 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
| 2348 | { } |
| 2349 | }; |
| 2350 | |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2351 | enum { |
| 2352 | ALC268_FIXUP_INV_DMIC, |
Takashi Iwai | cb76640 | 2012-10-20 10:55:21 +0200 | [diff] [blame] | 2353 | ALC268_FIXUP_HP_EAPD, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2354 | }; |
| 2355 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2356 | static const struct hda_fixup alc268_fixups[] = { |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2357 | [ALC268_FIXUP_INV_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2358 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2359 | .v.func = alc_fixup_inv_dmic_0x12, |
| 2360 | }, |
Takashi Iwai | cb76640 | 2012-10-20 10:55:21 +0200 | [diff] [blame] | 2361 | [ALC268_FIXUP_HP_EAPD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2362 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | cb76640 | 2012-10-20 10:55:21 +0200 | [diff] [blame] | 2363 | .v.verbs = (const struct hda_verb[]) { |
| 2364 | {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 2365 | {} |
| 2366 | } |
| 2367 | }, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2368 | }; |
| 2369 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2370 | static const struct hda_model_fixup alc268_fixup_models[] = { |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2371 | {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
Takashi Iwai | cb76640 | 2012-10-20 10:55:21 +0200 | [diff] [blame] | 2372 | {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"}, |
| 2373 | {} |
| 2374 | }; |
| 2375 | |
| 2376 | static const struct snd_pci_quirk alc268_fixup_tbl[] = { |
David Henningsson | fcd8f3b | 2013-01-28 05:45:47 +0100 | [diff] [blame] | 2377 | SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC), |
Takashi Iwai | cb76640 | 2012-10-20 10:55:21 +0200 | [diff] [blame] | 2378 | /* below is codec SSID since multiple Toshiba laptops have the |
| 2379 | * same PCI SSID 1179:ff00 |
| 2380 | */ |
| 2381 | SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD), |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2382 | {} |
| 2383 | }; |
| 2384 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2385 | /* |
| 2386 | * BIOS auto configuration |
| 2387 | */ |
| 2388 | static int alc268_parse_auto_config(struct hda_codec *codec) |
| 2389 | { |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2390 | static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2391 | return alc_parse_auto_config(codec, NULL, alc268_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2392 | } |
| 2393 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2394 | /* |
| 2395 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2396 | static int patch_alc268(struct hda_codec *codec) |
| 2397 | { |
| 2398 | struct alc_spec *spec; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2399 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2400 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2401 | /* ALC268 has no aa-loopback mixer */ |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 2402 | err = alc_alloc_spec(codec, 0); |
| 2403 | if (err < 0) |
| 2404 | return err; |
| 2405 | |
| 2406 | spec = codec->spec; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2407 | spec->gen.beep_nid = 0x01; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2408 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2409 | snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); |
| 2410 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2411 | |
Takashi Iwai | 6ebb805 | 2011-08-16 15:15:40 +0200 | [diff] [blame] | 2412 | /* automatic parse from the BIOS config */ |
| 2413 | err = alc268_parse_auto_config(codec); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 2414 | if (err < 0) |
| 2415 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2416 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 2417 | if (err > 0 && !spec->gen.no_analog && |
| 2418 | spec->gen.autocfg.speaker_pins[0] != 0x1d) { |
| 2419 | add_mixer(spec, alc268_beep_mixer); |
| 2420 | snd_hda_add_verbs(codec, alc268_beep_init_verbs); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2421 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) |
| 2422 | /* override the amp caps for beep generator */ |
| 2423 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, |
| 2424 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
| 2425 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 2426 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 2427 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
| 2428 | } |
| 2429 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2430 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2431 | spec->shutup = alc_eapd_shutup; |
| 2432 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2433 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2434 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2435 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 2436 | |
| 2437 | error: |
| 2438 | alc_free(codec); |
| 2439 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2440 | } |
| 2441 | |
| 2442 | /* |
| 2443 | * ALC269 |
| 2444 | */ |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2445 | |
| 2446 | static int playback_pcm_open(struct hda_pcm_stream *hinfo, |
| 2447 | struct hda_codec *codec, |
| 2448 | struct snd_pcm_substream *substream) |
| 2449 | { |
| 2450 | struct hda_gen_spec *spec = codec->spec; |
| 2451 | return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream, |
| 2452 | hinfo); |
| 2453 | } |
| 2454 | |
| 2455 | static int playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| 2456 | struct hda_codec *codec, |
| 2457 | unsigned int stream_tag, |
| 2458 | unsigned int format, |
| 2459 | struct snd_pcm_substream *substream) |
| 2460 | { |
| 2461 | struct hda_gen_spec *spec = codec->spec; |
| 2462 | return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, |
| 2463 | stream_tag, format, substream); |
| 2464 | } |
| 2465 | |
| 2466 | static int playback_pcm_cleanup(struct hda_pcm_stream *hinfo, |
| 2467 | struct hda_codec *codec, |
| 2468 | struct snd_pcm_substream *substream) |
| 2469 | { |
| 2470 | struct hda_gen_spec *spec = codec->spec; |
| 2471 | return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); |
| 2472 | } |
| 2473 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2474 | static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = { |
| 2475 | .substreams = 1, |
| 2476 | .channels_min = 2, |
| 2477 | .channels_max = 8, |
| 2478 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 2479 | /* NID is set in alc_build_pcms */ |
| 2480 | .ops = { |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2481 | .open = playback_pcm_open, |
| 2482 | .prepare = playback_pcm_prepare, |
| 2483 | .cleanup = playback_pcm_cleanup |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2484 | }, |
| 2485 | }; |
| 2486 | |
| 2487 | static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = { |
| 2488 | .substreams = 1, |
| 2489 | .channels_min = 2, |
| 2490 | .channels_max = 2, |
| 2491 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ |
| 2492 | /* NID is set in alc_build_pcms */ |
| 2493 | }; |
| 2494 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2495 | /* different alc269-variants */ |
| 2496 | enum { |
| 2497 | ALC269_TYPE_ALC269VA, |
| 2498 | ALC269_TYPE_ALC269VB, |
| 2499 | ALC269_TYPE_ALC269VC, |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2500 | ALC269_TYPE_ALC269VD, |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 2501 | ALC269_TYPE_ALC280, |
| 2502 | ALC269_TYPE_ALC282, |
| 2503 | ALC269_TYPE_ALC284, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2504 | }; |
| 2505 | |
| 2506 | /* |
| 2507 | * BIOS auto configuration |
| 2508 | */ |
| 2509 | static int alc269_parse_auto_config(struct hda_codec *codec) |
| 2510 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2511 | static const hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2512 | static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 }; |
| 2513 | static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
| 2514 | struct alc_spec *spec = codec->spec; |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2515 | const hda_nid_t *ssids; |
| 2516 | |
| 2517 | switch (spec->codec_variant) { |
| 2518 | case ALC269_TYPE_ALC269VA: |
| 2519 | case ALC269_TYPE_ALC269VC: |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 2520 | case ALC269_TYPE_ALC280: |
| 2521 | case ALC269_TYPE_ALC284: |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2522 | ssids = alc269va_ssids; |
| 2523 | break; |
| 2524 | case ALC269_TYPE_ALC269VB: |
| 2525 | case ALC269_TYPE_ALC269VD: |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 2526 | case ALC269_TYPE_ALC282: |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2527 | ssids = alc269_ssids; |
| 2528 | break; |
| 2529 | default: |
| 2530 | ssids = alc269_ssids; |
| 2531 | break; |
| 2532 | } |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2533 | |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 2534 | return alc_parse_auto_config(codec, alc269_ignore, ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2535 | } |
| 2536 | |
Kailang Yang | 1387e2d | 2012-11-08 10:23:18 +0100 | [diff] [blame] | 2537 | static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2538 | { |
| 2539 | int val = alc_read_coef_idx(codec, 0x04); |
| 2540 | if (power_up) |
| 2541 | val |= 1 << 11; |
| 2542 | else |
| 2543 | val &= ~(1 << 11); |
| 2544 | alc_write_coef_idx(codec, 0x04, val); |
| 2545 | } |
| 2546 | |
| 2547 | static void alc269_shutup(struct hda_codec *codec) |
| 2548 | { |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2549 | struct alc_spec *spec = codec->spec; |
| 2550 | |
| 2551 | if (spec->codec_variant != ALC269_TYPE_ALC269VB) |
| 2552 | return; |
| 2553 | |
Kailang Yang | 1387e2d | 2012-11-08 10:23:18 +0100 | [diff] [blame] | 2554 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
| 2555 | alc269vb_toggle_power_output(codec, 0); |
| 2556 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && |
| 2557 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2558 | msleep(150); |
| 2559 | } |
| 2560 | } |
| 2561 | |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 2562 | #ifdef CONFIG_PM |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2563 | static int alc269_resume(struct hda_codec *codec) |
| 2564 | { |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2565 | struct alc_spec *spec = codec->spec; |
| 2566 | |
Kailang Yang | 1387e2d | 2012-11-08 10:23:18 +0100 | [diff] [blame] | 2567 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
| 2568 | alc269vb_toggle_power_output(codec, 0); |
| 2569 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2570 | (alc_get_coef0(codec) & 0x00ff) == 0x018) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2571 | msleep(150); |
| 2572 | } |
| 2573 | |
| 2574 | codec->patch_ops.init(codec); |
| 2575 | |
Kailang Yang | 1387e2d | 2012-11-08 10:23:18 +0100 | [diff] [blame] | 2576 | if (spec->codec_variant == ALC269_TYPE_ALC269VB) |
| 2577 | alc269vb_toggle_power_output(codec, 1); |
| 2578 | if (spec->codec_variant == ALC269_TYPE_ALC269VB && |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 2579 | (alc_get_coef0(codec) & 0x00ff) == 0x017) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2580 | msleep(200); |
| 2581 | } |
| 2582 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2583 | snd_hda_codec_resume_amp(codec); |
| 2584 | snd_hda_codec_resume_cache(codec); |
| 2585 | hda_call_check_power_status(codec, 0x01); |
| 2586 | return 0; |
| 2587 | } |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 2588 | #endif /* CONFIG_PM */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2589 | |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2590 | static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2591 | const struct hda_fixup *fix, int action) |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2592 | { |
| 2593 | struct alc_spec *spec = codec->spec; |
| 2594 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2595 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2596 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
| 2597 | } |
| 2598 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2599 | static void alc269_fixup_hweq(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2600 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2601 | { |
| 2602 | int coef; |
| 2603 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2604 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2605 | return; |
| 2606 | coef = alc_read_coef_idx(codec, 0x1e); |
| 2607 | alc_write_coef_idx(codec, 0x1e, coef | 0x80); |
| 2608 | } |
| 2609 | |
| 2610 | static void alc271_fixup_dmic(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2611 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2612 | { |
| 2613 | static const struct hda_verb verbs[] = { |
| 2614 | {0x20, AC_VERB_SET_COEF_INDEX, 0x0d}, |
| 2615 | {0x20, AC_VERB_SET_PROC_COEF, 0x4000}, |
| 2616 | {} |
| 2617 | }; |
| 2618 | unsigned int cfg; |
| 2619 | |
| 2620 | if (strcmp(codec->chip_name, "ALC271X")) |
| 2621 | return; |
| 2622 | cfg = snd_hda_codec_get_pincfg(codec, 0x12); |
| 2623 | if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED) |
| 2624 | snd_hda_sequence_write(codec, verbs); |
| 2625 | } |
| 2626 | |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2627 | static void alc269_fixup_pcm_44k(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2628 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2629 | { |
| 2630 | struct alc_spec *spec = codec->spec; |
| 2631 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2632 | if (action != HDA_FIXUP_ACT_PROBE) |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2633 | return; |
| 2634 | |
| 2635 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
| 2636 | * fix the sample rate of analog I/O to 44.1kHz |
| 2637 | */ |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2638 | spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; |
| 2639 | spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2640 | } |
| 2641 | |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2642 | static void alc269_fixup_stereo_dmic(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2643 | const struct hda_fixup *fix, int action) |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2644 | { |
| 2645 | int coef; |
| 2646 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2647 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2648 | return; |
| 2649 | /* The digital-mic unit sends PDM (differential signal) instead of |
| 2650 | * the standard PCM, thus you can't record a valid mono stream as is. |
| 2651 | * Below is a workaround specific to ALC269 to control the dmic |
| 2652 | * signal source as mono. |
| 2653 | */ |
| 2654 | coef = alc_read_coef_idx(codec, 0x07); |
| 2655 | alc_write_coef_idx(codec, 0x07, coef | 0x80); |
| 2656 | } |
| 2657 | |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2658 | static void alc269_quanta_automute(struct hda_codec *codec) |
| 2659 | { |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2660 | snd_hda_gen_update_outputs(codec); |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2661 | |
| 2662 | snd_hda_codec_write(codec, 0x20, 0, |
| 2663 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 2664 | snd_hda_codec_write(codec, 0x20, 0, |
| 2665 | AC_VERB_SET_PROC_COEF, 0x680); |
| 2666 | |
| 2667 | snd_hda_codec_write(codec, 0x20, 0, |
| 2668 | AC_VERB_SET_COEF_INDEX, 0x0c); |
| 2669 | snd_hda_codec_write(codec, 0x20, 0, |
| 2670 | AC_VERB_SET_PROC_COEF, 0x480); |
| 2671 | } |
| 2672 | |
| 2673 | static void alc269_fixup_quanta_mute(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2674 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2675 | { |
| 2676 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2677 | if (action != HDA_FIXUP_ACT_PROBE) |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2678 | return; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2679 | spec->gen.automute_hook = alc269_quanta_automute; |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2680 | } |
| 2681 | |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2682 | /* update mute-LED according to the speaker mute state via mic VREF pin */ |
| 2683 | static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) |
David Henningsson | 6d3cd5d | 2013-01-07 12:03:47 +0100 | [diff] [blame] | 2684 | { |
| 2685 | struct hda_codec *codec = private_data; |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2686 | struct alc_spec *spec = codec->spec; |
| 2687 | unsigned int pinval; |
| 2688 | |
| 2689 | if (spec->mute_led_polarity) |
| 2690 | enabled = !enabled; |
| 2691 | pinval = AC_PINCTL_IN_EN | |
| 2692 | (enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80); |
| 2693 | if (spec->mute_led_nid) |
| 2694 | snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); |
David Henningsson | 6d3cd5d | 2013-01-07 12:03:47 +0100 | [diff] [blame] | 2695 | } |
| 2696 | |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2697 | static void alc269_fixup_hp_mute_led(struct hda_codec *codec, |
| 2698 | const struct hda_fixup *fix, int action) |
David Henningsson | 6d3cd5d | 2013-01-07 12:03:47 +0100 | [diff] [blame] | 2699 | { |
| 2700 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2701 | const struct dmi_device *dev = NULL; |
| 2702 | |
| 2703 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
| 2704 | return; |
| 2705 | |
| 2706 | while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { |
| 2707 | int pol, pin; |
| 2708 | if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) |
| 2709 | continue; |
| 2710 | if (pin < 0x0a || pin >= 0x10) |
| 2711 | break; |
| 2712 | spec->mute_led_polarity = pol; |
| 2713 | spec->mute_led_nid = pin - 0x0a + 0x18; |
| 2714 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; |
Takashi Iwai | fd25a97 | 2012-12-20 14:57:18 +0100 | [diff] [blame] | 2715 | spec->gen.vmaster_mute_enum = 1; |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2716 | snd_printd("Detected mute LED for %x:%d\n", spec->mute_led_nid, |
| 2717 | spec->mute_led_polarity); |
David Henningsson | 6d3cd5d | 2013-01-07 12:03:47 +0100 | [diff] [blame] | 2718 | break; |
| 2719 | } |
| 2720 | } |
| 2721 | |
David Henningsson | d06ac14 | 2013-02-18 11:41:55 +0100 | [diff] [blame] | 2722 | static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, |
| 2723 | const struct hda_fixup *fix, int action) |
| 2724 | { |
| 2725 | struct alc_spec *spec = codec->spec; |
| 2726 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 2727 | spec->mute_led_polarity = 0; |
| 2728 | spec->mute_led_nid = 0x18; |
| 2729 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; |
| 2730 | spec->gen.vmaster_mute_enum = 1; |
| 2731 | } |
| 2732 | } |
| 2733 | |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2734 | static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, |
| 2735 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 420b0fe | 2012-03-12 12:35:27 +0100 | [diff] [blame] | 2736 | { |
| 2737 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 9bb1f06 | 2013-01-10 17:14:29 +0100 | [diff] [blame] | 2738 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2739 | spec->mute_led_polarity = 0; |
| 2740 | spec->mute_led_nid = 0x19; |
| 2741 | spec->gen.vmaster_mute.hook = alc269_fixup_mic_mute_hook; |
Takashi Iwai | fd25a97 | 2012-12-20 14:57:18 +0100 | [diff] [blame] | 2742 | spec->gen.vmaster_mute_enum = 1; |
Takashi Iwai | 420b0fe | 2012-03-12 12:35:27 +0100 | [diff] [blame] | 2743 | } |
| 2744 | } |
| 2745 | |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 2746 | /* turn on/off mute LED per vmaster hook */ |
| 2747 | static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled) |
| 2748 | { |
| 2749 | struct hda_codec *codec = private_data; |
| 2750 | struct alc_spec *spec = codec->spec; |
| 2751 | unsigned int oldval = spec->gpio_led; |
| 2752 | |
| 2753 | if (enabled) |
| 2754 | spec->gpio_led &= ~0x08; |
| 2755 | else |
| 2756 | spec->gpio_led |= 0x08; |
| 2757 | if (spec->gpio_led != oldval) |
| 2758 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
| 2759 | spec->gpio_led); |
| 2760 | } |
| 2761 | |
| 2762 | /* turn on/off mic-mute LED per capture hook */ |
| 2763 | static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec, |
| 2764 | struct snd_ctl_elem_value *ucontrol) |
| 2765 | { |
| 2766 | struct alc_spec *spec = codec->spec; |
| 2767 | unsigned int oldval = spec->gpio_led; |
| 2768 | |
| 2769 | if (!ucontrol) |
| 2770 | return; |
| 2771 | |
| 2772 | if (ucontrol->value.integer.value[0] || |
| 2773 | ucontrol->value.integer.value[1]) |
| 2774 | spec->gpio_led &= ~0x10; |
| 2775 | else |
| 2776 | spec->gpio_led |= 0x10; |
| 2777 | if (spec->gpio_led != oldval) |
| 2778 | snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, |
| 2779 | spec->gpio_led); |
| 2780 | } |
| 2781 | |
| 2782 | static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, |
| 2783 | const struct hda_fixup *fix, int action) |
| 2784 | { |
| 2785 | struct alc_spec *spec = codec->spec; |
| 2786 | static const struct hda_verb gpio_init[] = { |
| 2787 | { 0x01, AC_VERB_SET_GPIO_MASK, 0x18 }, |
| 2788 | { 0x01, AC_VERB_SET_GPIO_DIRECTION, 0x18 }, |
| 2789 | {} |
| 2790 | }; |
| 2791 | |
| 2792 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
| 2793 | spec->gen.vmaster_mute.hook = alc269_fixup_hp_gpio_mute_hook; |
| 2794 | spec->gen.cap_sync_hook = alc269_fixup_hp_gpio_mic_mute_hook; |
| 2795 | spec->gpio_led = 0; |
| 2796 | snd_hda_add_verbs(codec, gpio_init); |
| 2797 | } |
| 2798 | } |
| 2799 | |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 2800 | static void alc271_hp_gate_mic_jack(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2801 | const struct hda_fixup *fix, |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 2802 | int action) |
| 2803 | { |
| 2804 | struct alc_spec *spec = codec->spec; |
| 2805 | |
Takashi Iwai | 0db7579 | 2013-01-23 13:57:20 +0100 | [diff] [blame] | 2806 | if (action == HDA_FIXUP_ACT_PROBE) { |
| 2807 | if (snd_BUG_ON(!spec->gen.am_entry[1].pin || |
| 2808 | !spec->gen.autocfg.hp_pins[0])) |
| 2809 | return; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 2810 | snd_hda_jack_set_gating_jack(codec, spec->gen.am_entry[1].pin, |
| 2811 | spec->gen.autocfg.hp_pins[0]); |
Takashi Iwai | 0db7579 | 2013-01-23 13:57:20 +0100 | [diff] [blame] | 2812 | } |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 2813 | } |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 2814 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2815 | enum { |
| 2816 | ALC269_FIXUP_SONY_VAIO, |
| 2817 | ALC275_FIXUP_SONY_VAIO_GPIO2, |
| 2818 | ALC269_FIXUP_DELL_M101Z, |
| 2819 | ALC269_FIXUP_SKU_IGNORE, |
| 2820 | ALC269_FIXUP_ASUS_G73JW, |
| 2821 | ALC269_FIXUP_LENOVO_EAPD, |
| 2822 | ALC275_FIXUP_SONY_HWEQ, |
| 2823 | ALC271_FIXUP_DMIC, |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2824 | ALC269_FIXUP_PCM_44K, |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2825 | ALC269_FIXUP_STEREO_DMIC, |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2826 | ALC269_FIXUP_QUANTA_MUTE, |
| 2827 | ALC269_FIXUP_LIFEBOOK, |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2828 | ALC269_FIXUP_AMIC, |
| 2829 | ALC269_FIXUP_DMIC, |
| 2830 | ALC269VB_FIXUP_AMIC, |
| 2831 | ALC269VB_FIXUP_DMIC, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2832 | ALC269_FIXUP_HP_MUTE_LED, |
David Henningsson | d06ac14 | 2013-02-18 11:41:55 +0100 | [diff] [blame] | 2833 | ALC269_FIXUP_HP_MUTE_LED_MIC1, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2834 | ALC269_FIXUP_HP_MUTE_LED_MIC2, |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 2835 | ALC269_FIXUP_HP_GPIO_LED, |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 2836 | ALC269_FIXUP_INV_DMIC, |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2837 | ALC269_FIXUP_LENOVO_DOCK, |
| 2838 | ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 2839 | ALC271_FIXUP_AMIC_MIC2, |
| 2840 | ALC271_FIXUP_HP_GATE_MIC_JACK, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2841 | }; |
| 2842 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2843 | static const struct hda_fixup alc269_fixups[] = { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2844 | [ALC269_FIXUP_SONY_VAIO] = { |
Takashi Iwai | fd10821 | 2013-01-10 10:18:14 +0100 | [diff] [blame] | 2845 | .type = HDA_FIXUP_PINCTLS, |
| 2846 | .v.pins = (const struct hda_pintbl[]) { |
| 2847 | {0x19, PIN_VREFGRD}, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2848 | {} |
| 2849 | } |
| 2850 | }, |
| 2851 | [ALC275_FIXUP_SONY_VAIO_GPIO2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2852 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2853 | .v.verbs = (const struct hda_verb[]) { |
| 2854 | {0x01, AC_VERB_SET_GPIO_MASK, 0x04}, |
| 2855 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, |
| 2856 | {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, |
| 2857 | { } |
| 2858 | }, |
| 2859 | .chained = true, |
| 2860 | .chain_id = ALC269_FIXUP_SONY_VAIO |
| 2861 | }, |
| 2862 | [ALC269_FIXUP_DELL_M101Z] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2863 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2864 | .v.verbs = (const struct hda_verb[]) { |
| 2865 | /* Enables internal speaker */ |
| 2866 | {0x20, AC_VERB_SET_COEF_INDEX, 13}, |
| 2867 | {0x20, AC_VERB_SET_PROC_COEF, 0x4040}, |
| 2868 | {} |
| 2869 | } |
| 2870 | }, |
| 2871 | [ALC269_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2872 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 2873 | .v.func = alc_fixup_sku_ignore, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2874 | }, |
| 2875 | [ALC269_FIXUP_ASUS_G73JW] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2876 | .type = HDA_FIXUP_PINS, |
| 2877 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2878 | { 0x17, 0x99130111 }, /* subwoofer */ |
| 2879 | { } |
| 2880 | } |
| 2881 | }, |
| 2882 | [ALC269_FIXUP_LENOVO_EAPD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2883 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2884 | .v.verbs = (const struct hda_verb[]) { |
| 2885 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 2886 | {} |
| 2887 | } |
| 2888 | }, |
| 2889 | [ALC275_FIXUP_SONY_HWEQ] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2890 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2891 | .v.func = alc269_fixup_hweq, |
| 2892 | .chained = true, |
| 2893 | .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2 |
| 2894 | }, |
| 2895 | [ALC271_FIXUP_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2896 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 2897 | .v.func = alc271_fixup_dmic, |
| 2898 | }, |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2899 | [ALC269_FIXUP_PCM_44K] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2900 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2901 | .v.func = alc269_fixup_pcm_44k, |
David Henningsson | 012e7eb | 2012-08-08 08:43:37 +0200 | [diff] [blame] | 2902 | .chained = true, |
| 2903 | .chain_id = ALC269_FIXUP_QUANTA_MUTE |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 2904 | }, |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2905 | [ALC269_FIXUP_STEREO_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2906 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 2907 | .v.func = alc269_fixup_stereo_dmic, |
| 2908 | }, |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2909 | [ALC269_FIXUP_QUANTA_MUTE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2910 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2911 | .v.func = alc269_fixup_quanta_mute, |
| 2912 | }, |
| 2913 | [ALC269_FIXUP_LIFEBOOK] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2914 | .type = HDA_FIXUP_PINS, |
| 2915 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 2916 | { 0x1a, 0x2101103f }, /* dock line-out */ |
| 2917 | { 0x1b, 0x23a11040 }, /* dock mic-in */ |
| 2918 | { } |
| 2919 | }, |
| 2920 | .chained = true, |
| 2921 | .chain_id = ALC269_FIXUP_QUANTA_MUTE |
| 2922 | }, |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2923 | [ALC269_FIXUP_AMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2924 | .type = HDA_FIXUP_PINS, |
| 2925 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2926 | { 0x14, 0x99130110 }, /* speaker */ |
| 2927 | { 0x15, 0x0121401f }, /* HP out */ |
| 2928 | { 0x18, 0x01a19c20 }, /* mic */ |
| 2929 | { 0x19, 0x99a3092f }, /* int-mic */ |
| 2930 | { } |
| 2931 | }, |
| 2932 | }, |
| 2933 | [ALC269_FIXUP_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2934 | .type = HDA_FIXUP_PINS, |
| 2935 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2936 | { 0x12, 0x99a3092f }, /* int-mic */ |
| 2937 | { 0x14, 0x99130110 }, /* speaker */ |
| 2938 | { 0x15, 0x0121401f }, /* HP out */ |
| 2939 | { 0x18, 0x01a19c20 }, /* mic */ |
| 2940 | { } |
| 2941 | }, |
| 2942 | }, |
| 2943 | [ALC269VB_FIXUP_AMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2944 | .type = HDA_FIXUP_PINS, |
| 2945 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2946 | { 0x14, 0x99130110 }, /* speaker */ |
| 2947 | { 0x18, 0x01a19c20 }, /* mic */ |
| 2948 | { 0x19, 0x99a3092f }, /* int-mic */ |
| 2949 | { 0x21, 0x0121401f }, /* HP out */ |
| 2950 | { } |
| 2951 | }, |
| 2952 | }, |
David Henningsson | 2267ea9 | 2012-01-03 08:45:56 +0100 | [diff] [blame] | 2953 | [ALC269VB_FIXUP_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2954 | .type = HDA_FIXUP_PINS, |
| 2955 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 2956 | { 0x12, 0x99a3092f }, /* int-mic */ |
| 2957 | { 0x14, 0x99130110 }, /* speaker */ |
| 2958 | { 0x18, 0x01a19c20 }, /* mic */ |
| 2959 | { 0x21, 0x0121401f }, /* HP out */ |
| 2960 | { } |
| 2961 | }, |
| 2962 | }, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2963 | [ALC269_FIXUP_HP_MUTE_LED] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2964 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2965 | .v.func = alc269_fixup_hp_mute_led, |
David Henningsson | 6d3cd5d | 2013-01-07 12:03:47 +0100 | [diff] [blame] | 2966 | }, |
David Henningsson | d06ac14 | 2013-02-18 11:41:55 +0100 | [diff] [blame] | 2967 | [ALC269_FIXUP_HP_MUTE_LED_MIC1] = { |
| 2968 | .type = HDA_FIXUP_FUNC, |
| 2969 | .v.func = alc269_fixup_hp_mute_led_mic1, |
| 2970 | }, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2971 | [ALC269_FIXUP_HP_MUTE_LED_MIC2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2972 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 2973 | .v.func = alc269_fixup_hp_mute_led_mic2, |
Takashi Iwai | 420b0fe | 2012-03-12 12:35:27 +0100 | [diff] [blame] | 2974 | }, |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 2975 | [ALC269_FIXUP_HP_GPIO_LED] = { |
| 2976 | .type = HDA_FIXUP_FUNC, |
| 2977 | .v.func = alc269_fixup_hp_gpio_led, |
| 2978 | }, |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 2979 | [ALC269_FIXUP_INV_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2980 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 2981 | .v.func = alc_fixup_inv_dmic_0x12, |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 2982 | }, |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2983 | [ALC269_FIXUP_LENOVO_DOCK] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2984 | .type = HDA_FIXUP_PINS, |
| 2985 | .v.pins = (const struct hda_pintbl[]) { |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2986 | { 0x19, 0x23a11040 }, /* dock mic */ |
| 2987 | { 0x1b, 0x2121103f }, /* dock headphone */ |
| 2988 | { } |
| 2989 | }, |
| 2990 | .chained = true, |
| 2991 | .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT |
| 2992 | }, |
| 2993 | [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2994 | .type = HDA_FIXUP_FUNC, |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 2995 | .v.func = alc269_fixup_pincfg_no_hp_to_lineout, |
| 2996 | }, |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 2997 | [ALC271_FIXUP_AMIC_MIC2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 2998 | .type = HDA_FIXUP_PINS, |
| 2999 | .v.pins = (const struct hda_pintbl[]) { |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 3000 | { 0x14, 0x99130110 }, /* speaker */ |
| 3001 | { 0x19, 0x01a19c20 }, /* mic */ |
| 3002 | { 0x1b, 0x99a7012f }, /* int-mic */ |
| 3003 | { 0x21, 0x0121401f }, /* HP out */ |
| 3004 | { } |
| 3005 | }, |
| 3006 | }, |
| 3007 | [ALC271_FIXUP_HP_GATE_MIC_JACK] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3008 | .type = HDA_FIXUP_FUNC, |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 3009 | .v.func = alc271_hp_gate_mic_jack, |
| 3010 | .chained = true, |
| 3011 | .chain_id = ALC271_FIXUP_AMIC_MIC2, |
| 3012 | }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3013 | }; |
| 3014 | |
| 3015 | static const struct snd_pci_quirk alc269_fixup_tbl[] = { |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 3016 | SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), |
| 3017 | SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 3018 | SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 3019 | SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED), |
David Henningsson | d06ac14 | 2013-02-18 11:41:55 +0100 | [diff] [blame] | 3020 | SND_PCI_QUIRK(0x103c, 0x1973, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
| 3021 | SND_PCI_QUIRK(0x103c, 0x1983, "HP Pavilion", ALC269_FIXUP_HP_MUTE_LED_MIC1), |
Takashi Iwai | 08fb0d0 | 2013-01-10 17:33:58 +0100 | [diff] [blame] | 3022 | SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED), |
David Henningsson | 5ac5755 | 2012-04-20 10:01:46 +0200 | [diff] [blame] | 3023 | SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), |
Oleksij Rempel | 148728f | 2012-09-21 17:44:58 +0200 | [diff] [blame] | 3024 | SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), |
Takashi Iwai | 017f2a1 | 2011-07-09 14:42:25 +0200 | [diff] [blame] | 3025 | SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), |
David Henningsson | 693b613 | 2012-06-22 19:12:10 +0200 | [diff] [blame] | 3026 | SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC), |
Takashi Iwai | adabb3e | 2011-08-03 07:48:37 +0200 | [diff] [blame] | 3027 | SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC), |
| 3028 | SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC), |
| 3029 | SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC), |
| 3030 | SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), |
| 3031 | SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3032 | SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), |
| 3033 | SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 3034 | SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), |
| 3035 | SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), |
| 3036 | SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), |
Takashi Iwai | ec50b4c | 2013-01-19 12:17:54 +0100 | [diff] [blame] | 3037 | SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), |
Dylan Reid | 08a978d | 2012-11-18 22:56:40 -0800 | [diff] [blame] | 3038 | SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3039 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), |
Takashi Iwai | 2451991 | 2011-08-16 15:08:49 +0200 | [diff] [blame] | 3040 | SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3041 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), |
| 3042 | SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE), |
| 3043 | SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE), |
| 3044 | SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE), |
| 3045 | SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE), |
Takashi Iwai | 707fba3 | 2012-08-02 09:04:39 +0200 | [diff] [blame] | 3046 | SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK), |
Felix Kaechele | c8415a4 | 2012-08-06 23:02:01 +0200 | [diff] [blame] | 3047 | SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK), |
Stefán Freyr | 84f98fd | 2012-10-19 22:46:00 +0200 | [diff] [blame] | 3048 | SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK), |
Philipp A. Mohrenweiser | 4407be6 | 2012-08-06 13:14:18 +0200 | [diff] [blame] | 3049 | SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 3050 | SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), |
David Henningsson | 012e7eb | 2012-08-08 08:43:37 +0200 | [diff] [blame] | 3051 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3052 | SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3053 | |
Takashi Iwai | a7f3eed | 2012-02-16 13:03:18 +0100 | [diff] [blame] | 3054 | #if 0 |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3055 | /* Below is a quirk table taken from the old code. |
| 3056 | * Basically the device should work as is without the fixup table. |
| 3057 | * If BIOS doesn't give a proper info, enable the corresponding |
| 3058 | * fixup entry. |
Jesper Juhl | 7d7eb9e | 2012-04-12 22:11:25 +0200 | [diff] [blame] | 3059 | */ |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3060 | SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", |
| 3061 | ALC269_FIXUP_AMIC), |
| 3062 | SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC), |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3063 | SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC), |
| 3064 | SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC), |
| 3065 | SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC), |
| 3066 | SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC), |
| 3067 | SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC), |
| 3068 | SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC), |
| 3069 | SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC), |
| 3070 | SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC), |
| 3071 | SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC), |
| 3072 | SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC), |
| 3073 | SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC), |
| 3074 | SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC), |
| 3075 | SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC), |
| 3076 | SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC), |
| 3077 | SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC), |
| 3078 | SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC), |
| 3079 | SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC), |
| 3080 | SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC), |
| 3081 | SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC), |
| 3082 | SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC), |
| 3083 | SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC), |
| 3084 | SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC), |
| 3085 | SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC), |
| 3086 | SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC), |
| 3087 | SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC), |
| 3088 | SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC), |
| 3089 | SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC), |
| 3090 | SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC), |
| 3091 | SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC), |
| 3092 | SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC), |
| 3093 | SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC), |
| 3094 | SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC), |
| 3095 | SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC), |
| 3096 | SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC), |
| 3097 | SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC), |
| 3098 | SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC), |
| 3099 | SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC), |
| 3100 | SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC), |
| 3101 | #endif |
| 3102 | {} |
| 3103 | }; |
| 3104 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3105 | static const struct hda_model_fixup alc269_fixup_models[] = { |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3106 | {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"}, |
| 3107 | {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"}, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 3108 | {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"}, |
| 3109 | {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"}, |
| 3110 | {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
David Henningsson | 108cc10 | 2012-07-20 10:37:25 +0200 | [diff] [blame] | 3111 | {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"}, |
Takashi Iwai | 9f5c6fa | 2013-03-18 14:15:58 +0100 | [diff] [blame^] | 3112 | {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3113 | {} |
| 3114 | }; |
| 3115 | |
| 3116 | |
Takashi Iwai | 546bb67 | 2012-03-07 08:37:19 +0100 | [diff] [blame] | 3117 | static void alc269_fill_coef(struct hda_codec *codec) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3118 | { |
Kailang Yang | 526af6e | 2012-03-07 08:25:20 +0100 | [diff] [blame] | 3119 | struct alc_spec *spec = codec->spec; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3120 | int val; |
| 3121 | |
Kailang Yang | 526af6e | 2012-03-07 08:25:20 +0100 | [diff] [blame] | 3122 | if (spec->codec_variant != ALC269_TYPE_ALC269VB) |
Takashi Iwai | 546bb67 | 2012-03-07 08:37:19 +0100 | [diff] [blame] | 3123 | return; |
Kailang Yang | 526af6e | 2012-03-07 08:25:20 +0100 | [diff] [blame] | 3124 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3125 | if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3126 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 3127 | alc_write_coef_idx(codec, 0xe, 0x8817); |
| 3128 | } |
| 3129 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3130 | if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3131 | alc_write_coef_idx(codec, 0xf, 0x960b); |
| 3132 | alc_write_coef_idx(codec, 0xe, 0x8814); |
| 3133 | } |
| 3134 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3135 | if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3136 | val = alc_read_coef_idx(codec, 0x04); |
| 3137 | /* Power up output pin */ |
| 3138 | alc_write_coef_idx(codec, 0x04, val | (1<<11)); |
| 3139 | } |
| 3140 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3141 | if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3142 | val = alc_read_coef_idx(codec, 0xd); |
| 3143 | if ((val & 0x0c00) >> 10 != 0x1) { |
| 3144 | /* Capless ramp up clock control */ |
| 3145 | alc_write_coef_idx(codec, 0xd, val | (1<<10)); |
| 3146 | } |
| 3147 | val = alc_read_coef_idx(codec, 0x17); |
| 3148 | if ((val & 0x01c0) >> 6 != 0x4) { |
| 3149 | /* Class D power on reset */ |
| 3150 | alc_write_coef_idx(codec, 0x17, val | (1<<7)); |
| 3151 | } |
| 3152 | } |
| 3153 | |
| 3154 | val = alc_read_coef_idx(codec, 0xd); /* Class D */ |
| 3155 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); |
| 3156 | |
| 3157 | val = alc_read_coef_idx(codec, 0x4); /* HP */ |
| 3158 | alc_write_coef_idx(codec, 0x4, val | (1<<11)); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3159 | } |
| 3160 | |
| 3161 | /* |
| 3162 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3163 | static int patch_alc269(struct hda_codec *codec) |
| 3164 | { |
| 3165 | struct alc_spec *spec; |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3166 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3167 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3168 | err = alc_alloc_spec(codec, 0x0b); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3169 | if (err < 0) |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3170 | return err; |
| 3171 | |
| 3172 | spec = codec->spec; |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 3173 | spec->gen.shared_mic_vref_pin = 0x18; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3174 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3175 | snd_hda_pick_fixup(codec, alc269_fixup_models, |
Herton Ronaldo Krzesinski | 9f720bb9 | 2012-09-27 10:38:14 -0300 | [diff] [blame] | 3176 | alc269_fixup_tbl, alc269_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3177 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Herton Ronaldo Krzesinski | 9f720bb9 | 2012-09-27 10:38:14 -0300 | [diff] [blame] | 3178 | |
| 3179 | alc_auto_parse_customize_define(codec); |
| 3180 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3181 | if (has_cdefine_beep(codec)) |
| 3182 | spec->gen.beep_nid = 0x01; |
| 3183 | |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 3184 | switch (codec->vendor_id) { |
| 3185 | case 0x10ec0269: |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3186 | spec->codec_variant = ALC269_TYPE_ALC269VA; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3187 | switch (alc_get_coef0(codec) & 0x00f0) { |
| 3188 | case 0x0010: |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3189 | if (codec->bus->pci->subsystem_vendor == 0x1025 && |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3190 | spec->cdefine.platform_type == 1) |
Takashi Iwai | 20ca0c3 | 2011-10-17 16:00:35 +0200 | [diff] [blame] | 3191 | err = alc_codec_rename(codec, "ALC271X"); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3192 | spec->codec_variant = ALC269_TYPE_ALC269VB; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3193 | break; |
| 3194 | case 0x0020: |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3195 | if (codec->bus->pci->subsystem_vendor == 0x17aa && |
| 3196 | codec->bus->pci->subsystem_device == 0x21f3) |
Takashi Iwai | 20ca0c3 | 2011-10-17 16:00:35 +0200 | [diff] [blame] | 3197 | err = alc_codec_rename(codec, "ALC3202"); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3198 | spec->codec_variant = ALC269_TYPE_ALC269VC; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3199 | break; |
Kailang Yang | adcc70b | 2012-05-25 08:08:38 +0200 | [diff] [blame] | 3200 | case 0x0030: |
| 3201 | spec->codec_variant = ALC269_TYPE_ALC269VD; |
| 3202 | break; |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3203 | default: |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3204 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3205 | } |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3206 | if (err < 0) |
| 3207 | goto error; |
Takashi Iwai | 546bb67 | 2012-03-07 08:37:19 +0100 | [diff] [blame] | 3208 | spec->init_hook = alc269_fill_coef; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3209 | alc269_fill_coef(codec); |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 3210 | break; |
| 3211 | |
| 3212 | case 0x10ec0280: |
| 3213 | case 0x10ec0290: |
| 3214 | spec->codec_variant = ALC269_TYPE_ALC280; |
| 3215 | break; |
Kailang Yang | 84dfd0a | 2013-03-07 09:19:38 +0100 | [diff] [blame] | 3216 | case 0x10ec0233: |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 3217 | case 0x10ec0282: |
| 3218 | case 0x10ec0283: |
| 3219 | spec->codec_variant = ALC269_TYPE_ALC282; |
| 3220 | break; |
| 3221 | case 0x10ec0284: |
| 3222 | case 0x10ec0292: |
| 3223 | spec->codec_variant = ALC269_TYPE_ALC284; |
| 3224 | break; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3225 | } |
| 3226 | |
Takashi Iwai | a4297b5 | 2011-08-23 18:40:12 +0200 | [diff] [blame] | 3227 | /* automatic parse from the BIOS config */ |
| 3228 | err = alc269_parse_auto_config(codec); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3229 | if (err < 0) |
| 3230 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3231 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3232 | if (!spec->gen.no_analog && spec->gen.beep_nid) |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3233 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 3234 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3235 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 2a43952 | 2011-07-26 09:52:50 +0200 | [diff] [blame] | 3236 | #ifdef CONFIG_PM |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3237 | codec->patch_ops.resume = alc269_resume; |
| 3238 | #endif |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3239 | spec->shutup = alc269_shutup; |
| 3240 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3241 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 3242 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3243 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3244 | |
| 3245 | error: |
| 3246 | alc_free(codec); |
| 3247 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3248 | } |
| 3249 | |
| 3250 | /* |
| 3251 | * ALC861 |
| 3252 | */ |
| 3253 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3254 | static int alc861_parse_auto_config(struct hda_codec *codec) |
| 3255 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3256 | static const hda_nid_t alc861_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3257 | static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 }; |
| 3258 | return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3259 | } |
| 3260 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3261 | /* Pin config fixes */ |
| 3262 | enum { |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3263 | ALC861_FIXUP_FSC_AMILO_PI1505, |
| 3264 | ALC861_FIXUP_AMP_VREF_0F, |
| 3265 | ALC861_FIXUP_NO_JACK_DETECT, |
| 3266 | ALC861_FIXUP_ASUS_A6RP, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3267 | }; |
| 3268 | |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3269 | /* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */ |
| 3270 | static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3271 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3272 | { |
| 3273 | struct alc_spec *spec = codec->spec; |
| 3274 | unsigned int val; |
| 3275 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3276 | if (action != HDA_FIXUP_ACT_INIT) |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3277 | return; |
Takashi Iwai | d3f02d6 | 2013-01-10 10:12:22 +0100 | [diff] [blame] | 3278 | val = snd_hda_codec_get_pin_target(codec, 0x0f); |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3279 | if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN))) |
| 3280 | val |= AC_PINCTL_IN_EN; |
| 3281 | val |= AC_PINCTL_VREF_50; |
Takashi Iwai | cdd03ce | 2012-04-20 12:34:50 +0200 | [diff] [blame] | 3282 | snd_hda_set_pin_ctl(codec, 0x0f, val); |
Takashi Iwai | 08c189f | 2012-12-19 15:22:24 +0100 | [diff] [blame] | 3283 | spec->gen.keep_vref_in_automute = 1; |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3284 | } |
| 3285 | |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3286 | /* suppress the jack-detection */ |
| 3287 | static void alc_fixup_no_jack_detect(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3288 | const struct hda_fixup *fix, int action) |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3289 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3290 | if (action == HDA_FIXUP_ACT_PRE_PROBE) |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3291 | codec->no_jack_detect = 1; |
Jesper Juhl | 7d7eb9e | 2012-04-12 22:11:25 +0200 | [diff] [blame] | 3292 | } |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3293 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3294 | static const struct hda_fixup alc861_fixups[] = { |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3295 | [ALC861_FIXUP_FSC_AMILO_PI1505] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3296 | .type = HDA_FIXUP_PINS, |
| 3297 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3298 | { 0x0b, 0x0221101f }, /* HP */ |
| 3299 | { 0x0f, 0x90170310 }, /* speaker */ |
| 3300 | { } |
| 3301 | } |
| 3302 | }, |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3303 | [ALC861_FIXUP_AMP_VREF_0F] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3304 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 31150f2 | 2012-01-30 10:54:08 +0100 | [diff] [blame] | 3305 | .v.func = alc861_fixup_asus_amp_vref_0f, |
Takashi Iwai | 3b25eb6 | 2012-01-25 09:55:46 +0100 | [diff] [blame] | 3306 | }, |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3307 | [ALC861_FIXUP_NO_JACK_DETECT] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3308 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3309 | .v.func = alc_fixup_no_jack_detect, |
| 3310 | }, |
| 3311 | [ALC861_FIXUP_ASUS_A6RP] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3312 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3313 | .v.func = alc861_fixup_asus_amp_vref_0f, |
| 3314 | .chained = true, |
| 3315 | .chain_id = ALC861_FIXUP_NO_JACK_DETECT, |
| 3316 | } |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3317 | }; |
| 3318 | |
| 3319 | static const struct snd_pci_quirk alc861_fixup_tbl[] = { |
Takashi Iwai | e652f4c | 2012-02-13 11:56:25 +0100 | [diff] [blame] | 3320 | SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP), |
| 3321 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F), |
| 3322 | SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT), |
| 3323 | SND_PCI_QUIRK(0x1584, 0x2b01, "Haier W18", ALC861_FIXUP_AMP_VREF_0F), |
| 3324 | SND_PCI_QUIRK(0x1584, 0x0000, "Uniwill ECS M31EI", ALC861_FIXUP_AMP_VREF_0F), |
| 3325 | SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3326 | {} |
| 3327 | }; |
| 3328 | |
| 3329 | /* |
| 3330 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3331 | static int patch_alc861(struct hda_codec *codec) |
| 3332 | { |
| 3333 | struct alc_spec *spec; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3334 | int err; |
| 3335 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3336 | err = alc_alloc_spec(codec, 0x15); |
| 3337 | if (err < 0) |
| 3338 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3339 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3340 | spec = codec->spec; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3341 | spec->gen.beep_nid = 0x23; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3342 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3343 | snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); |
| 3344 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3345 | |
Takashi Iwai | cb4e482 | 2011-08-23 17:34:25 +0200 | [diff] [blame] | 3346 | /* automatic parse from the BIOS config */ |
| 3347 | err = alc861_parse_auto_config(codec); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3348 | if (err < 0) |
| 3349 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3350 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3351 | if (!spec->gen.no_analog) |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3352 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3353 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3354 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 83012a7 | 2012-08-24 18:38:08 +0200 | [diff] [blame] | 3355 | #ifdef CONFIG_PM |
Takashi Iwai | cb4e482 | 2011-08-23 17:34:25 +0200 | [diff] [blame] | 3356 | spec->power_hook = alc_power_eapd; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3357 | #endif |
| 3358 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3359 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 3360 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3361 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3362 | |
| 3363 | error: |
| 3364 | alc_free(codec); |
| 3365 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3366 | } |
| 3367 | |
| 3368 | /* |
| 3369 | * ALC861-VD support |
| 3370 | * |
| 3371 | * Based on ALC882 |
| 3372 | * |
| 3373 | * In addition, an independent DAC |
| 3374 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3375 | static int alc861vd_parse_auto_config(struct hda_codec *codec) |
| 3376 | { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3377 | static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3378 | static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
| 3379 | return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3380 | } |
| 3381 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3382 | enum { |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3383 | ALC660VD_FIX_ASUS_GPIO1, |
| 3384 | ALC861VD_FIX_DALLAS, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3385 | }; |
| 3386 | |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3387 | /* exclude VREF80 */ |
| 3388 | static void alc861vd_fixup_dallas(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3389 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3390 | { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3391 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { |
Takashi Iwai | b78562b | 2012-12-17 20:06:49 +0100 | [diff] [blame] | 3392 | snd_hda_override_pin_caps(codec, 0x18, 0x00000734); |
| 3393 | snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3394 | } |
| 3395 | } |
| 3396 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3397 | static const struct hda_fixup alc861vd_fixups[] = { |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3398 | [ALC660VD_FIX_ASUS_GPIO1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3399 | .type = HDA_FIXUP_VERBS, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3400 | .v.verbs = (const struct hda_verb[]) { |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3401 | /* reset GPIO1 */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3402 | {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, |
| 3403 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, |
| 3404 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, |
| 3405 | { } |
| 3406 | } |
| 3407 | }, |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3408 | [ALC861VD_FIX_DALLAS] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3409 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3410 | .v.func = alc861vd_fixup_dallas, |
| 3411 | }, |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3412 | }; |
| 3413 | |
| 3414 | static const struct snd_pci_quirk alc861vd_fixup_tbl[] = { |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3415 | SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3416 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1), |
Takashi Iwai | 8fdcb6f | 2011-08-23 17:28:55 +0200 | [diff] [blame] | 3417 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS), |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3418 | {} |
| 3419 | }; |
| 3420 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3421 | /* |
| 3422 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3423 | static int patch_alc861vd(struct hda_codec *codec) |
| 3424 | { |
| 3425 | struct alc_spec *spec; |
Takashi Iwai | cb4e482 | 2011-08-23 17:34:25 +0200 | [diff] [blame] | 3426 | int err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3427 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3428 | err = alc_alloc_spec(codec, 0x0b); |
| 3429 | if (err < 0) |
| 3430 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3431 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3432 | spec = codec->spec; |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3433 | spec->gen.beep_nid = 0x23; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3434 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3435 | snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); |
| 3436 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3437 | |
Takashi Iwai | cb4e482 | 2011-08-23 17:34:25 +0200 | [diff] [blame] | 3438 | /* automatic parse from the BIOS config */ |
| 3439 | err = alc861vd_parse_auto_config(codec); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3440 | if (err < 0) |
| 3441 | goto error; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3442 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3443 | if (!spec->gen.no_analog) |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3444 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3445 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3446 | codec->patch_ops = alc_patch_ops; |
| 3447 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3448 | spec->shutup = alc_eapd_shutup; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3449 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3450 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 3451 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3452 | return 0; |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3453 | |
| 3454 | error: |
| 3455 | alc_free(codec); |
| 3456 | return err; |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3457 | } |
| 3458 | |
| 3459 | /* |
| 3460 | * ALC662 support |
| 3461 | * |
| 3462 | * ALC662 is almost identical with ALC880 but has cleaner and more flexible |
| 3463 | * configuration. Each pin widget can choose any input DACs and a mixer. |
| 3464 | * Each ADC is connected from a mixer of all inputs. This makes possible |
| 3465 | * 6-channel independent captures. |
| 3466 | * |
| 3467 | * In addition, an independent DAC for the multi-playback (not used in this |
| 3468 | * driver yet). |
| 3469 | */ |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3470 | |
| 3471 | /* |
| 3472 | * BIOS auto configuration |
| 3473 | */ |
| 3474 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3475 | static int alc662_parse_auto_config(struct hda_codec *codec) |
| 3476 | { |
Takashi Iwai | 4c6d72d | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3477 | static const hda_nid_t alc662_ignore[] = { 0x1d, 0 }; |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3478 | static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 }; |
| 3479 | static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 }; |
| 3480 | const hda_nid_t *ssids; |
Takashi Iwai | ee979a14 | 2008-09-02 15:42:20 +0200 | [diff] [blame] | 3481 | |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 3482 | if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || |
| 3483 | codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3484 | ssids = alc663_ssids; |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 3485 | else |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3486 | ssids = alc662_ssids; |
| 3487 | return alc_parse_auto_config(codec, alc662_ignore, ssids); |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3488 | } |
| 3489 | |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3490 | static void alc272_fixup_mario(struct hda_codec *codec, |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3491 | const struct hda_fixup *fix, int action) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 3492 | { |
Takashi Iwai | 9bb1f06 | 2013-01-10 17:14:29 +0100 | [diff] [blame] | 3493 | if (action != HDA_FIXUP_ACT_PRE_PROBE) |
Takashi Iwai | 6fc398c | 2011-01-13 14:36:37 +0100 | [diff] [blame] | 3494 | return; |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3495 | if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, |
| 3496 | (0x3b << AC_AMPCAP_OFFSET_SHIFT) | |
| 3497 | (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) | |
| 3498 | (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
| 3499 | (0 << AC_AMPCAP_MUTE_SHIFT))) |
| 3500 | printk(KERN_WARNING |
| 3501 | "hda_codec: failed to override amp caps for NID 0x2\n"); |
| 3502 | } |
| 3503 | |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3504 | enum { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 3505 | ALC662_FIXUP_ASPIRE, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3506 | ALC662_FIXUP_IDEAPAD, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3507 | ALC272_FIXUP_MARIO, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 3508 | ALC662_FIXUP_CZC_P10T, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 3509 | ALC662_FIXUP_SKU_IGNORE, |
Takashi Iwai | e59ea3e | 2011-06-29 17:21:00 +0200 | [diff] [blame] | 3510 | ALC662_FIXUP_HP_RP5800, |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3511 | ALC662_FIXUP_ASUS_MODE1, |
| 3512 | ALC662_FIXUP_ASUS_MODE2, |
| 3513 | ALC662_FIXUP_ASUS_MODE3, |
| 3514 | ALC662_FIXUP_ASUS_MODE4, |
| 3515 | ALC662_FIXUP_ASUS_MODE5, |
| 3516 | ALC662_FIXUP_ASUS_MODE6, |
| 3517 | ALC662_FIXUP_ASUS_MODE7, |
| 3518 | ALC662_FIXUP_ASUS_MODE8, |
Takashi Iwai | 1565cc3 | 2012-02-13 12:03:25 +0100 | [diff] [blame] | 3519 | ALC662_FIXUP_NO_JACK_DETECT, |
David Henningsson | edfe3bf | 2012-06-12 13:15:12 +0200 | [diff] [blame] | 3520 | ALC662_FIXUP_ZOTAC_Z68, |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 3521 | ALC662_FIXUP_INV_DMIC, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3522 | }; |
| 3523 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3524 | static const struct hda_fixup alc662_fixups[] = { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 3525 | [ALC662_FIXUP_ASPIRE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3526 | .type = HDA_FIXUP_PINS, |
| 3527 | .v.pins = (const struct hda_pintbl[]) { |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 3528 | { 0x15, 0x99130112 }, /* subwoofer */ |
| 3529 | { } |
| 3530 | } |
| 3531 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3532 | [ALC662_FIXUP_IDEAPAD] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3533 | .type = HDA_FIXUP_PINS, |
| 3534 | .v.pins = (const struct hda_pintbl[]) { |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3535 | { 0x17, 0x99130112 }, /* subwoofer */ |
| 3536 | { } |
| 3537 | } |
| 3538 | }, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3539 | [ALC272_FIXUP_MARIO] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3540 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | b5bfbc6 | 2011-01-13 14:22:32 +0100 | [diff] [blame] | 3541 | .v.func = alc272_fixup_mario, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 3542 | }, |
| 3543 | [ALC662_FIXUP_CZC_P10T] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3544 | .type = HDA_FIXUP_VERBS, |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 3545 | .v.verbs = (const struct hda_verb[]) { |
| 3546 | {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, |
| 3547 | {} |
| 3548 | } |
| 3549 | }, |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 3550 | [ALC662_FIXUP_SKU_IGNORE] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3551 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 23d30f2 | 2012-05-07 17:17:32 +0200 | [diff] [blame] | 3552 | .v.func = alc_fixup_sku_ignore, |
Takashi Iwai | c6b3587 | 2011-03-28 12:05:31 +0200 | [diff] [blame] | 3553 | }, |
Takashi Iwai | e59ea3e | 2011-06-29 17:21:00 +0200 | [diff] [blame] | 3554 | [ALC662_FIXUP_HP_RP5800] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3555 | .type = HDA_FIXUP_PINS, |
| 3556 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | e59ea3e | 2011-06-29 17:21:00 +0200 | [diff] [blame] | 3557 | { 0x14, 0x0221201f }, /* HP out */ |
| 3558 | { } |
| 3559 | }, |
| 3560 | .chained = true, |
| 3561 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3562 | }, |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3563 | [ALC662_FIXUP_ASUS_MODE1] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3564 | .type = HDA_FIXUP_PINS, |
| 3565 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3566 | { 0x14, 0x99130110 }, /* speaker */ |
| 3567 | { 0x18, 0x01a19c20 }, /* mic */ |
| 3568 | { 0x19, 0x99a3092f }, /* int-mic */ |
| 3569 | { 0x21, 0x0121401f }, /* HP out */ |
| 3570 | { } |
| 3571 | }, |
| 3572 | .chained = true, |
| 3573 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3574 | }, |
| 3575 | [ALC662_FIXUP_ASUS_MODE2] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3576 | .type = HDA_FIXUP_PINS, |
| 3577 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 2996bdb | 2011-08-18 16:02:24 +0200 | [diff] [blame] | 3578 | { 0x14, 0x99130110 }, /* speaker */ |
| 3579 | { 0x18, 0x01a19820 }, /* mic */ |
| 3580 | { 0x19, 0x99a3092f }, /* int-mic */ |
| 3581 | { 0x1b, 0x0121401f }, /* HP out */ |
| 3582 | { } |
| 3583 | }, |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3584 | .chained = true, |
| 3585 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3586 | }, |
| 3587 | [ALC662_FIXUP_ASUS_MODE3] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3588 | .type = HDA_FIXUP_PINS, |
| 3589 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3590 | { 0x14, 0x99130110 }, /* speaker */ |
| 3591 | { 0x15, 0x0121441f }, /* HP */ |
| 3592 | { 0x18, 0x01a19840 }, /* mic */ |
| 3593 | { 0x19, 0x99a3094f }, /* int-mic */ |
| 3594 | { 0x21, 0x01211420 }, /* HP2 */ |
| 3595 | { } |
| 3596 | }, |
| 3597 | .chained = true, |
| 3598 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3599 | }, |
| 3600 | [ALC662_FIXUP_ASUS_MODE4] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3601 | .type = HDA_FIXUP_PINS, |
| 3602 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3603 | { 0x14, 0x99130110 }, /* speaker */ |
| 3604 | { 0x16, 0x99130111 }, /* speaker */ |
| 3605 | { 0x18, 0x01a19840 }, /* mic */ |
| 3606 | { 0x19, 0x99a3094f }, /* int-mic */ |
| 3607 | { 0x21, 0x0121441f }, /* HP */ |
| 3608 | { } |
| 3609 | }, |
| 3610 | .chained = true, |
| 3611 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3612 | }, |
| 3613 | [ALC662_FIXUP_ASUS_MODE5] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3614 | .type = HDA_FIXUP_PINS, |
| 3615 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3616 | { 0x14, 0x99130110 }, /* speaker */ |
| 3617 | { 0x15, 0x0121441f }, /* HP */ |
| 3618 | { 0x16, 0x99130111 }, /* speaker */ |
| 3619 | { 0x18, 0x01a19840 }, /* mic */ |
| 3620 | { 0x19, 0x99a3094f }, /* int-mic */ |
| 3621 | { } |
| 3622 | }, |
| 3623 | .chained = true, |
| 3624 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3625 | }, |
| 3626 | [ALC662_FIXUP_ASUS_MODE6] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3627 | .type = HDA_FIXUP_PINS, |
| 3628 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3629 | { 0x14, 0x99130110 }, /* speaker */ |
| 3630 | { 0x15, 0x01211420 }, /* HP2 */ |
| 3631 | { 0x18, 0x01a19840 }, /* mic */ |
| 3632 | { 0x19, 0x99a3094f }, /* int-mic */ |
| 3633 | { 0x1b, 0x0121441f }, /* HP */ |
| 3634 | { } |
| 3635 | }, |
| 3636 | .chained = true, |
| 3637 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3638 | }, |
| 3639 | [ALC662_FIXUP_ASUS_MODE7] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3640 | .type = HDA_FIXUP_PINS, |
| 3641 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3642 | { 0x14, 0x99130110 }, /* speaker */ |
| 3643 | { 0x17, 0x99130111 }, /* speaker */ |
| 3644 | { 0x18, 0x01a19840 }, /* mic */ |
| 3645 | { 0x19, 0x99a3094f }, /* int-mic */ |
| 3646 | { 0x1b, 0x01214020 }, /* HP */ |
| 3647 | { 0x21, 0x0121401f }, /* HP */ |
| 3648 | { } |
| 3649 | }, |
| 3650 | .chained = true, |
| 3651 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
| 3652 | }, |
| 3653 | [ALC662_FIXUP_ASUS_MODE8] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3654 | .type = HDA_FIXUP_PINS, |
| 3655 | .v.pins = (const struct hda_pintbl[]) { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3656 | { 0x14, 0x99130110 }, /* speaker */ |
| 3657 | { 0x12, 0x99a30970 }, /* int-mic */ |
| 3658 | { 0x15, 0x01214020 }, /* HP */ |
| 3659 | { 0x17, 0x99130111 }, /* speaker */ |
| 3660 | { 0x18, 0x01a19840 }, /* mic */ |
| 3661 | { 0x21, 0x0121401f }, /* HP */ |
| 3662 | { } |
| 3663 | }, |
| 3664 | .chained = true, |
| 3665 | .chain_id = ALC662_FIXUP_SKU_IGNORE |
Takashi Iwai | 2996bdb | 2011-08-18 16:02:24 +0200 | [diff] [blame] | 3666 | }, |
Takashi Iwai | 1565cc3 | 2012-02-13 12:03:25 +0100 | [diff] [blame] | 3667 | [ALC662_FIXUP_NO_JACK_DETECT] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3668 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 1565cc3 | 2012-02-13 12:03:25 +0100 | [diff] [blame] | 3669 | .v.func = alc_fixup_no_jack_detect, |
| 3670 | }, |
David Henningsson | edfe3bf | 2012-06-12 13:15:12 +0200 | [diff] [blame] | 3671 | [ALC662_FIXUP_ZOTAC_Z68] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3672 | .type = HDA_FIXUP_PINS, |
| 3673 | .v.pins = (const struct hda_pintbl[]) { |
David Henningsson | edfe3bf | 2012-06-12 13:15:12 +0200 | [diff] [blame] | 3674 | { 0x1b, 0x02214020 }, /* Front HP */ |
| 3675 | { } |
| 3676 | } |
| 3677 | }, |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 3678 | [ALC662_FIXUP_INV_DMIC] = { |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3679 | .type = HDA_FIXUP_FUNC, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 3680 | .v.func = alc_fixup_inv_dmic_0x12, |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 3681 | }, |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3682 | }; |
| 3683 | |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3684 | static const struct snd_pci_quirk alc662_fixup_tbl[] = { |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3685 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2), |
David Henningsson | a6c47a8 | 2011-02-10 15:39:19 +0100 | [diff] [blame] | 3686 | SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE), |
David Henningsson | 94024cd | 2011-04-29 14:10:55 +0200 | [diff] [blame] | 3687 | SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE), |
Takashi Iwai | 125821a | 2012-06-22 14:30:29 +0200 | [diff] [blame] | 3688 | SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC), |
Daniel T Chen | 2df0351 | 2010-10-10 22:39:28 -0400 | [diff] [blame] | 3689 | SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), |
Takashi Iwai | e59ea3e | 2011-06-29 17:21:00 +0200 | [diff] [blame] | 3690 | SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800), |
Takashi Iwai | 1565cc3 | 2012-02-13 12:03:25 +0100 | [diff] [blame] | 3691 | SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT), |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3692 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2), |
Daniel T Chen | a0e90ac | 2010-11-20 10:20:35 -0500 | [diff] [blame] | 3693 | SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD), |
Valentine Sinitsyn | d411858 | 2010-10-01 22:24:08 +0600 | [diff] [blame] | 3694 | SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD), |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3695 | SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD), |
David Henningsson | edfe3bf | 2012-06-12 13:15:12 +0200 | [diff] [blame] | 3696 | SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68), |
Anisse Astier | d2ebd47 | 2011-01-20 12:36:21 +0100 | [diff] [blame] | 3697 | SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T), |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3698 | |
| 3699 | #if 0 |
| 3700 | /* Below is a quirk table taken from the old code. |
| 3701 | * Basically the device should work as is without the fixup table. |
| 3702 | * If BIOS doesn't give a proper info, enable the corresponding |
| 3703 | * fixup entry. |
Jesper Juhl | 7d7eb9e | 2012-04-12 22:11:25 +0200 | [diff] [blame] | 3704 | */ |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3705 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1), |
| 3706 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3), |
| 3707 | SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1), |
| 3708 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3), |
| 3709 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), |
| 3710 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3711 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), |
| 3712 | SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1), |
| 3713 | SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1), |
| 3714 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3715 | SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7), |
| 3716 | SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7), |
| 3717 | SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8), |
| 3718 | SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3), |
| 3719 | SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1), |
| 3720 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3721 | SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2), |
| 3722 | SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1), |
| 3723 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3724 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), |
| 3725 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), |
| 3726 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3727 | SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1), |
| 3728 | SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3), |
| 3729 | SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2), |
| 3730 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3731 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5), |
| 3732 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6), |
| 3733 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3734 | SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1), |
| 3735 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3736 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3737 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3), |
| 3738 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3), |
| 3739 | SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1), |
| 3740 | SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1), |
| 3741 | SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1), |
| 3742 | SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1), |
| 3743 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1), |
| 3744 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2), |
| 3745 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2), |
| 3746 | SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1), |
| 3747 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), |
| 3748 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3), |
| 3749 | SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1), |
| 3750 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1), |
| 3751 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1), |
| 3752 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2), |
| 3753 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1), |
| 3754 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4), |
| 3755 | #endif |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3756 | {} |
| 3757 | }; |
| 3758 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3759 | static const struct hda_model_fixup alc662_fixup_models[] = { |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3760 | {.id = ALC272_FIXUP_MARIO, .name = "mario"}, |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3761 | {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"}, |
| 3762 | {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"}, |
| 3763 | {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"}, |
| 3764 | {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"}, |
| 3765 | {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"}, |
| 3766 | {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"}, |
| 3767 | {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"}, |
| 3768 | {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"}, |
Takashi Iwai | 6e72aa5 | 2012-06-25 10:52:25 +0200 | [diff] [blame] | 3769 | {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"}, |
Todd Broch | 6be7948 | 2010-12-07 16:51:05 -0800 | [diff] [blame] | 3770 | {} |
| 3771 | }; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3772 | |
Kailang Yang | 8663ff7 | 2012-06-29 09:35:52 +0200 | [diff] [blame] | 3773 | static void alc662_fill_coef(struct hda_codec *codec) |
| 3774 | { |
| 3775 | int val, coef; |
| 3776 | |
| 3777 | coef = alc_get_coef0(codec); |
| 3778 | |
| 3779 | switch (codec->vendor_id) { |
| 3780 | case 0x10ec0662: |
| 3781 | if ((coef & 0x00f0) == 0x0030) { |
| 3782 | val = alc_read_coef_idx(codec, 0x4); /* EAPD Ctrl */ |
| 3783 | alc_write_coef_idx(codec, 0x4, val & ~(1<<10)); |
| 3784 | } |
| 3785 | break; |
| 3786 | case 0x10ec0272: |
| 3787 | case 0x10ec0273: |
| 3788 | case 0x10ec0663: |
| 3789 | case 0x10ec0665: |
| 3790 | case 0x10ec0670: |
| 3791 | case 0x10ec0671: |
| 3792 | case 0x10ec0672: |
| 3793 | val = alc_read_coef_idx(codec, 0xd); /* EAPD Ctrl */ |
| 3794 | alc_write_coef_idx(codec, 0xd, val | (1<<14)); |
| 3795 | break; |
| 3796 | } |
| 3797 | } |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3798 | |
Takashi Iwai | 1d045db | 2011-07-07 18:23:21 +0200 | [diff] [blame] | 3799 | /* |
| 3800 | */ |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3801 | static int patch_alc662(struct hda_codec *codec) |
| 3802 | { |
| 3803 | struct alc_spec *spec; |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3804 | int err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3805 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3806 | err = alc_alloc_spec(codec, 0x0b); |
| 3807 | if (err < 0) |
| 3808 | return err; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3809 | |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3810 | spec = codec->spec; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 3811 | |
Takashi Iwai | 53c334a | 2011-08-23 18:27:14 +0200 | [diff] [blame] | 3812 | /* handle multiple HPs as is */ |
| 3813 | spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; |
| 3814 | |
Takashi Iwai | 2c3bf9a | 2008-06-04 12:39:38 +0200 | [diff] [blame] | 3815 | alc_fix_pll_init(codec, 0x20, 0x04, 15); |
| 3816 | |
Kailang Yang | 8663ff7 | 2012-06-29 09:35:52 +0200 | [diff] [blame] | 3817 | spec->init_hook = alc662_fill_coef; |
| 3818 | alc662_fill_coef(codec); |
| 3819 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3820 | snd_hda_pick_fixup(codec, alc662_fixup_models, |
Takashi Iwai | 8e5a050 | 2012-06-21 15:49:33 +0200 | [diff] [blame] | 3821 | alc662_fixup_tbl, alc662_fixups); |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3822 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); |
Takashi Iwai | 8e5a050 | 2012-06-21 15:49:33 +0200 | [diff] [blame] | 3823 | |
| 3824 | alc_auto_parse_customize_define(codec); |
| 3825 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3826 | if (has_cdefine_beep(codec)) |
| 3827 | spec->gen.beep_nid = 0x01; |
| 3828 | |
Takashi Iwai | 1bb7e43 | 2011-10-17 16:50:59 +0200 | [diff] [blame] | 3829 | if ((alc_get_coef0(codec) & (1 << 14)) && |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3830 | codec->bus->pci->subsystem_vendor == 0x1025 && |
| 3831 | spec->cdefine.platform_type == 1) { |
| 3832 | if (alc_codec_rename(codec, "ALC272X") < 0) |
| 3833 | goto error; |
Takashi Iwai | 20ca0c3 | 2011-10-17 16:00:35 +0200 | [diff] [blame] | 3834 | } |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3835 | |
Takashi Iwai | b9c5106 | 2011-08-24 18:08:07 +0200 | [diff] [blame] | 3836 | /* automatic parse from the BIOS config */ |
| 3837 | err = alc662_parse_auto_config(codec); |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3838 | if (err < 0) |
| 3839 | goto error; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3840 | |
Takashi Iwai | 7504b6c | 2013-03-18 11:25:51 +0100 | [diff] [blame] | 3841 | if (!spec->gen.no_analog && spec->gen.beep_nid) { |
Kailang Yang | da00c24 | 2010-03-19 11:23:45 +0100 | [diff] [blame] | 3842 | switch (codec->vendor_id) { |
| 3843 | case 0x10ec0662: |
| 3844 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); |
| 3845 | break; |
| 3846 | case 0x10ec0272: |
| 3847 | case 0x10ec0663: |
| 3848 | case 0x10ec0665: |
| 3849 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); |
| 3850 | break; |
| 3851 | case 0x10ec0273: |
| 3852 | set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); |
| 3853 | break; |
| 3854 | } |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 3855 | } |
Takashi Iwai | 2134ea4 | 2008-01-10 16:53:55 +0100 | [diff] [blame] | 3856 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3857 | codec->patch_ops = alc_patch_ops; |
Takashi Iwai | 1c716153 | 2011-04-07 10:37:16 +0200 | [diff] [blame] | 3858 | spec->shutup = alc_eapd_shutup; |
David Henningsson | 6cb3b70 | 2010-09-09 08:51:44 +0200 | [diff] [blame] | 3859 | |
Takashi Iwai | 1727a77 | 2013-01-10 09:52:52 +0100 | [diff] [blame] | 3860 | snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); |
Takashi Iwai | 589876e | 2012-02-20 15:47:55 +0100 | [diff] [blame] | 3861 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3862 | return 0; |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3863 | |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3864 | error: |
| 3865 | alc_free(codec); |
| 3866 | return err; |
Kailang Yang | b478b99 | 2011-05-18 11:51:15 +0200 | [diff] [blame] | 3867 | } |
| 3868 | |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3869 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3870 | * ALC680 support |
| 3871 | */ |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3872 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3873 | static int alc680_parse_auto_config(struct hda_codec *codec) |
| 3874 | { |
Takashi Iwai | 3e6179b | 2011-07-08 16:55:13 +0200 | [diff] [blame] | 3875 | return alc_parse_auto_config(codec, NULL, NULL); |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3876 | } |
| 3877 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3878 | /* |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3879 | */ |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3880 | static int patch_alc680(struct hda_codec *codec) |
| 3881 | { |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3882 | int err; |
| 3883 | |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 3884 | /* ALC680 has no aa-loopback mixer */ |
Takashi Iwai | 3de9517 | 2012-05-07 18:03:15 +0200 | [diff] [blame] | 3885 | err = alc_alloc_spec(codec, 0); |
| 3886 | if (err < 0) |
| 3887 | return err; |
Takashi Iwai | 1f0f4b8 | 2011-06-27 10:52:59 +0200 | [diff] [blame] | 3888 | |
Takashi Iwai | 1ebec5f | 2011-08-15 13:21:48 +0200 | [diff] [blame] | 3889 | /* automatic parse from the BIOS config */ |
| 3890 | err = alc680_parse_auto_config(codec); |
| 3891 | if (err < 0) { |
| 3892 | alc_free(codec); |
| 3893 | return err; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3894 | } |
| 3895 | |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3896 | codec->patch_ops = alc_patch_ops; |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3897 | |
| 3898 | return 0; |
| 3899 | } |
| 3900 | |
| 3901 | /* |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3902 | * patch entries |
| 3903 | */ |
Takashi Iwai | a911132 | 2011-05-02 11:30:18 +0200 | [diff] [blame] | 3904 | static const struct hda_codec_preset snd_hda_preset_realtek[] = { |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 3905 | { .id = 0x10ec0221, .name = "ALC221", .patch = patch_alc269 }, |
Kailang Yang | 84dfd0a | 2013-03-07 09:19:38 +0100 | [diff] [blame] | 3906 | { .id = 0x10ec0233, .name = "ALC233", .patch = patch_alc269 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3907 | { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3908 | { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 3909 | { .id = 0x10ec0267, .name = "ALC267", .patch = patch_alc268 }, |
Kailang Yang | a361d84 | 2007-06-05 12:30:55 +0200 | [diff] [blame] | 3910 | { .id = 0x10ec0268, .name = "ALC268", .patch = patch_alc268 }, |
Kailang Yang | f6a9224 | 2007-12-13 16:52:54 +0100 | [diff] [blame] | 3911 | { .id = 0x10ec0269, .name = "ALC269", .patch = patch_alc269 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 3912 | { .id = 0x10ec0270, .name = "ALC270", .patch = patch_alc269 }, |
Kailang Yang | 01afd41 | 2008-10-15 11:22:09 +0200 | [diff] [blame] | 3913 | { .id = 0x10ec0272, .name = "ALC272", .patch = patch_alc662 }, |
Kailang Yang | ebb83ee | 2009-12-17 12:23:00 +0100 | [diff] [blame] | 3914 | { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, |
Kailang Yang | 296f033 | 2011-05-18 11:52:36 +0200 | [diff] [blame] | 3915 | { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, |
David Henningsson | befae82 | 2012-06-25 19:49:28 +0200 | [diff] [blame] | 3916 | { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, |
David Henningsson | 4e01ec6 | 2012-07-18 07:38:46 +0200 | [diff] [blame] | 3917 | { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, |
Kailang Yang | 7ff34ad | 2012-10-06 17:02:30 +0200 | [diff] [blame] | 3918 | { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, |
Kailang Yang | 065380f | 2013-01-10 10:25:48 +0100 | [diff] [blame] | 3919 | { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 }, |
Kailang Yang | 7ff34ad | 2012-10-06 17:02:30 +0200 | [diff] [blame] | 3920 | { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, |
David Henningsson | af02dde | 2012-11-21 08:57:58 +0100 | [diff] [blame] | 3921 | { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 3922 | { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3923 | .patch = patch_alc861 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 3924 | { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd }, |
| 3925 | { .id = 0x10ec0861, .name = "ALC861", .patch = patch_alc861 }, |
| 3926 | { .id = 0x10ec0862, .name = "ALC861-VD", .patch = patch_alc861vd }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3927 | { .id = 0x10ec0662, .rev = 0x100002, .name = "ALC662 rev2", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3928 | .patch = patch_alc882 }, |
Kailang Yang | bc9f98a | 2007-04-12 13:06:07 +0200 | [diff] [blame] | 3929 | { .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1", |
| 3930 | .patch = patch_alc662 }, |
David Henningsson | cc667a7 | 2011-10-18 14:07:51 +0200 | [diff] [blame] | 3931 | { .id = 0x10ec0662, .rev = 0x100300, .name = "ALC662 rev3", |
| 3932 | .patch = patch_alc662 }, |
Kailang Yang | 6dda9f4 | 2008-05-27 12:05:31 +0200 | [diff] [blame] | 3933 | { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, |
Kailang Yang | cec27c8 | 2010-02-04 14:18:18 +0100 | [diff] [blame] | 3934 | { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, |
Kailang Yang | 19a6282 | 2012-11-08 10:25:37 +0100 | [diff] [blame] | 3935 | { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, |
Kailang Yang | 6227cdc | 2010-02-25 08:36:52 +0100 | [diff] [blame] | 3936 | { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, |
Kailang Yang | d1eb57f | 2010-06-23 16:25:26 +0200 | [diff] [blame] | 3937 | { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, |
Jakub Schmidtke | f32610e | 2007-02-02 18:17:27 +0100 | [diff] [blame] | 3938 | { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3939 | { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3940 | { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 }, |
Clive Messer | 669faba | 2008-09-30 15:49:13 +0200 | [diff] [blame] | 3941 | { .id = 0x10ec0885, .rev = 0x100101, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3942 | .patch = patch_alc882 }, |
Takashi Iwai | cb308f9 | 2008-04-16 14:13:29 +0200 | [diff] [blame] | 3943 | { .id = 0x10ec0885, .rev = 0x100103, .name = "ALC889A", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3944 | .patch = patch_alc882 }, |
Kailang Yang | df694da | 2005-12-05 19:42:22 +0100 | [diff] [blame] | 3945 | { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3946 | { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc882 }, |
Kailang Yang | 4442608 | 2008-10-15 11:18:05 +0200 | [diff] [blame] | 3947 | { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3948 | .patch = patch_alc882 }, |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3949 | { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc882 }, |
Takashi Iwai | 4953550a | 2009-06-30 15:28:30 +0200 | [diff] [blame] | 3950 | { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 }, |
Kailang Yang | 274693f | 2009-12-03 10:07:50 +0100 | [diff] [blame] | 3951 | { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 }, |
Takashi Iwai | e16fb6d | 2011-10-17 16:39:09 +0200 | [diff] [blame] | 3952 | { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 }, |
Kailang Yang | 19a6282 | 2012-11-08 10:25:37 +0100 | [diff] [blame] | 3953 | { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 }, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 3954 | {} /* terminator */ |
| 3955 | }; |
Takashi Iwai | 1289e9e | 2008-11-27 15:47:11 +0100 | [diff] [blame] | 3956 | |
| 3957 | MODULE_ALIAS("snd-hda-codec-id:10ec*"); |
| 3958 | |
| 3959 | MODULE_LICENSE("GPL"); |
| 3960 | MODULE_DESCRIPTION("Realtek HD-audio codec"); |
| 3961 | |
| 3962 | static struct hda_codec_preset_list realtek_list = { |
| 3963 | .preset = snd_hda_preset_realtek, |
| 3964 | .owner = THIS_MODULE, |
| 3965 | }; |
| 3966 | |
| 3967 | static int __init patch_realtek_init(void) |
| 3968 | { |
| 3969 | return snd_hda_add_codec_preset(&realtek_list); |
| 3970 | } |
| 3971 | |
| 3972 | static void __exit patch_realtek_exit(void) |
| 3973 | { |
| 3974 | snd_hda_delete_codec_preset(&realtek_list); |
| 3975 | } |
| 3976 | |
| 3977 | module_init(patch_realtek_init) |
| 3978 | module_exit(patch_realtek_exit) |