blob: 8315bf7d4c381d2b0faad840c3a9f065b2c0285b [file] [log] [blame]
Thomas Gleixnerd0fa1172019-05-20 19:07:57 +02001// SPDX-License-Identifier: GPL-2.0-or-later
Linus Torvalds1da177e2005-04-16 15:20:36 -07002/*
3 * Universal Interface for Intel High Definition Audio Codec
4 *
Takashi Iwai1d045db2011-07-07 18:23:21 +02005 * HD audio interface patch for Realtek ALC codecs
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 *
Kailang Yangdf694da2005-12-05 19:42:22 +01007 * Copyright (c) 2004 Kailang Yang <kailang@realtek.com.tw>
8 * PeiSen Hou <pshou@realtek.com.tw>
Linus Torvalds1da177e2005-04-16 15:20:36 -07009 * Takashi Iwai <tiwai@suse.de>
Jonathan Woithe409a3e92012-03-27 13:01:01 +103010 * Jonathan Woithe <jwoithe@just42.net>
Linus Torvalds1da177e2005-04-16 15:20:36 -070011 */
12
Linus Torvalds1da177e2005-04-16 15:20:36 -070013#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/slab.h>
16#include <linux/pci.h>
Takashi Iwai08fb0d02013-01-10 17:33:58 +010017#include <linux/dmi.h>
Paul Gortmakerda155d52011-07-15 12:38:28 -040018#include <linux/module.h>
David Henningsson33f4acd2015-01-07 15:50:13 +010019#include <linux/input.h>
Kai-Heng Feng87dc3642020-04-30 21:52:07 +080020#include <linux/leds.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070021#include <sound/core.h>
Kailang Yang9ad0e492010-09-14 23:22:00 +020022#include <sound/jack.h>
Pierre-Louis Bossartbe57bff2018-08-22 15:24:57 -050023#include <sound/hda_codec.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include "hda_local.h"
Takashi Iwai23d30f22012-05-07 17:17:32 +020025#include "hda_auto_parser.h"
Takashi Iwai1835a0f2011-10-27 22:12:46 +020026#include "hda_jack.h"
Takashi Iwai08c189f2012-12-19 15:22:24 +010027#include "hda_generic.h"
Lucas Tanured3dca022021-12-17 11:57:07 +000028#include "hda_component.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070029
Takashi Iwaicd63a5f2013-07-05 12:13:59 +020030/* keep halting ALC5505 DSP, for power saving */
31#define HALT_REALTEK_ALC5505
32
Takashi Iwai4a79ba32009-04-22 16:31:35 +020033/* extra amp-initialization sequence types */
34enum {
Takashi Iwai1c76aa52018-06-21 16:37:54 +020035 ALC_INIT_UNDEFINED,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020036 ALC_INIT_NONE,
37 ALC_INIT_DEFAULT,
Takashi Iwai4a79ba32009-04-22 16:31:35 +020038};
39
David Henningsson73bdd592013-04-15 15:44:14 +020040enum {
41 ALC_HEADSET_MODE_UNKNOWN,
42 ALC_HEADSET_MODE_UNPLUGGED,
43 ALC_HEADSET_MODE_HEADSET,
44 ALC_HEADSET_MODE_MIC,
45 ALC_HEADSET_MODE_HEADPHONE,
46};
47
48enum {
49 ALC_HEADSET_TYPE_UNKNOWN,
50 ALC_HEADSET_TYPE_CTIA,
51 ALC_HEADSET_TYPE_OMTP,
52};
53
Hui Wangc7b60a82015-12-28 11:35:25 +080054enum {
55 ALC_KEY_MICMUTE_INDEX,
56};
57
Kailang Yangda00c242010-03-19 11:23:45 +010058struct alc_customize_define {
59 unsigned int sku_cfg;
60 unsigned char port_connectivity;
61 unsigned char check_sum;
62 unsigned char customization;
63 unsigned char external_amp;
64 unsigned int enable_pcbeep:1;
65 unsigned int platform_type:1;
66 unsigned int swap:1;
67 unsigned int override:1;
David Henningsson90622912010-10-14 14:50:18 +020068 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
Kailang Yangda00c242010-03-19 11:23:45 +010069};
70
Takashi Iwai766538a2020-06-18 13:08:41 +020071struct alc_coef_led {
72 unsigned int idx;
73 unsigned int mask;
74 unsigned int on;
75 unsigned int off;
76};
77
Linus Torvalds1da177e2005-04-16 15:20:36 -070078struct alc_spec {
Takashi Iwai08c189f2012-12-19 15:22:24 +010079 struct hda_gen_spec gen; /* must be at head */
Takashi Iwai23d30f22012-05-07 17:17:32 +020080
Linus Torvalds1da177e2005-04-16 15:20:36 -070081 /* codec parameterization */
Kailang Yangda00c242010-03-19 11:23:45 +010082 struct alc_customize_define cdefine;
Takashi Iwai08c189f2012-12-19 15:22:24 +010083 unsigned int parse_flags; /* flag for snd_hda_parse_pin_defcfg() */
84
Takashi Iwai5579cd62018-06-19 22:22:41 +020085 /* GPIO bits */
86 unsigned int gpio_mask;
87 unsigned int gpio_dir;
88 unsigned int gpio_data;
Takashi Iwai215c8502018-06-19 22:34:26 +020089 bool gpio_write_delay; /* add a delay before writing gpio_data */
Takashi Iwai5579cd62018-06-19 22:22:41 +020090
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +020091 /* mute LED for HP laptops, see vref_mute_led_set() */
Takashi Iwai08fb0d02013-01-10 17:33:58 +010092 int mute_led_polarity;
Kai-Heng Fengdbd13172020-04-30 16:32:51 +080093 int micmute_led_polarity;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010094 hda_nid_t mute_led_nid;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +080095 hda_nid_t cap_mute_led_nid;
Takashi Iwai08fb0d02013-01-10 17:33:58 +010096
Takashi Iwai0f32fd192014-11-19 12:16:14 +010097 unsigned int gpio_mute_led_mask;
98 unsigned int gpio_mic_led_mask;
Takashi Iwai766538a2020-06-18 13:08:41 +020099 struct alc_coef_led mute_led_coef;
100 struct alc_coef_led mic_led_coef;
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100101 struct mutex coef_mutex;
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +0100102
David Henningsson73bdd592013-04-15 15:44:14 +0200103 hda_nid_t headset_mic_pin;
104 hda_nid_t headphone_mic_pin;
105 int current_headset_mode;
106 int current_headset_type;
107
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100108 /* hooks */
109 void (*init_hook)(struct hda_codec *codec);
Takashi Iwai83012a72012-08-24 18:38:08 +0200110#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500111 void (*power_hook)(struct hda_codec *codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100112#endif
Takashi Iwai1c7161532011-04-07 10:37:16 +0200113 void (*shutup)(struct hda_codec *codec);
Takashi Iwaid922b512011-04-28 12:18:53 +0200114
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200115 int init_amp;
Takashi Iwaid433a672010-09-20 15:11:54 +0200116 int codec_variant; /* flag for other variants */
Kailang Yang97a26572013-11-29 00:35:26 -0500117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
Kailang Yang693abe12019-01-29 15:38:21 +0800119 unsigned int done_hp_init:1;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100120 unsigned int no_shutup_pins:1;
Kailang Yangd3ba58b2019-05-06 15:09:42 +0800121 unsigned int ultra_low_power:1;
Hui Wang476c02e2020-03-29 16:20:18 +0800122 unsigned int has_hs_key:1;
Kailang Yang92666d42020-11-19 17:04:21 +0800123 unsigned int no_internal_mic_pin:1;
Takashi Iwaie64f14f2009-01-20 18:32:55 +0100124
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200125 /* for PLL fix */
126 hda_nid_t pll_nid;
127 unsigned int pll_coef_idx, pll_coef_bit;
Takashi Iwai1bb7e432011-10-17 16:50:59 +0200128 unsigned int coef0;
David Henningsson33f4acd2015-01-07 15:50:13 +0100129 struct input_dev *kb_dev;
Hui Wangc7b60a82015-12-28 11:35:25 +0800130 u8 alc_mute_keycode_map[1];
Lucas Tanured3dca022021-12-17 11:57:07 +0000131
132 /* component binding */
133 struct component_match *match;
134 struct hda_component comps[HDA_MAX_COMPONENTS];
Kailang Yangdf694da2005-12-05 19:42:22 +0100135};
136
Takashi Iwai23f0c042009-02-26 13:03:58 +0100137/*
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200138 * COEF access helper functions
139 */
140
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100141static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
142 unsigned int coef_idx)
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200143{
144 unsigned int val;
145
146 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
147 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
148 return val;
149}
150
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100151static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
152 unsigned int coef_idx)
153{
154 struct alc_spec *spec = codec->spec;
155 unsigned int val;
156
157 mutex_lock(&spec->coef_mutex);
158 val = __alc_read_coefex_idx(codec, nid, coef_idx);
159 mutex_unlock(&spec->coef_mutex);
160 return val;
161}
162
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200163#define alc_read_coef_idx(codec, coef_idx) \
164 alc_read_coefex_idx(codec, 0x20, coef_idx)
165
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100166static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
167 unsigned int coef_idx, unsigned int coef_val)
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200168{
169 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
170 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
171}
172
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100173static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
174 unsigned int coef_idx, unsigned int coef_val)
175{
176 struct alc_spec *spec = codec->spec;
177
178 mutex_lock(&spec->coef_mutex);
179 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
180 mutex_unlock(&spec->coef_mutex);
181}
182
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200183#define alc_write_coef_idx(codec, coef_idx, coef_val) \
184 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
185
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100186static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187 unsigned int coef_idx, unsigned int mask,
188 unsigned int bits_set)
189{
190 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
191
192 if (val != -1)
193 __alc_write_coefex_idx(codec, nid, coef_idx,
194 (val & ~mask) | bits_set);
195}
196
Takashi Iwai98b24882014-08-18 13:47:50 +0200197static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
198 unsigned int coef_idx, unsigned int mask,
199 unsigned int bits_set)
200{
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100201 struct alc_spec *spec = codec->spec;
Takashi Iwai98b24882014-08-18 13:47:50 +0200202
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100203 mutex_lock(&spec->coef_mutex);
204 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
205 mutex_unlock(&spec->coef_mutex);
Takashi Iwai98b24882014-08-18 13:47:50 +0200206}
207
208#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
209 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
210
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200211/* a special bypass for COEF 0; read the cached value at the second time */
212static unsigned int alc_get_coef0(struct hda_codec *codec)
213{
214 struct alc_spec *spec = codec->spec;
215
216 if (!spec->coef0)
217 spec->coef0 = alc_read_coef_idx(codec, 0);
218 return spec->coef0;
219}
220
Takashi Iwai54db6c32014-08-18 15:11:19 +0200221/* coef writes/updates batch */
222struct coef_fw {
223 unsigned char nid;
224 unsigned char idx;
225 unsigned short mask;
226 unsigned short val;
227};
228
229#define UPDATE_COEFEX(_nid, _idx, _mask, _val) \
230 { .nid = (_nid), .idx = (_idx), .mask = (_mask), .val = (_val) }
231#define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
232#define WRITE_COEF(_idx, _val) WRITE_COEFEX(0x20, _idx, _val)
233#define UPDATE_COEF(_idx, _mask, _val) UPDATE_COEFEX(0x20, _idx, _mask, _val)
234
235static void alc_process_coef_fw(struct hda_codec *codec,
236 const struct coef_fw *fw)
237{
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100238 struct alc_spec *spec = codec->spec;
239
240 mutex_lock(&spec->coef_mutex);
Takashi Iwai54db6c32014-08-18 15:11:19 +0200241 for (; fw->nid; fw++) {
242 if (fw->mask == (unsigned short)-1)
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100243 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
Takashi Iwai54db6c32014-08-18 15:11:19 +0200244 else
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100245 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
246 fw->mask, fw->val);
Takashi Iwai54db6c32014-08-18 15:11:19 +0200247 }
Takashi Iwaib837a9f2022-01-31 08:57:38 +0100248 mutex_unlock(&spec->coef_mutex);
Takashi Iwai54db6c32014-08-18 15:11:19 +0200249}
250
Takashi Iwaif2a227c2014-08-18 13:35:22 +0200251/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200252 * GPIO setup tables, used in initialization
Kailang Yangdf694da2005-12-05 19:42:22 +0100253 */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200254
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200255/* Enable GPIO mask and set output */
Takashi Iwai5579cd62018-06-19 22:22:41 +0200256static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
257{
258 struct alc_spec *spec = codec->spec;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200259
Takashi Iwai5579cd62018-06-19 22:22:41 +0200260 spec->gpio_mask |= mask;
261 spec->gpio_dir |= mask;
262 spec->gpio_data |= mask;
263}
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200264
Takashi Iwai5579cd62018-06-19 22:22:41 +0200265static void alc_write_gpio_data(struct hda_codec *codec)
266{
267 struct alc_spec *spec = codec->spec;
268
269 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
270 spec->gpio_data);
271}
272
Takashi Iwaiaaf312d2018-06-19 22:28:22 +0200273static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
274 bool on)
275{
276 struct alc_spec *spec = codec->spec;
277 unsigned int oldval = spec->gpio_data;
278
279 if (on)
280 spec->gpio_data |= mask;
281 else
282 spec->gpio_data &= ~mask;
283 if (oldval != spec->gpio_data)
284 alc_write_gpio_data(codec);
285}
286
Takashi Iwai5579cd62018-06-19 22:22:41 +0200287static void alc_write_gpio(struct hda_codec *codec)
288{
289 struct alc_spec *spec = codec->spec;
290
291 if (!spec->gpio_mask)
292 return;
293
294 snd_hda_codec_write(codec, codec->core.afg, 0,
295 AC_VERB_SET_GPIO_MASK, spec->gpio_mask);
296 snd_hda_codec_write(codec, codec->core.afg, 0,
297 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir);
Takashi Iwai215c8502018-06-19 22:34:26 +0200298 if (spec->gpio_write_delay)
299 msleep(1);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200300 alc_write_gpio_data(codec);
301}
302
303static void alc_fixup_gpio(struct hda_codec *codec, int action,
304 unsigned int mask)
305{
306 if (action == HDA_FIXUP_ACT_PRE_PROBE)
307 alc_setup_gpio(codec, mask);
308}
309
310static void alc_fixup_gpio1(struct hda_codec *codec,
311 const struct hda_fixup *fix, int action)
312{
313 alc_fixup_gpio(codec, action, 0x01);
314}
315
316static void alc_fixup_gpio2(struct hda_codec *codec,
317 const struct hda_fixup *fix, int action)
318{
319 alc_fixup_gpio(codec, action, 0x02);
320}
321
322static void alc_fixup_gpio3(struct hda_codec *codec,
323 const struct hda_fixup *fix, int action)
324{
325 alc_fixup_gpio(codec, action, 0x03);
326}
Kailang Yangbdd148a2007-05-08 15:19:08 +0200327
Takashi Iwaiae065f12018-06-19 23:00:03 +0200328static void alc_fixup_gpio4(struct hda_codec *codec,
329 const struct hda_fixup *fix, int action)
330{
331 alc_fixup_gpio(codec, action, 0x04);
332}
333
Takashi Iwai8a503552020-06-18 13:08:32 +0200334static void alc_fixup_micmute_led(struct hda_codec *codec,
335 const struct hda_fixup *fix, int action)
336{
Jaroslav Kyselae65bf992021-03-17 18:29:43 +0100337 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai8a503552020-06-18 13:08:32 +0200338 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
339}
340
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200341/*
342 * Fix hardware PLL issue
343 * On some codecs, the analog PLL gating control must be off while
344 * the default value is 1.
345 */
346static void alc_fix_pll(struct hda_codec *codec)
347{
348 struct alc_spec *spec = codec->spec;
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200349
Takashi Iwai98b24882014-08-18 13:47:50 +0200350 if (spec->pll_nid)
351 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
352 1 << spec->pll_coef_bit, 0);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200353}
354
355static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
356 unsigned int coef_idx, unsigned int coef_bit)
357{
358 struct alc_spec *spec = codec->spec;
359 spec->pll_nid = nid;
360 spec->pll_coef_idx = coef_idx;
361 spec->pll_coef_bit = coef_bit;
362 alc_fix_pll(codec);
363}
364
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100365/* update the master volume per volume-knob's unsol event */
Takashi Iwai1a4f69d2014-09-11 15:22:46 +0200366static void alc_update_knob_master(struct hda_codec *codec,
367 struct hda_jack_callback *jack)
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100368{
369 unsigned int val;
370 struct snd_kcontrol *kctl;
371 struct snd_ctl_elem_value *uctl;
372
373 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
374 if (!kctl)
375 return;
376 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
377 if (!uctl)
378 return;
Takashi Iwai2ebab402016-02-09 10:23:52 +0100379 val = snd_hda_codec_read(codec, jack->nid, 0,
Takashi Iwaicf5a2272012-02-20 16:31:07 +0100380 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
381 val &= HDA_AMP_VOLMASK;
382 uctl->value.integer.value[0] = val;
383 uctl->value.integer.value[1] = val;
384 kctl->put(kctl, uctl);
385 kfree(uctl);
386}
387
David Henningsson29adc4b2012-09-25 11:31:00 +0200388static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100389{
David Henningsson29adc4b2012-09-25 11:31:00 +0200390 /* For some reason, the res given from ALC880 is broken.
391 Here we adjust it properly. */
392 snd_hda_jack_unsol_event(codec, res >> 2);
Takashi Iwaif21d78e2012-01-19 12:10:29 +0100393}
394
Kailang Yang394c97f2014-11-12 17:38:08 +0800395/* Change EAPD to verb control */
396static void alc_fill_eapd_coef(struct hda_codec *codec)
397{
398 int coef;
399
400 coef = alc_get_coef0(codec);
401
Takashi Iwai7639a062015-03-03 10:07:24 +0100402 switch (codec->core.vendor_id) {
Kailang Yang394c97f2014-11-12 17:38:08 +0800403 case 0x10ec0262:
404 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
405 break;
406 case 0x10ec0267:
407 case 0x10ec0268:
408 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
409 break;
410 case 0x10ec0269:
411 if ((coef & 0x00f0) == 0x0010)
412 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
413 if ((coef & 0x00f0) == 0x0020)
414 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
415 if ((coef & 0x00f0) == 0x0030)
416 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
417 break;
418 case 0x10ec0280:
419 case 0x10ec0284:
420 case 0x10ec0290:
421 case 0x10ec0292:
422 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
423 break;
Kailang Yang42314302016-02-03 15:03:50 +0800424 case 0x10ec0225:
Takashi Iwai44be77c2017-12-27 08:53:59 +0100425 case 0x10ec0295:
426 case 0x10ec0299:
427 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -0500428 fallthrough;
Takashi Iwai44be77c2017-12-27 08:53:59 +0100429 case 0x10ec0215:
Takashi Iwai1948fc02021-06-18 18:17:20 +0200430 case 0x10ec0230:
Kailang Yang394c97f2014-11-12 17:38:08 +0800431 case 0x10ec0233:
Kailang Yangea04a1d2018-04-25 15:31:52 +0800432 case 0x10ec0235:
Thomas Hebbc4473742020-03-30 12:09:38 -0400433 case 0x10ec0236:
Kailang Yang7fbdcd82020-04-23 14:18:31 +0800434 case 0x10ec0245:
Kailang Yang394c97f2014-11-12 17:38:08 +0800435 case 0x10ec0255:
Thomas Hebbc4473742020-03-30 12:09:38 -0400436 case 0x10ec0256:
Kailang Yangf429e7e2017-12-05 15:38:24 +0800437 case 0x10ec0257:
Kailang Yang394c97f2014-11-12 17:38:08 +0800438 case 0x10ec0282:
439 case 0x10ec0283:
440 case 0x10ec0286:
441 case 0x10ec0288:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800442 case 0x10ec0285:
Kailang Yang506b62c2014-12-18 17:07:44 +0800443 case 0x10ec0298:
Kailang Yang0a6f0602017-06-30 16:00:48 +0800444 case 0x10ec0289:
Kailang Yang1078bef2018-11-08 16:36:15 +0800445 case 0x10ec0300:
Kailang Yang394c97f2014-11-12 17:38:08 +0800446 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
447 break;
Kailang Yang3aabf942017-11-08 15:28:33 +0800448 case 0x10ec0275:
449 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
450 break;
Hui Wang88227022021-05-07 10:44:52 +0800451 case 0x10ec0287:
452 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
453 alc_write_coef_idx(codec, 0x8, 0x4ab7);
454 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800455 case 0x10ec0293:
456 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
457 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800458 case 0x10ec0234:
459 case 0x10ec0274:
460 case 0x10ec0294:
Kailang Yang6fbae352016-05-30 16:44:20 +0800461 case 0x10ec0700:
462 case 0x10ec0701:
463 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +0800464 case 0x10ec0711:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +0800465 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
466 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800467 case 0x10ec0662:
468 if ((coef & 0x00f0) == 0x0030)
469 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
470 break;
471 case 0x10ec0272:
472 case 0x10ec0273:
473 case 0x10ec0663:
474 case 0x10ec0665:
475 case 0x10ec0670:
476 case 0x10ec0671:
477 case 0x10ec0672:
478 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
479 break;
Kailang Yang9194a1e2020-01-07 17:22:19 +0800480 case 0x10ec0222:
Kailang Yangf0778872019-10-24 15:13:32 +0800481 case 0x10ec0623:
482 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
483 break;
Kailang Yang394c97f2014-11-12 17:38:08 +0800484 case 0x10ec0668:
485 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
486 break;
487 case 0x10ec0867:
488 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
489 break;
490 case 0x10ec0888:
491 if ((coef & 0x00f0) == 0x0020 || (coef & 0x00f0) == 0x0030)
492 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
493 break;
494 case 0x10ec0892:
Kailang Yange5782a52020-11-27 14:39:23 +0800495 case 0x10ec0897:
Kailang Yang394c97f2014-11-12 17:38:08 +0800496 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
497 break;
498 case 0x10ec0899:
499 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +0800500 case 0x10ec0b00:
Kailang Yang65553b12017-07-11 15:15:47 +0800501 case 0x10ec1168:
Kailang Yanga535ad52017-01-16 16:59:26 +0800502 case 0x10ec1220:
Kailang Yang394c97f2014-11-12 17:38:08 +0800503 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
504 break;
505 }
506}
507
Kailang Yangf9423e72008-05-27 12:32:25 +0200508/* additional initialization for ALC888 variants */
509static void alc888_coef_init(struct hda_codec *codec)
510{
Kailang Yang1df88742014-10-29 16:10:13 +0800511 switch (alc_get_coef0(codec) & 0x00f0) {
512 /* alc888-VA */
513 case 0x00:
514 /* alc888-VB */
515 case 0x10:
516 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
517 break;
518 }
Jaroslav Kysela87a8c372009-07-23 10:58:29 +0200519}
520
Takashi Iwai3fb4a502010-01-19 15:46:37 +0100521/* turn on/off EAPD control (only if available) */
522static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
523{
524 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
525 return;
526 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
527 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
528 on ? 2 : 0);
529}
530
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200531/* turn on/off EAPD controls of the codec */
532static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
533{
534 /* We currently only handle front, HP */
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100535 static const hda_nid_t pins[] = {
Hui Wangaf95b412015-03-26 17:14:55 +0800536 0x0f, 0x10, 0x14, 0x15, 0x17, 0
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200537 };
Michał Mirosławcaf3c042020-01-03 10:23:48 +0100538 const hda_nid_t *p;
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200539 for (p = pins; *p; p++)
540 set_eapd(codec, *p, on);
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200541}
542
Kailang Yangdad31972019-05-10 16:28:57 +0800543static int find_ext_mic_pin(struct hda_codec *codec);
544
545static void alc_headset_mic_no_shutup(struct hda_codec *codec)
546{
547 const struct hda_pincfg *pin;
548 int mic_pin = find_ext_mic_pin(codec);
549 int i;
550
551 /* don't shut up pins when unloading the driver; otherwise it breaks
552 * the default pin setup at the next load of the driver
553 */
554 if (codec->bus->shutdown)
555 return;
556
557 snd_array_for_each(&codec->init_pins, i, pin) {
558 /* use read here for syncing after issuing each verb */
559 if (pin->nid != mic_pin)
560 snd_hda_codec_read(codec, pin->nid, 0,
561 AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
562 }
563
564 codec->pins_shutup = 1;
565}
566
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100567static void alc_shutup_pins(struct hda_codec *codec)
568{
569 struct alc_spec *spec = codec->spec;
570
Kailang Yangdad31972019-05-10 16:28:57 +0800571 switch (codec->core.vendor_id) {
Kailang Yang5aec9892021-10-05 14:35:14 +0800572 case 0x10ec0236:
573 case 0x10ec0256:
Kailang Yang66c5d712019-12-09 15:56:15 +0800574 case 0x10ec0283:
Kailang Yangdad31972019-05-10 16:28:57 +0800575 case 0x10ec0286:
576 case 0x10ec0288:
577 case 0x10ec0298:
578 alc_headset_mic_no_shutup(codec);
579 break;
580 default:
581 if (!spec->no_shutup_pins)
582 snd_hda_shutup_pins(codec);
583 break;
584 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100585}
586
Takashi Iwai1c7161532011-04-07 10:37:16 +0200587/* generic shutup callback;
Lars-Peter Clausen4ce8e6a2016-11-08 15:48:06 +0100588 * just turning off EAPD and a little pause for avoiding pop-noise
Takashi Iwai1c7161532011-04-07 10:37:16 +0200589 */
590static void alc_eapd_shutup(struct hda_codec *codec)
591{
Kailang Yang97a26572013-11-29 00:35:26 -0500592 struct alc_spec *spec = codec->spec;
593
Takashi Iwai1c7161532011-04-07 10:37:16 +0200594 alc_auto_setup_eapd(codec, false);
Kailang Yang97a26572013-11-29 00:35:26 -0500595 if (!spec->no_depop_delay)
596 msleep(200);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100597 alc_shutup_pins(codec);
Takashi Iwai1c7161532011-04-07 10:37:16 +0200598}
599
Takashi Iwai1d045db2011-07-07 18:23:21 +0200600/* generic EAPD initialization */
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200601static void alc_auto_init_amp(struct hda_codec *codec, int type)
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200602{
Takashi Iwai39fa84e2011-06-27 15:28:57 +0200603 alc_auto_setup_eapd(codec, true);
Takashi Iwai5579cd62018-06-19 22:22:41 +0200604 alc_write_gpio(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200605 switch (type) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200606 case ALC_INIT_DEFAULT:
Takashi Iwai7639a062015-03-03 10:07:24 +0100607 switch (codec->core.vendor_id) {
Kailang Yangc9b58002007-10-16 14:30:01 +0200608 case 0x10ec0260:
Takashi Iwai98b24882014-08-18 13:47:50 +0200609 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
Kailang Yangc9b58002007-10-16 14:30:01 +0200610 break;
Kailang Yangc9b58002007-10-16 14:30:01 +0200611 case 0x10ec0880:
612 case 0x10ec0882:
613 case 0x10ec0883:
614 case 0x10ec0885:
Kailang Yang1df88742014-10-29 16:10:13 +0800615 alc_update_coef_idx(codec, 7, 0, 0x2030);
Kailang Yangc9b58002007-10-16 14:30:01 +0200616 break;
Kailang Yangf9423e72008-05-27 12:32:25 +0200617 case 0x10ec0888:
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200618 alc888_coef_init(codec);
Kailang Yangf9423e72008-05-27 12:32:25 +0200619 break;
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200620 }
Kailang Yangbc9f98a2007-04-12 13:06:07 +0200621 break;
622 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200623}
Kailang Yangea1fb292008-08-26 12:58:38 +0200624
Takashi Iwai35a39f92019-02-01 11:19:50 +0100625/* get a primary headphone pin if available */
626static hda_nid_t alc_get_hp_pin(struct alc_spec *spec)
627{
628 if (spec->gen.autocfg.hp_pins[0])
629 return spec->gen.autocfg.hp_pins[0];
630 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
631 return spec->gen.autocfg.line_out_pins[0];
632 return 0;
633}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200634
635/*
636 * Realtek SSID verification
637 */
638
David Henningsson90622912010-10-14 14:50:18 +0200639/* Could be any non-zero and even value. When used as fixup, tells
640 * the driver to ignore any present sku defines.
641 */
642#define ALC_FIXUP_SKU_IGNORE (2)
643
Takashi Iwai23d30f22012-05-07 17:17:32 +0200644static void alc_fixup_sku_ignore(struct hda_codec *codec,
645 const struct hda_fixup *fix, int action)
646{
647 struct alc_spec *spec = codec->spec;
648 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
649 spec->cdefine.fixup = 1;
650 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE;
651 }
652}
653
Mengdong Linb5c66112013-11-29 00:35:35 -0500654static void alc_fixup_no_depop_delay(struct hda_codec *codec,
655 const struct hda_fixup *fix, int action)
656{
657 struct alc_spec *spec = codec->spec;
658
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500659 if (action == HDA_FIXUP_ACT_PROBE) {
Mengdong Linb5c66112013-11-29 00:35:35 -0500660 spec->no_depop_delay = 1;
Mengdong Lin84d2dc32013-12-02 22:26:03 -0500661 codec->depop_delay = 0;
662 }
Mengdong Linb5c66112013-11-29 00:35:35 -0500663}
664
Kailang Yangda00c242010-03-19 11:23:45 +0100665static int alc_auto_parse_customize_define(struct hda_codec *codec)
666{
667 unsigned int ass, tmp, i;
Takashi Iwai7fb56222010-03-22 17:09:47 +0100668 unsigned nid = 0;
Kailang Yangda00c242010-03-19 11:23:45 +0100669 struct alc_spec *spec = codec->spec;
670
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200671 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */
672
David Henningsson90622912010-10-14 14:50:18 +0200673 if (spec->cdefine.fixup) {
674 ass = spec->cdefine.sku_cfg;
675 if (ass == ALC_FIXUP_SKU_IGNORE)
676 return -1;
677 goto do_sku;
678 }
679
Takashi Iwai5100cd02014-02-15 10:03:19 +0100680 if (!codec->bus->pci)
681 return -1;
Takashi Iwai7639a062015-03-03 10:07:24 +0100682 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwaib6cbe512010-07-28 17:43:36 +0200683 if (ass != codec->bus->pci->subsystem_device && (ass & 1))
Kailang Yangda00c242010-03-19 11:23:45 +0100684 goto do_sku;
685
686 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100687 if (codec->core.vendor_id == 0x10ec0260)
Kailang Yangda00c242010-03-19 11:23:45 +0100688 nid = 0x17;
689 ass = snd_hda_codec_get_pincfg(codec, nid);
690
691 if (!(ass & 1)) {
Takashi Iwai4e76a882014-02-25 12:21:03 +0100692 codec_info(codec, "%s: SKU not ready 0x%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100693 codec->core.chip_name, ass);
Kailang Yangda00c242010-03-19 11:23:45 +0100694 return -1;
695 }
696
697 /* check sum */
698 tmp = 0;
699 for (i = 1; i < 16; i++) {
700 if ((ass >> i) & 1)
701 tmp++;
702 }
703 if (((ass >> 16) & 0xf) != tmp)
704 return -1;
705
706 spec->cdefine.port_connectivity = ass >> 30;
707 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20;
708 spec->cdefine.check_sum = (ass >> 16) & 0xf;
709 spec->cdefine.customization = ass >> 8;
710do_sku:
711 spec->cdefine.sku_cfg = ass;
712 spec->cdefine.external_amp = (ass & 0x38) >> 3;
713 spec->cdefine.platform_type = (ass & 0x4) >> 2;
714 spec->cdefine.swap = (ass & 0x2) >> 1;
715 spec->cdefine.override = ass & 0x1;
716
Takashi Iwai4e76a882014-02-25 12:21:03 +0100717 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100718 nid, spec->cdefine.sku_cfg);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100719 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
Kailang Yangda00c242010-03-19 11:23:45 +0100720 spec->cdefine.port_connectivity);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100721 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
722 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
723 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
724 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
725 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
726 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
727 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
Kailang Yangda00c242010-03-19 11:23:45 +0100728
729 return 0;
730}
731
Takashi Iwai08c189f2012-12-19 15:22:24 +0100732/* return the position of NID in the list, or -1 if not found */
733static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
734{
735 int i;
736 for (i = 0; i < nums; i++)
737 if (list[i] == nid)
738 return i;
739 return -1;
740}
Takashi Iwai1d045db2011-07-07 18:23:21 +0200741/* return true if the given NID is found in the list */
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200742static bool found_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
743{
Takashi Iwai21268962011-07-07 15:01:13 +0200744 return find_idx_in_nid_list(nid, list, nums) >= 0;
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200745}
746
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200747/* check subsystem ID and set up device-specific initialization;
748 * return 1 if initialized, 0 if invalid SSID
749 */
750/* 32-bit subsystem ID for BIOS loading in HD Audio codec.
751 * 31 ~ 16 : Manufacture ID
752 * 15 ~ 8 : SKU ID
753 * 7 ~ 0 : Assembly ID
754 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
755 */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100756static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200757{
758 unsigned int ass, tmp, i;
759 unsigned nid;
760 struct alc_spec *spec = codec->spec;
761
David Henningsson90622912010-10-14 14:50:18 +0200762 if (spec->cdefine.fixup) {
763 ass = spec->cdefine.sku_cfg;
764 if (ass == ALC_FIXUP_SKU_IGNORE)
765 return 0;
766 goto do_sku;
767 }
768
Takashi Iwai7639a062015-03-03 10:07:24 +0100769 ass = codec->core.subsystem_id & 0xffff;
Takashi Iwai5100cd02014-02-15 10:03:19 +0100770 if (codec->bus->pci &&
771 ass != codec->bus->pci->subsystem_device && (ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200772 goto do_sku;
773
774 /* invalid SSID, check the special NID pin defcfg instead */
775 /*
Sasha Alexandrdef319f2009-06-16 16:00:15 -0400776 * 31~30 : port connectivity
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200777 * 29~21 : reserve
778 * 20 : PCBEEP input
779 * 19~16 : Check sum (15:1)
780 * 15~1 : Custom
781 * 0 : override
782 */
783 nid = 0x1d;
Takashi Iwai7639a062015-03-03 10:07:24 +0100784 if (codec->core.vendor_id == 0x10ec0260)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200785 nid = 0x17;
786 ass = snd_hda_codec_get_pincfg(codec, nid);
Takashi Iwai4e76a882014-02-25 12:21:03 +0100787 codec_dbg(codec,
788 "realtek: No valid SSID, checking pincfg 0x%08x for NID 0x%x\n",
Takashi Iwaicb6605c2009-04-28 13:03:19 +0200789 ass, nid);
Kailang Yang6227cdc2010-02-25 08:36:52 +0100790 if (!(ass & 1))
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200791 return 0;
792 if ((ass >> 30) != 1) /* no physical connection */
793 return 0;
794
795 /* check sum */
796 tmp = 0;
797 for (i = 1; i < 16; i++) {
798 if ((ass >> i) & 1)
799 tmp++;
800 }
801 if (((ass >> 16) & 0xf) != tmp)
802 return 0;
803do_sku:
Takashi Iwai4e76a882014-02-25 12:21:03 +0100804 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
Takashi Iwai7639a062015-03-03 10:07:24 +0100805 ass & 0xffff, codec->core.vendor_id);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200806 /*
807 * 0 : override
808 * 1 : Swap Jack
809 * 2 : 0 --> Desktop, 1 --> Laptop
810 * 3~5 : External Amplifier control
811 * 7~6 : Reserved
812 */
813 tmp = (ass & 0x38) >> 3; /* external Amp control */
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200814 if (spec->init_amp == ALC_INIT_UNDEFINED) {
815 switch (tmp) {
816 case 1:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200817 alc_setup_gpio(codec, 0x01);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200818 break;
819 case 3:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200820 alc_setup_gpio(codec, 0x02);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200821 break;
822 case 7:
Takashi Iwai5579cd62018-06-19 22:22:41 +0200823 alc_setup_gpio(codec, 0x03);
Takashi Iwai1c76aa52018-06-21 16:37:54 +0200824 break;
825 case 5:
826 default:
827 spec->init_amp = ALC_INIT_DEFAULT;
828 break;
829 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200830 }
831
832 /* is laptop or Desktop and enable the function "Mute internal speaker
833 * when the external headphone out jack is plugged"
834 */
835 if (!(ass & 0x8000))
836 return 1;
837 /*
838 * 10~8 : Jack location
839 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered
840 * 14~13: Resvered
841 * 15 : 1 --> enable the function "Mute internal speaker
842 * when the external headphone out jack is plugged"
843 */
Takashi Iwai35a39f92019-02-01 11:19:50 +0100844 if (!alc_get_hp_pin(spec)) {
Takashi Iwai01d48252009-10-06 13:21:54 +0200845 hda_nid_t nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200846 tmp = (ass >> 11) & 0x3; /* HP to chassis */
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100847 nid = ports[tmp];
Takashi Iwai08c189f2012-12-19 15:22:24 +0100848 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins,
849 spec->gen.autocfg.line_outs))
Takashi Iwai3af9ee62011-06-27 12:34:01 +0200850 return 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +0100851 spec->gen.autocfg.hp_pins[0] = nid;
Kailang Yangc9b58002007-10-16 14:30:01 +0200852 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200853 return 1;
854}
Kailang Yangea1fb292008-08-26 12:58:38 +0200855
Takashi Iwai3e6179b2011-07-08 16:55:13 +0200856/* Check the validity of ALC subsystem-id
857 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
858static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200859{
Takashi Iwai58c57cf2014-01-07 18:22:49 +0100860 if (!alc_subsystem_id(codec, ports)) {
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200861 struct alc_spec *spec = codec->spec;
Takashi Iwai67791202020-04-18 21:06:39 +0200862 if (spec->init_amp == ALC_INIT_UNDEFINED) {
863 codec_dbg(codec,
864 "realtek: Enable default setup for auto mode as fallback\n");
865 spec->init_amp = ALC_INIT_DEFAULT;
866 }
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200867 }
Takashi Iwai21268962011-07-07 15:01:13 +0200868}
Takashi Iwai1a1455d2011-04-28 17:36:18 +0200869
Takashi Iwai41e41f12005-06-08 14:48:49 +0200870/*
Takashi Iwai1d045db2011-07-07 18:23:21 +0200871 */
872
David Henningsson9d36a7d2014-10-07 10:18:42 +0200873static void alc_fixup_inv_dmic(struct hda_codec *codec,
874 const struct hda_fixup *fix, int action)
Takashi Iwai125821a2012-06-22 14:30:29 +0200875{
876 struct alc_spec *spec = codec->spec;
Takashi Iwai668d1e92012-11-29 14:10:17 +0100877
David Henningsson9d36a7d2014-10-07 10:18:42 +0200878 spec->gen.inv_dmic_split = 1;
Takashi Iwai6e72aa52012-06-25 10:52:25 +0200879}
880
Takashi Iwai603c4012008-07-30 15:01:44 +0200881
Takashi Iwai2eab6942012-12-18 15:30:41 +0100882static int alc_build_controls(struct hda_codec *codec)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700883{
Takashi Iwaia5cb4632018-06-20 12:50:11 +0200884 int err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700885
Takashi Iwai08c189f2012-12-19 15:22:24 +0100886 err = snd_hda_gen_build_controls(codec);
887 if (err < 0)
888 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700889
Takashi Iwai1727a772013-01-10 09:52:52 +0100890 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
Takashi Iwai420b0fe2012-03-12 12:35:27 +0100891 return 0;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700892}
893
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200894
Linus Torvalds1da177e2005-04-16 15:20:36 -0700895/*
Takashi Iwaiae6b8132006-03-03 16:47:17 +0100896 * Common callbacks
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200897 */
Takashi Iwai16ded522005-06-10 19:58:24 +0200898
Takashi Iwaic9af7532019-05-10 11:01:43 +0200899static void alc_pre_init(struct hda_codec *codec)
900{
901 alc_fill_eapd_coef(codec);
902}
903
Kailang Yangaeac1a02019-05-16 16:10:44 +0800904#define is_s3_resume(codec) \
905 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
Takashi Iwaic9af7532019-05-10 11:01:43 +0200906#define is_s4_resume(codec) \
907 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
908
Linus Torvalds1da177e2005-04-16 15:20:36 -0700909static int alc_init(struct hda_codec *codec)
910{
911 struct alc_spec *spec = codec->spec;
Takashi Iwaie9edcee2005-06-13 14:16:38 +0200912
Takashi Iwaic9af7532019-05-10 11:01:43 +0200913 /* hibernation resume needs the full chip initialization */
914 if (is_s4_resume(codec))
915 alc_pre_init(codec);
916
Takashi Iwai546bb672012-03-07 08:37:19 +0100917 if (spec->init_hook)
918 spec->init_hook(codec);
Kailang Yang526af6e2012-03-07 08:25:20 +0100919
Takashi Iwai89781d02019-08-30 12:03:38 +0200920 spec->gen.skip_verbs = 1; /* applied in below */
Kailang Yang607ca3b2019-04-26 16:35:41 +0800921 snd_hda_gen_init(codec);
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200922 alc_fix_pll(codec);
Takashi Iwai4a79ba32009-04-22 16:31:35 +0200923 alc_auto_init_amp(codec, spec->init_amp);
Takashi Iwai89781d02019-08-30 12:03:38 +0200924 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +0200925
Takashi Iwai1727a772013-01-10 09:52:52 +0100926 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
Takashi Iwaie08a0072006-09-07 17:52:14 +0200927
Linus Torvalds1da177e2005-04-16 15:20:36 -0700928 return 0;
929}
930
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100931static inline void alc_shutup(struct hda_codec *codec)
932{
Takashi Iwai1c7161532011-04-07 10:37:16 +0200933 struct alc_spec *spec = codec->spec;
934
Takashi Iwaic7273bd2018-06-12 16:09:57 +0200935 if (!snd_hda_get_bool_hint(codec, "shutup"))
936 return; /* disabled explicitly by hints */
937
Takashi Iwai1c7161532011-04-07 10:37:16 +0200938 if (spec && spec->shutup)
939 spec->shutup(codec);
Takashi Iwai9bfb2842013-07-24 14:31:50 +0200940 else
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +0100941 alc_shutup_pins(codec);
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100942}
943
Takashi Iwai8a02c0c2014-02-10 18:09:45 +0100944#define alc_free snd_hda_gen_free
Linus Torvalds1da177e2005-04-16 15:20:36 -0700945
Takashi Iwai83012a72012-08-24 18:38:08 +0200946#ifdef CONFIG_PM
Daniel T Chenc97259d2009-12-27 18:52:08 -0500947static void alc_power_eapd(struct hda_codec *codec)
948{
Takashi Iwai691f1fc2011-04-07 10:31:43 +0200949 alc_auto_setup_eapd(codec, false);
Daniel T Chenc97259d2009-12-27 18:52:08 -0500950}
951
Takashi Iwai68cb2b52012-07-02 15:20:37 +0200952static int alc_suspend(struct hda_codec *codec)
Hector Martinf5de24b2009-12-20 22:51:31 +0100953{
954 struct alc_spec *spec = codec->spec;
Takashi Iwaia4e09aa2009-12-27 11:22:24 +0100955 alc_shutup(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100956 if (spec && spec->power_hook)
Daniel T Chenc97259d2009-12-27 18:52:08 -0500957 spec->power_hook(codec);
Hector Martinf5de24b2009-12-20 22:51:31 +0100958 return 0;
959}
960#endif
961
Takashi Iwai2a439522011-07-26 09:52:50 +0200962#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100963static int alc_resume(struct hda_codec *codec)
964{
Kailang Yang97a26572013-11-29 00:35:26 -0500965 struct alc_spec *spec = codec->spec;
966
967 if (!spec->no_depop_delay)
968 msleep(150); /* to avoid pop noise */
Takashi Iwaie044c392008-10-27 16:56:24 +0100969 codec->patch_ops.init(codec);
Takashi Iwai1a462be2020-01-09 10:01:04 +0100970 snd_hda_regmap_sync(codec);
Takashi Iwai9e5341b2010-09-21 09:57:06 +0200971 hda_call_check_power_status(codec, 0x01);
Takashi Iwaie044c392008-10-27 16:56:24 +0100972 return 0;
973}
Takashi Iwaie044c392008-10-27 16:56:24 +0100974#endif
975
Linus Torvalds1da177e2005-04-16 15:20:36 -0700976/*
977 */
Takashi Iwaia9111322011-05-02 11:30:18 +0200978static const struct hda_codec_ops alc_patch_ops = {
Linus Torvalds1da177e2005-04-16 15:20:36 -0700979 .build_controls = alc_build_controls,
Takashi Iwai08c189f2012-12-19 15:22:24 +0100980 .build_pcms = snd_hda_gen_build_pcms,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700981 .init = alc_init,
982 .free = alc_free,
David Henningsson29adc4b2012-09-25 11:31:00 +0200983 .unsol_event = snd_hda_jack_unsol_event,
Takashi Iwai2a439522011-07-26 09:52:50 +0200984#ifdef CONFIG_PM
Takashi Iwaie044c392008-10-27 16:56:24 +0100985 .resume = alc_resume,
Hector Martinf5de24b2009-12-20 22:51:31 +0100986 .suspend = alc_suspend,
Takashi Iwaifce52a32013-01-07 12:42:48 +0100987 .check_power_status = snd_hda_gen_check_power_status,
Takashi Iwaicb53c622007-08-10 17:21:45 +0200988#endif
Linus Torvalds1da177e2005-04-16 15:20:36 -0700989};
990
David Henningsson29adc4b2012-09-25 11:31:00 +0200991
Takashi Iwaided255b2015-10-01 17:59:43 +0200992#define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
Kailang Yangc027ddc2010-03-19 11:33:06 +0100993
Takashi Iwai2fa522b2005-05-12 14:51:12 +0200994/*
Kailang Yang4b016932013-11-28 11:55:09 +0100995 * Rename codecs appropriately from COEF value or subvendor id
Takashi Iwaie16fb6d2011-10-17 16:39:09 +0200996 */
997struct alc_codec_rename_table {
998 unsigned int vendor_id;
999 unsigned short coef_mask;
1000 unsigned short coef_bits;
1001 const char *name;
1002};
1003
Kailang Yang4b016932013-11-28 11:55:09 +01001004struct alc_codec_rename_pci_table {
1005 unsigned int codec_vendor_id;
1006 unsigned short pci_subvendor;
1007 unsigned short pci_subdevice;
1008 const char *name;
1009};
1010
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01001011static const struct alc_codec_rename_table rename_tbl[] = {
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001012 { 0x10ec0221, 0xf00f, 0x1003, "ALC231" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001013 { 0x10ec0269, 0xfff0, 0x3010, "ALC277" },
1014 { 0x10ec0269, 0xf0f0, 0x2010, "ALC259" },
1015 { 0x10ec0269, 0xf0f0, 0x3010, "ALC258" },
1016 { 0x10ec0269, 0x00f0, 0x0010, "ALC269VB" },
1017 { 0x10ec0269, 0xffff, 0xa023, "ALC259" },
1018 { 0x10ec0269, 0xffff, 0x6023, "ALC281X" },
1019 { 0x10ec0269, 0x00f0, 0x0020, "ALC269VC" },
Kailang Yangadcc70b2012-05-25 08:08:38 +02001020 { 0x10ec0269, 0x00f0, 0x0030, "ALC269VD" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001021 { 0x10ec0662, 0xffff, 0x4020, "ALC656" },
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001022 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1023 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1024 { 0x10ec0888, 0xf0f0, 0x3020, "ALC886" },
1025 { 0x10ec0899, 0x2000, 0x2000, "ALC899" },
1026 { 0x10ec0892, 0xffff, 0x8020, "ALC661" },
1027 { 0x10ec0892, 0xffff, 0x8011, "ALC661" },
1028 { 0x10ec0892, 0xffff, 0x4011, "ALC656" },
1029 { } /* terminator */
1030};
1031
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01001032static const struct alc_codec_rename_pci_table rename_pci_tbl[] = {
Kailang Yang4b016932013-11-28 11:55:09 +01001033 { 0x10ec0280, 0x1028, 0, "ALC3220" },
1034 { 0x10ec0282, 0x1028, 0, "ALC3221" },
1035 { 0x10ec0283, 0x1028, 0, "ALC3223" },
Kailang Yang193177d2014-04-23 16:06:13 +08001036 { 0x10ec0288, 0x1028, 0, "ALC3263" },
Kailang Yang4b016932013-11-28 11:55:09 +01001037 { 0x10ec0292, 0x1028, 0, "ALC3226" },
Kailang Yang193177d2014-04-23 16:06:13 +08001038 { 0x10ec0293, 0x1028, 0, "ALC3235" },
Kailang Yang4b016932013-11-28 11:55:09 +01001039 { 0x10ec0255, 0x1028, 0, "ALC3234" },
1040 { 0x10ec0668, 0x1028, 0, "ALC3661" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001041 { 0x10ec0275, 0x1028, 0, "ALC3260" },
1042 { 0x10ec0899, 0x1028, 0, "ALC3861" },
Kailang Yang2c674fa2015-05-05 15:02:42 +08001043 { 0x10ec0298, 0x1028, 0, "ALC3266" },
Kailang Yang736f20a2017-10-20 15:06:34 +08001044 { 0x10ec0236, 0x1028, 0, "ALC3204" },
Kailang Yang82324502015-05-25 17:16:49 +08001045 { 0x10ec0256, 0x1028, 0, "ALC3246" },
Kailang Yang42314302016-02-03 15:03:50 +08001046 { 0x10ec0225, 0x1028, 0, "ALC3253" },
Kailang Yang7d727862016-05-24 16:46:07 +08001047 { 0x10ec0295, 0x1028, 0, "ALC3254" },
Kailang Yang28f1f9b2017-01-04 14:49:07 +08001048 { 0x10ec0299, 0x1028, 0, "ALC3271" },
Kailang Yange6e5f7a2014-06-06 16:46:43 +08001049 { 0x10ec0670, 0x1025, 0, "ALC669X" },
1050 { 0x10ec0676, 0x1025, 0, "ALC679X" },
1051 { 0x10ec0282, 0x1043, 0, "ALC3229" },
1052 { 0x10ec0233, 0x1043, 0, "ALC3236" },
1053 { 0x10ec0280, 0x103c, 0, "ALC3228" },
1054 { 0x10ec0282, 0x103c, 0, "ALC3227" },
1055 { 0x10ec0286, 0x103c, 0, "ALC3242" },
1056 { 0x10ec0290, 0x103c, 0, "ALC3241" },
1057 { 0x10ec0668, 0x103c, 0, "ALC3662" },
1058 { 0x10ec0283, 0x17aa, 0, "ALC3239" },
1059 { 0x10ec0292, 0x17aa, 0, "ALC3232" },
Kailang Yang4b016932013-11-28 11:55:09 +01001060 { } /* terminator */
1061};
1062
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001063static int alc_codec_rename_from_preset(struct hda_codec *codec)
1064{
1065 const struct alc_codec_rename_table *p;
Kailang Yang4b016932013-11-28 11:55:09 +01001066 const struct alc_codec_rename_pci_table *q;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001067
1068 for (p = rename_tbl; p->vendor_id; p++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001069 if (p->vendor_id != codec->core.vendor_id)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001070 continue;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02001071 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001072 return alc_codec_rename(codec, p->name);
1073 }
Kailang Yang4b016932013-11-28 11:55:09 +01001074
Takashi Iwai5100cd02014-02-15 10:03:19 +01001075 if (!codec->bus->pci)
1076 return 0;
Kailang Yang4b016932013-11-28 11:55:09 +01001077 for (q = rename_pci_tbl; q->codec_vendor_id; q++) {
Takashi Iwai7639a062015-03-03 10:07:24 +01001078 if (q->codec_vendor_id != codec->core.vendor_id)
Kailang Yang4b016932013-11-28 11:55:09 +01001079 continue;
1080 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1081 continue;
1082 if (!q->pci_subdevice ||
1083 q->pci_subdevice == codec->bus->pci->subsystem_device)
1084 return alc_codec_rename(codec, q->name);
1085 }
1086
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001087 return 0;
1088}
1089
Takashi Iwaie4770622011-07-08 11:11:35 +02001090
1091/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001092 * Digital-beep handlers
1093 */
1094#ifdef CONFIG_SND_HDA_INPUT_BEEP
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001095
1096/* additional beep mixers; private_value will be overwritten */
1097static const struct snd_kcontrol_new alc_beep_mixer[] = {
1098 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT),
1099 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_INPUT),
1100};
1101
1102/* set up and create beep controls */
1103static int set_beep_amp(struct alc_spec *spec, hda_nid_t nid,
1104 int idx, int dir)
1105{
1106 struct snd_kcontrol_new *knew;
1107 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir);
1108 int i;
1109
1110 for (i = 0; i < ARRAY_SIZE(alc_beep_mixer); i++) {
1111 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
1112 &alc_beep_mixer[i]);
1113 if (!knew)
1114 return -ENOMEM;
1115 knew->private_value = beep_amp;
1116 }
1117 return 0;
1118}
Takashi Iwai1d045db2011-07-07 18:23:21 +02001119
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001120static const struct snd_pci_quirk beep_allow_list[] = {
Duncan Roe71100052012-10-10 14:19:50 +02001121 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
W. Trevor Kinga4b7f21d2014-03-29 17:47:24 -07001122 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001123 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
Takashi Iwai8554ee42013-02-25 09:54:43 +01001124 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001125 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1126 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1127 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
Takashi Iwai78f8baf2012-03-06 14:02:32 +01001128 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001129 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001130 /* denylist -- no beep available */
Takashi Iwai051c78a2019-08-22 09:58:07 +02001131 SND_PCI_QUIRK(0x17aa, 0x309e, "Lenovo ThinkCentre M73", 0),
1132 SND_PCI_QUIRK(0x17aa, 0x30a3, "Lenovo ThinkCentre M93", 0),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001133 {}
1134};
1135
1136static inline int has_cdefine_beep(struct hda_codec *codec)
1137{
1138 struct alc_spec *spec = codec->spec;
1139 const struct snd_pci_quirk *q;
Takashi Iwai6317e5e2020-07-14 19:26:27 +02001140 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001141 if (q)
1142 return q->value;
1143 return spec->cdefine.enable_pcbeep;
1144}
1145#else
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001146#define set_beep_amp(spec, nid, idx, dir) 0
Takashi Iwai1d045db2011-07-07 18:23:21 +02001147#define has_cdefine_beep(codec) 0
1148#endif
1149
1150/* parse the BIOS configuration and set up the alc_spec */
1151/* return 1 if successful, 0 if the proper config is not found,
1152 * or a negative error code
1153 */
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001154static int alc_parse_auto_config(struct hda_codec *codec,
1155 const hda_nid_t *ignore_nids,
1156 const hda_nid_t *ssid_nids)
Takashi Iwai1d045db2011-07-07 18:23:21 +02001157{
1158 struct alc_spec *spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001159 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001160 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001161
Takashi Iwai53c334a2011-08-23 18:27:14 +02001162 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1163 spec->parse_flags);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001164 if (err < 0)
1165 return err;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001166
1167 if (ssid_nids)
1168 alc_ssid_check(codec, ssid_nids);
1169
Takashi Iwai08c189f2012-12-19 15:22:24 +01001170 err = snd_hda_gen_parse_auto_config(codec, cfg);
1171 if (err < 0)
1172 return err;
Takashi Iwai070cff42012-02-21 12:54:17 +01001173
Takashi Iwai1d045db2011-07-07 18:23:21 +02001174 return 1;
1175}
1176
Takashi Iwai3de95172012-05-07 18:03:15 +02001177/* common preparation job for alc_spec */
1178static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1179{
1180 struct alc_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1181 int err;
1182
1183 if (!spec)
1184 return -ENOMEM;
1185 codec->spec = spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001186 snd_hda_gen_spec_init(&spec->gen);
1187 spec->gen.mixer_nid = mixer_nid;
1188 spec->gen.own_eapd_ctl = 1;
Takashi Iwai1098b7c2012-12-17 20:03:15 +01001189 codec->single_adc_amp = 1;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001190 /* FIXME: do we need this for all Realtek codec models? */
1191 codec->spdif_status_reset = 1;
Kai Vehmanena6e7d0a2020-10-12 13:27:04 +03001192 codec->forced_resume = 1;
Takashi Iwai225068a2015-05-29 10:42:14 +02001193 codec->patch_ops = alc_patch_ops;
Takashi Iwaib837a9f2022-01-31 08:57:38 +01001194 mutex_init(&spec->coef_mutex);
Takashi Iwai3de95172012-05-07 18:03:15 +02001195
1196 err = alc_codec_rename_from_preset(codec);
1197 if (err < 0) {
1198 kfree(spec);
1199 return err;
1200 }
1201 return 0;
1202}
1203
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001204static int alc880_parse_auto_config(struct hda_codec *codec)
1205{
1206 static const hda_nid_t alc880_ignore[] = { 0x1d, 0 };
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02001207 static const hda_nid_t alc880_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001208 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1209}
1210
Takashi Iwai1d045db2011-07-07 18:23:21 +02001211/*
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001212 * ALC880 fix-ups
1213 */
1214enum {
Takashi Iwai411225a2012-02-20 17:48:19 +01001215 ALC880_FIXUP_GPIO1,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001216 ALC880_FIXUP_GPIO2,
1217 ALC880_FIXUP_MEDION_RIM,
Takashi Iwaidc6af522012-02-17 16:18:59 +01001218 ALC880_FIXUP_LG,
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001219 ALC880_FIXUP_LG_LW25,
Takashi Iwaif02aab52012-02-17 16:33:56 +01001220 ALC880_FIXUP_W810,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001221 ALC880_FIXUP_EAPD_COEF,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001222 ALC880_FIXUP_TCL_S700,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001223 ALC880_FIXUP_VOL_KNOB,
1224 ALC880_FIXUP_FUJITSU,
Takashi Iwaiba533812012-02-20 16:36:52 +01001225 ALC880_FIXUP_F1734,
Takashi Iwai817de922012-02-20 17:20:48 +01001226 ALC880_FIXUP_UNIWILL,
Takashi Iwai967b88c2012-02-20 17:31:02 +01001227 ALC880_FIXUP_UNIWILL_DIG,
Takashi Iwai96e225f2012-02-20 17:41:51 +01001228 ALC880_FIXUP_Z71V,
Takashi Iwai487a5882013-11-07 07:29:30 +01001229 ALC880_FIXUP_ASUS_W5A,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001230 ALC880_FIXUP_3ST_BASE,
1231 ALC880_FIXUP_3ST,
1232 ALC880_FIXUP_3ST_DIG,
1233 ALC880_FIXUP_5ST_BASE,
1234 ALC880_FIXUP_5ST,
1235 ALC880_FIXUP_5ST_DIG,
1236 ALC880_FIXUP_6ST_BASE,
1237 ALC880_FIXUP_6ST,
1238 ALC880_FIXUP_6ST_DIG,
Takashi Iwai53971452013-01-23 18:21:37 +01001239 ALC880_FIXUP_6ST_AUTOMUTE,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001240};
1241
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001242/* enable the volume-knob widget support on NID 0x21 */
1243static void alc880_fixup_vol_knob(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001244 const struct hda_fixup *fix, int action)
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001245{
Takashi Iwai1727a772013-01-10 09:52:52 +01001246 if (action == HDA_FIXUP_ACT_PROBE)
Takashi Iwai62f949b2014-09-11 14:06:53 +02001247 snd_hda_jack_detect_enable_callback(codec, 0x21,
1248 alc_update_knob_master);
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001249}
1250
Takashi Iwai1727a772013-01-10 09:52:52 +01001251static const struct hda_fixup alc880_fixups[] = {
Takashi Iwai411225a2012-02-20 17:48:19 +01001252 [ALC880_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001253 .type = HDA_FIXUP_FUNC,
1254 .v.func = alc_fixup_gpio1,
Takashi Iwai411225a2012-02-20 17:48:19 +01001255 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001256 [ALC880_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001257 .type = HDA_FIXUP_FUNC,
1258 .v.func = alc_fixup_gpio2,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001259 },
1260 [ALC880_FIXUP_MEDION_RIM] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001261 .type = HDA_FIXUP_VERBS,
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001262 .v.verbs = (const struct hda_verb[]) {
1263 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1264 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1265 { }
1266 },
1267 .chained = true,
1268 .chain_id = ALC880_FIXUP_GPIO2,
1269 },
Takashi Iwaidc6af522012-02-17 16:18:59 +01001270 [ALC880_FIXUP_LG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001271 .type = HDA_FIXUP_PINS,
1272 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaidc6af522012-02-17 16:18:59 +01001273 /* disable bogus unused pins */
1274 { 0x16, 0x411111f0 },
1275 { 0x18, 0x411111f0 },
1276 { 0x1a, 0x411111f0 },
1277 { }
1278 }
1279 },
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001280 [ALC880_FIXUP_LG_LW25] = {
1281 .type = HDA_FIXUP_PINS,
1282 .v.pins = (const struct hda_pintbl[]) {
1283 { 0x1a, 0x0181344f }, /* line-in */
1284 { 0x1b, 0x0321403f }, /* headphone */
1285 { }
1286 }
1287 },
Takashi Iwaif02aab52012-02-17 16:33:56 +01001288 [ALC880_FIXUP_W810] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001289 .type = HDA_FIXUP_PINS,
1290 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001291 /* disable bogus unused pins */
1292 { 0x17, 0x411111f0 },
1293 { }
1294 },
1295 .chained = true,
1296 .chain_id = ALC880_FIXUP_GPIO2,
1297 },
Takashi Iwai27e917f2012-02-17 17:49:54 +01001298 [ALC880_FIXUP_EAPD_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001299 .type = HDA_FIXUP_VERBS,
Takashi Iwai27e917f2012-02-17 17:49:54 +01001300 .v.verbs = (const struct hda_verb[]) {
1301 /* change to EAPD mode */
1302 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1303 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
1304 {}
1305 },
1306 },
Takashi Iwaib9368f52012-02-17 17:54:44 +01001307 [ALC880_FIXUP_TCL_S700] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001308 .type = HDA_FIXUP_VERBS,
Takashi Iwaib9368f52012-02-17 17:54:44 +01001309 .v.verbs = (const struct hda_verb[]) {
1310 /* change to EAPD mode */
1311 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
1312 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
1313 {}
1314 },
1315 .chained = true,
1316 .chain_id = ALC880_FIXUP_GPIO2,
1317 },
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001318 [ALC880_FIXUP_VOL_KNOB] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001319 .type = HDA_FIXUP_FUNC,
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001320 .v.func = alc880_fixup_vol_knob,
1321 },
1322 [ALC880_FIXUP_FUJITSU] = {
1323 /* override all pins as BIOS on old Amilo is broken */
Takashi Iwai1727a772013-01-10 09:52:52 +01001324 .type = HDA_FIXUP_PINS,
1325 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001326 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001327 { 0x15, 0x99030120 }, /* speaker */
1328 { 0x16, 0x99030130 }, /* bass speaker */
1329 { 0x17, 0x411111f0 }, /* N/A */
1330 { 0x18, 0x411111f0 }, /* N/A */
1331 { 0x19, 0x01a19950 }, /* mic-in */
1332 { 0x1a, 0x411111f0 }, /* N/A */
1333 { 0x1b, 0x411111f0 }, /* N/A */
1334 { 0x1c, 0x411111f0 }, /* N/A */
1335 { 0x1d, 0x411111f0 }, /* N/A */
1336 { 0x1e, 0x01454140 }, /* SPDIF out */
1337 { }
1338 },
1339 .chained = true,
1340 .chain_id = ALC880_FIXUP_VOL_KNOB,
1341 },
Takashi Iwaiba533812012-02-20 16:36:52 +01001342 [ALC880_FIXUP_F1734] = {
1343 /* almost compatible with FUJITSU, but no bass and SPDIF */
Takashi Iwai1727a772013-01-10 09:52:52 +01001344 .type = HDA_FIXUP_PINS,
1345 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaibb148bd2015-08-13 18:02:39 +02001346 { 0x14, 0x0121401f }, /* HP */
Takashi Iwaiba533812012-02-20 16:36:52 +01001347 { 0x15, 0x99030120 }, /* speaker */
1348 { 0x16, 0x411111f0 }, /* N/A */
1349 { 0x17, 0x411111f0 }, /* N/A */
1350 { 0x18, 0x411111f0 }, /* N/A */
1351 { 0x19, 0x01a19950 }, /* mic-in */
1352 { 0x1a, 0x411111f0 }, /* N/A */
1353 { 0x1b, 0x411111f0 }, /* N/A */
1354 { 0x1c, 0x411111f0 }, /* N/A */
1355 { 0x1d, 0x411111f0 }, /* N/A */
1356 { 0x1e, 0x411111f0 }, /* N/A */
1357 { }
1358 },
1359 .chained = true,
1360 .chain_id = ALC880_FIXUP_VOL_KNOB,
1361 },
Takashi Iwai817de922012-02-20 17:20:48 +01001362 [ALC880_FIXUP_UNIWILL] = {
1363 /* need to fix HP and speaker pins to be parsed correctly */
Takashi Iwai1727a772013-01-10 09:52:52 +01001364 .type = HDA_FIXUP_PINS,
1365 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai817de922012-02-20 17:20:48 +01001366 { 0x14, 0x0121411f }, /* HP */
1367 { 0x15, 0x99030120 }, /* speaker */
1368 { 0x16, 0x99030130 }, /* bass speaker */
1369 { }
1370 },
1371 },
Takashi Iwai967b88c2012-02-20 17:31:02 +01001372 [ALC880_FIXUP_UNIWILL_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001373 .type = HDA_FIXUP_PINS,
1374 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai967b88c2012-02-20 17:31:02 +01001375 /* disable bogus unused pins */
1376 { 0x17, 0x411111f0 },
1377 { 0x19, 0x411111f0 },
1378 { 0x1b, 0x411111f0 },
1379 { 0x1f, 0x411111f0 },
1380 { }
1381 }
1382 },
Takashi Iwai96e225f2012-02-20 17:41:51 +01001383 [ALC880_FIXUP_Z71V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001384 .type = HDA_FIXUP_PINS,
1385 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai96e225f2012-02-20 17:41:51 +01001386 /* set up the whole pins as BIOS is utterly broken */
1387 { 0x14, 0x99030120 }, /* speaker */
1388 { 0x15, 0x0121411f }, /* HP */
1389 { 0x16, 0x411111f0 }, /* N/A */
1390 { 0x17, 0x411111f0 }, /* N/A */
1391 { 0x18, 0x01a19950 }, /* mic-in */
1392 { 0x19, 0x411111f0 }, /* N/A */
1393 { 0x1a, 0x01813031 }, /* line-in */
1394 { 0x1b, 0x411111f0 }, /* N/A */
1395 { 0x1c, 0x411111f0 }, /* N/A */
1396 { 0x1d, 0x411111f0 }, /* N/A */
1397 { 0x1e, 0x0144111e }, /* SPDIF */
1398 { }
1399 }
1400 },
Takashi Iwai487a5882013-11-07 07:29:30 +01001401 [ALC880_FIXUP_ASUS_W5A] = {
1402 .type = HDA_FIXUP_PINS,
1403 .v.pins = (const struct hda_pintbl[]) {
1404 /* set up the whole pins as BIOS is utterly broken */
1405 { 0x14, 0x0121411f }, /* HP */
1406 { 0x15, 0x411111f0 }, /* N/A */
1407 { 0x16, 0x411111f0 }, /* N/A */
1408 { 0x17, 0x411111f0 }, /* N/A */
1409 { 0x18, 0x90a60160 }, /* mic */
1410 { 0x19, 0x411111f0 }, /* N/A */
1411 { 0x1a, 0x411111f0 }, /* N/A */
1412 { 0x1b, 0x411111f0 }, /* N/A */
1413 { 0x1c, 0x411111f0 }, /* N/A */
1414 { 0x1d, 0x411111f0 }, /* N/A */
1415 { 0x1e, 0xb743111e }, /* SPDIF out */
1416 { }
1417 },
1418 .chained = true,
1419 .chain_id = ALC880_FIXUP_GPIO1,
1420 },
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001421 [ALC880_FIXUP_3ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001422 .type = HDA_FIXUP_PINS,
1423 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001424 { 0x14, 0x01014010 }, /* line-out */
1425 { 0x15, 0x411111f0 }, /* N/A */
1426 { 0x16, 0x411111f0 }, /* N/A */
1427 { 0x17, 0x411111f0 }, /* N/A */
1428 { 0x18, 0x01a19c30 }, /* mic-in */
1429 { 0x19, 0x0121411f }, /* HP */
1430 { 0x1a, 0x01813031 }, /* line-in */
1431 { 0x1b, 0x02a19c40 }, /* front-mic */
1432 { 0x1c, 0x411111f0 }, /* N/A */
1433 { 0x1d, 0x411111f0 }, /* N/A */
1434 /* 0x1e is filled in below */
1435 { 0x1f, 0x411111f0 }, /* N/A */
1436 { }
1437 }
1438 },
1439 [ALC880_FIXUP_3ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001440 .type = HDA_FIXUP_PINS,
1441 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001442 { 0x1e, 0x411111f0 }, /* N/A */
1443 { }
1444 },
1445 .chained = true,
1446 .chain_id = ALC880_FIXUP_3ST_BASE,
1447 },
1448 [ALC880_FIXUP_3ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001449 .type = HDA_FIXUP_PINS,
1450 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001451 { 0x1e, 0x0144111e }, /* SPDIF */
1452 { }
1453 },
1454 .chained = true,
1455 .chain_id = ALC880_FIXUP_3ST_BASE,
1456 },
1457 [ALC880_FIXUP_5ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001458 .type = HDA_FIXUP_PINS,
1459 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001460 { 0x14, 0x01014010 }, /* front */
1461 { 0x15, 0x411111f0 }, /* N/A */
1462 { 0x16, 0x01011411 }, /* CLFE */
1463 { 0x17, 0x01016412 }, /* surr */
1464 { 0x18, 0x01a19c30 }, /* mic-in */
1465 { 0x19, 0x0121411f }, /* HP */
1466 { 0x1a, 0x01813031 }, /* line-in */
1467 { 0x1b, 0x02a19c40 }, /* front-mic */
1468 { 0x1c, 0x411111f0 }, /* N/A */
1469 { 0x1d, 0x411111f0 }, /* N/A */
1470 /* 0x1e is filled in below */
1471 { 0x1f, 0x411111f0 }, /* N/A */
1472 { }
1473 }
1474 },
1475 [ALC880_FIXUP_5ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001476 .type = HDA_FIXUP_PINS,
1477 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001478 { 0x1e, 0x411111f0 }, /* N/A */
1479 { }
1480 },
1481 .chained = true,
1482 .chain_id = ALC880_FIXUP_5ST_BASE,
1483 },
1484 [ALC880_FIXUP_5ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001485 .type = HDA_FIXUP_PINS,
1486 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001487 { 0x1e, 0x0144111e }, /* SPDIF */
1488 { }
1489 },
1490 .chained = true,
1491 .chain_id = ALC880_FIXUP_5ST_BASE,
1492 },
1493 [ALC880_FIXUP_6ST_BASE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001494 .type = HDA_FIXUP_PINS,
1495 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001496 { 0x14, 0x01014010 }, /* front */
1497 { 0x15, 0x01016412 }, /* surr */
1498 { 0x16, 0x01011411 }, /* CLFE */
1499 { 0x17, 0x01012414 }, /* side */
1500 { 0x18, 0x01a19c30 }, /* mic-in */
1501 { 0x19, 0x02a19c40 }, /* front-mic */
1502 { 0x1a, 0x01813031 }, /* line-in */
1503 { 0x1b, 0x0121411f }, /* HP */
1504 { 0x1c, 0x411111f0 }, /* N/A */
1505 { 0x1d, 0x411111f0 }, /* N/A */
1506 /* 0x1e is filled in below */
1507 { 0x1f, 0x411111f0 }, /* N/A */
1508 { }
1509 }
1510 },
1511 [ALC880_FIXUP_6ST] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001512 .type = HDA_FIXUP_PINS,
1513 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001514 { 0x1e, 0x411111f0 }, /* N/A */
1515 { }
1516 },
1517 .chained = true,
1518 .chain_id = ALC880_FIXUP_6ST_BASE,
1519 },
1520 [ALC880_FIXUP_6ST_DIG] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001521 .type = HDA_FIXUP_PINS,
1522 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001523 { 0x1e, 0x0144111e }, /* SPDIF */
1524 { }
1525 },
1526 .chained = true,
1527 .chain_id = ALC880_FIXUP_6ST_BASE,
1528 },
Takashi Iwai53971452013-01-23 18:21:37 +01001529 [ALC880_FIXUP_6ST_AUTOMUTE] = {
1530 .type = HDA_FIXUP_PINS,
1531 .v.pins = (const struct hda_pintbl[]) {
1532 { 0x1b, 0x0121401f }, /* HP with jack detect */
1533 { }
1534 },
1535 .chained_before = true,
1536 .chain_id = ALC880_FIXUP_6ST_BASE,
1537 },
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001538};
1539
1540static const struct snd_pci_quirk alc880_fixup_tbl[] = {
Takashi Iwaif02aab52012-02-17 16:33:56 +01001541 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_FIXUP_W810),
Takashi Iwai487a5882013-11-07 07:29:30 +01001542 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS W5A", ALC880_FIXUP_ASUS_W5A),
Takashi Iwai96e225f2012-02-20 17:41:51 +01001543 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_FIXUP_Z71V),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001544 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_FIXUP_GPIO1),
David Henningsson6538de02014-06-10 10:52:50 +02001545 SND_PCI_QUIRK(0x147b, 0x1045, "ABit AA8XE", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwai29e3fdc2012-02-20 17:56:57 +01001546 SND_PCI_QUIRK(0x1558, 0x5401, "Clevo GPIO2", ALC880_FIXUP_GPIO2),
Takashi Iwai27e917f2012-02-17 17:49:54 +01001547 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo", ALC880_FIXUP_EAPD_COEF),
Takashi Iwai967b88c2012-02-20 17:31:02 +01001548 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_FIXUP_UNIWILL_DIG),
Takashi Iwaiba533812012-02-20 16:36:52 +01001549 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwill", ALC880_FIXUP_F1734),
Takashi Iwai817de922012-02-20 17:20:48 +01001550 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_FIXUP_UNIWILL),
Takashi Iwai7833c7e2012-02-20 17:11:38 +01001551 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
Takashi Iwaif02aab52012-02-17 16:33:56 +01001552 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001553 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
Takashi Iwai53971452013-01-23 18:21:37 +01001554 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST_AUTOMUTE),
Takashi Iwaia1615742015-08-13 18:05:06 +02001555 SND_PCI_QUIRK(0x1734, 0x107c, "FSC Amilo M1437", ALC880_FIXUP_FUJITSU),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001556 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
Takashi Iwaiba533812012-02-20 16:36:52 +01001557 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
Takashi Iwaicf5a2272012-02-20 16:31:07 +01001558 SND_PCI_QUIRK(0x1734, 0x10b0, "FSC Amilo Pi1556", ALC880_FIXUP_FUJITSU),
Takashi Iwaidc6af522012-02-17 16:18:59 +01001559 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_FIXUP_LG),
1560 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_FIXUP_LG),
1561 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_FIXUP_LG),
Takashi Iwaidb8a38e2013-08-09 12:34:42 +02001562 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_FIXUP_LG_LW25),
Takashi Iwaib9368f52012-02-17 17:54:44 +01001563 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_FIXUP_TCL_S700),
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001564
1565 /* Below is the copied entries from alc880_quirks.c.
1566 * It's not quite sure whether BIOS sets the correct pin-config table
1567 * on these machines, thus they are kept to be compatible with
1568 * the old static quirks. Once when it's confirmed to work without
1569 * these overrides, it'd be better to remove.
1570 */
1571 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_FIXUP_5ST_DIG),
1572 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_FIXUP_6ST),
1573 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_FIXUP_3ST_DIG),
1574 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_FIXUP_6ST_DIG),
1575 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_FIXUP_6ST_DIG),
1576 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_FIXUP_6ST_DIG),
1577 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_FIXUP_3ST_DIG),
1578 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_FIXUP_3ST),
1579 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_FIXUP_6ST_DIG),
1580 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_FIXUP_3ST),
1581 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_FIXUP_3ST),
1582 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_FIXUP_5ST),
1583 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_FIXUP_5ST),
1584 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_FIXUP_5ST),
1585 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_FIXUP_6ST_DIG),
1586 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_FIXUP_6ST_DIG),
1587 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_FIXUP_6ST_DIG),
1588 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_FIXUP_6ST_DIG),
1589 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_FIXUP_5ST_DIG),
1590 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_FIXUP_5ST_DIG),
1591 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1592 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_FIXUP_6ST_DIG), /* broken BIOS */
1593 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_FIXUP_6ST_DIG),
1594 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1595 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1596 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1597 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1598 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1599 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1600 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_FIXUP_3ST_DIG),
1601 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1602 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1603 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_FIXUP_5ST_DIG),
1604 /* default Intel */
1605 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_FIXUP_3ST),
1606 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1607 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_FIXUP_6ST_DIG),
1608 {}
1609};
1610
Takashi Iwai1727a772013-01-10 09:52:52 +01001611static const struct hda_model_fixup alc880_fixup_models[] = {
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001612 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1613 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1614 {.id = ALC880_FIXUP_5ST, .name = "5stack"},
1615 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1616 {.id = ALC880_FIXUP_6ST, .name = "6stack"},
1617 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
Takashi Iwai53971452013-01-23 18:21:37 +01001618 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
Takashi Iwaiee3b2962011-11-15 14:26:54 +01001619 {}
1620};
1621
1622
1623/*
Takashi Iwai1d045db2011-07-07 18:23:21 +02001624 * OK, here we have finally the patch for ALC880
1625 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001626static int patch_alc880(struct hda_codec *codec)
1627{
1628 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001629 int err;
1630
Takashi Iwai3de95172012-05-07 18:03:15 +02001631 err = alc_alloc_spec(codec, 0x0b);
1632 if (err < 0)
1633 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001634
Takashi Iwai3de95172012-05-07 18:03:15 +02001635 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01001636 spec->gen.need_dac_fix = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001637 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001638
Takashi Iwai225068a2015-05-29 10:42:14 +02001639 codec->patch_ops.unsol_event = alc880_unsol_event;
1640
Takashi Iwaic9af7532019-05-10 11:01:43 +02001641 alc_pre_init(codec);
1642
Takashi Iwai1727a772013-01-10 09:52:52 +01001643 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001644 alc880_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001646
Takashi Iwai67b6ec32012-02-20 18:20:42 +01001647 /* automatic parse from the BIOS config */
1648 err = alc880_parse_auto_config(codec);
1649 if (err < 0)
1650 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001651
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001652 if (!spec->gen.no_analog) {
1653 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
1654 if (err < 0)
1655 goto error;
1656 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001657
Takashi Iwai1727a772013-01-10 09:52:52 +01001658 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001659
Takashi Iwai1d045db2011-07-07 18:23:21 +02001660 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001661
1662 error:
1663 alc_free(codec);
1664 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001665}
1666
1667
1668/*
1669 * ALC260 support
1670 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001671static int alc260_parse_auto_config(struct hda_codec *codec)
1672{
Takashi Iwai1d045db2011-07-07 18:23:21 +02001673 static const hda_nid_t alc260_ignore[] = { 0x17, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02001674 static const hda_nid_t alc260_ssids[] = { 0x10, 0x15, 0x0f, 0 };
1675 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001676}
1677
Takashi Iwai1d045db2011-07-07 18:23:21 +02001678/*
1679 * Pin config fixes
1680 */
1681enum {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001682 ALC260_FIXUP_HP_DC5750,
1683 ALC260_FIXUP_HP_PIN_0F,
1684 ALC260_FIXUP_COEF,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001685 ALC260_FIXUP_GPIO1,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001686 ALC260_FIXUP_GPIO1_TOGGLE,
1687 ALC260_FIXUP_REPLACER,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001688 ALC260_FIXUP_HP_B1900,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001689 ALC260_FIXUP_KN1,
Takashi Iwai39aedee2013-01-10 17:10:40 +01001690 ALC260_FIXUP_FSC_S7020,
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001691 ALC260_FIXUP_FSC_S7020_JWSE,
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001692 ALC260_FIXUP_VAIO_PINS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001693};
1694
Takashi Iwai20f7d922012-02-16 12:35:16 +01001695static void alc260_gpio1_automute(struct hda_codec *codec)
1696{
1697 struct alc_spec *spec = codec->spec;
Takashi Iwaiaaf312d2018-06-19 22:28:22 +02001698
1699 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001700}
1701
1702static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001703 const struct hda_fixup *fix, int action)
Takashi Iwai20f7d922012-02-16 12:35:16 +01001704{
1705 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001706 if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwai20f7d922012-02-16 12:35:16 +01001707 /* although the machine has only one output pin, we need to
1708 * toggle GPIO1 according to the jack state
1709 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01001710 spec->gen.automute_hook = alc260_gpio1_automute;
1711 spec->gen.detect_hp = 1;
1712 spec->gen.automute_speaker = 1;
1713 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */
Takashi Iwai62f949b2014-09-11 14:06:53 +02001714 snd_hda_jack_detect_enable_callback(codec, 0x0f,
Takashi Iwai08c189f2012-12-19 15:22:24 +01001715 snd_hda_gen_hp_automute);
Takashi Iwai5579cd62018-06-19 22:22:41 +02001716 alc_setup_gpio(codec, 0x01);
Takashi Iwai20f7d922012-02-16 12:35:16 +01001717 }
1718}
1719
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001720static void alc260_fixup_kn1(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001721 const struct hda_fixup *fix, int action)
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001722{
1723 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01001724 static const struct hda_pintbl pincfgs[] = {
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001725 { 0x0f, 0x02214000 }, /* HP/speaker */
1726 { 0x12, 0x90a60160 }, /* int mic */
1727 { 0x13, 0x02a19000 }, /* ext mic */
1728 { 0x18, 0x01446000 }, /* SPDIF out */
1729 /* disable bogus I/O pins */
1730 { 0x10, 0x411111f0 },
1731 { 0x11, 0x411111f0 },
1732 { 0x14, 0x411111f0 },
1733 { 0x15, 0x411111f0 },
1734 { 0x16, 0x411111f0 },
1735 { 0x17, 0x411111f0 },
1736 { 0x19, 0x411111f0 },
1737 { }
1738 };
1739
1740 switch (action) {
Takashi Iwai1727a772013-01-10 09:52:52 +01001741 case HDA_FIXUP_ACT_PRE_PROBE:
1742 snd_hda_apply_pincfgs(codec, pincfgs);
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001743 spec->init_amp = ALC_INIT_NONE;
1744 break;
1745 }
1746}
1747
Takashi Iwai39aedee2013-01-10 17:10:40 +01001748static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1749 const struct hda_fixup *fix, int action)
1750{
1751 struct alc_spec *spec = codec->spec;
Takashi Iwai1c76aa52018-06-21 16:37:54 +02001752 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001753 spec->init_amp = ALC_INIT_NONE;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001754}
1755
1756static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1757 const struct hda_fixup *fix, int action)
1758{
1759 struct alc_spec *spec = codec->spec;
1760 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaif811c3c2013-03-07 18:32:59 +01001761 spec->gen.add_jack_modes = 1;
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001762 spec->gen.hp_mic = 1;
Takashi Iwaie6e0ee52013-02-18 17:04:20 +01001763 }
Takashi Iwai39aedee2013-01-10 17:10:40 +01001764}
1765
Takashi Iwai1727a772013-01-10 09:52:52 +01001766static const struct hda_fixup alc260_fixups[] = {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001767 [ALC260_FIXUP_HP_DC5750] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001768 .type = HDA_FIXUP_PINS,
1769 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02001770 { 0x11, 0x90130110 }, /* speaker */
1771 { }
1772 }
1773 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001774 [ALC260_FIXUP_HP_PIN_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001775 .type = HDA_FIXUP_PINS,
1776 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaica8f0422012-02-16 11:51:19 +01001777 { 0x0f, 0x01214000 }, /* HP */
1778 { }
1779 }
1780 },
1781 [ALC260_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001782 .type = HDA_FIXUP_VERBS,
Takashi Iwaica8f0422012-02-16 11:51:19 +01001783 .v.verbs = (const struct hda_verb[]) {
Ronan Marquete30cf2d2014-06-01 18:38:53 +02001784 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1785 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3040 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001786 { }
1787 },
Takashi Iwaica8f0422012-02-16 11:51:19 +01001788 },
Takashi Iwai15317ab2012-02-16 12:02:53 +01001789 [ALC260_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02001790 .type = HDA_FIXUP_FUNC,
1791 .v.func = alc_fixup_gpio1,
Takashi Iwai15317ab2012-02-16 12:02:53 +01001792 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001793 [ALC260_FIXUP_GPIO1_TOGGLE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001794 .type = HDA_FIXUP_FUNC,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001795 .v.func = alc260_fixup_gpio1_toggle,
1796 .chained = true,
1797 .chain_id = ALC260_FIXUP_HP_PIN_0F,
1798 },
1799 [ALC260_FIXUP_REPLACER] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001800 .type = HDA_FIXUP_VERBS,
Takashi Iwai20f7d922012-02-16 12:35:16 +01001801 .v.verbs = (const struct hda_verb[]) {
Takashi Iwai192a98e2014-06-02 15:16:07 +02001802 { 0x1a, AC_VERB_SET_COEF_INDEX, 0x07 },
1803 { 0x1a, AC_VERB_SET_PROC_COEF, 0x3050 },
Takashi Iwai20f7d922012-02-16 12:35:16 +01001804 { }
1805 },
1806 .chained = true,
1807 .chain_id = ALC260_FIXUP_GPIO1_TOGGLE,
1808 },
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001809 [ALC260_FIXUP_HP_B1900] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001810 .type = HDA_FIXUP_FUNC,
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001811 .v.func = alc260_fixup_gpio1_toggle,
1812 .chained = true,
1813 .chain_id = ALC260_FIXUP_COEF,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001814 },
1815 [ALC260_FIXUP_KN1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01001816 .type = HDA_FIXUP_FUNC,
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001817 .v.func = alc260_fixup_kn1,
1818 },
Takashi Iwai39aedee2013-01-10 17:10:40 +01001819 [ALC260_FIXUP_FSC_S7020] = {
1820 .type = HDA_FIXUP_FUNC,
1821 .v.func = alc260_fixup_fsc_s7020,
1822 },
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001823 [ALC260_FIXUP_FSC_S7020_JWSE] = {
1824 .type = HDA_FIXUP_FUNC,
1825 .v.func = alc260_fixup_fsc_s7020_jwse,
1826 .chained = true,
1827 .chain_id = ALC260_FIXUP_FSC_S7020,
1828 },
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001829 [ALC260_FIXUP_VAIO_PINS] = {
1830 .type = HDA_FIXUP_PINS,
1831 .v.pins = (const struct hda_pintbl[]) {
1832 /* Pin configs are missing completely on some VAIOs */
1833 { 0x0f, 0x01211020 },
1834 { 0x10, 0x0001003f },
1835 { 0x11, 0x411111f0 },
1836 { 0x12, 0x01a15930 },
1837 { 0x13, 0x411111f0 },
1838 { 0x14, 0x411111f0 },
1839 { 0x15, 0x411111f0 },
1840 { 0x16, 0x411111f0 },
1841 { 0x17, 0x411111f0 },
1842 { 0x18, 0x411111f0 },
1843 { 0x19, 0x411111f0 },
1844 { }
1845 }
1846 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02001847};
1848
1849static const struct snd_pci_quirk alc260_fixup_tbl[] = {
Takashi Iwai15317ab2012-02-16 12:02:53 +01001850 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001851 SND_PCI_QUIRK(0x1025, 0x007f, "Acer Aspire 9500", ALC260_FIXUP_COEF),
Takashi Iwai15317ab2012-02-16 12:02:53 +01001852 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_FIXUP_GPIO1),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001853 SND_PCI_QUIRK(0x103c, 0x280a, "HP dc5750", ALC260_FIXUP_HP_DC5750),
Takashi Iwai0a1c4fa2012-02-16 12:42:30 +01001854 SND_PCI_QUIRK(0x103c, 0x30ba, "HP Presario B1900", ALC260_FIXUP_HP_B1900),
Takashi Iwaid08c5ef2013-11-22 08:06:36 +01001855 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_FIXUP_VAIO_PINS),
Takashi Iwai0f5a5b82013-11-21 09:12:52 +01001856 SND_PCI_QUIRK(0x104d, 0x81e2, "Sony VAIO TX", ALC260_FIXUP_HP_PIN_0F),
Takashi Iwai39aedee2013-01-10 17:10:40 +01001857 SND_PCI_QUIRK(0x10cf, 0x1326, "FSC LifeBook S7020", ALC260_FIXUP_FSC_S7020),
Takashi Iwaib1f58082012-02-16 12:45:03 +01001858 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FIXUP_GPIO1),
Takashi Iwai118cb4a2012-04-19 07:33:27 +02001859 SND_PCI_QUIRK(0x152d, 0x0729, "Quanta KN1", ALC260_FIXUP_KN1),
Takashi Iwai20f7d922012-02-16 12:35:16 +01001860 SND_PCI_QUIRK(0x161f, 0x2057, "Replacer 672V", ALC260_FIXUP_REPLACER),
Takashi Iwaica8f0422012-02-16 11:51:19 +01001861 SND_PCI_QUIRK(0x1631, 0xc017, "PB V7900", ALC260_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02001862 {}
1863};
1864
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001865static const struct hda_model_fixup alc260_fixup_models[] = {
1866 {.id = ALC260_FIXUP_GPIO1, .name = "gpio1"},
1867 {.id = ALC260_FIXUP_COEF, .name = "coef"},
1868 {.id = ALC260_FIXUP_FSC_S7020, .name = "fujitsu"},
1869 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1870 {}
1871};
1872
Takashi Iwai1d045db2011-07-07 18:23:21 +02001873/*
1874 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001875static int patch_alc260(struct hda_codec *codec)
1876{
1877 struct alc_spec *spec;
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001878 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001879
Takashi Iwai3de95172012-05-07 18:03:15 +02001880 err = alc_alloc_spec(codec, 0x07);
1881 if (err < 0)
1882 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001883
Takashi Iwai3de95172012-05-07 18:03:15 +02001884 spec = codec->spec;
Takashi Iwaiea46c3c2013-01-15 18:45:53 +01001885 /* as quite a few machines require HP amp for speaker outputs,
1886 * it's easier to enable it unconditionally; even if it's unneeded,
1887 * it's almost harmless.
1888 */
1889 spec->gen.prefer_hp_amp = 1;
Takashi Iwai7504b6c2013-03-18 11:25:51 +01001890 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001891
Takashi Iwai225068a2015-05-29 10:42:14 +02001892 spec->shutup = alc_eapd_shutup;
1893
Takashi Iwaic9af7532019-05-10 11:01:43 +02001894 alc_pre_init(codec);
1895
Takashi Iwai5ebd3bb2013-02-19 18:23:31 +01001896 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1897 alc260_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01001898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02001899
Takashi Iwaic3c2c9e2012-02-16 12:59:55 +01001900 /* automatic parse from the BIOS config */
1901 err = alc260_parse_auto_config(codec);
1902 if (err < 0)
1903 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001904
Takashi Iwaifea80fa2018-06-20 12:52:46 +02001905 if (!spec->gen.no_analog) {
1906 err = set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
1907 if (err < 0)
1908 goto error;
1909 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02001910
Takashi Iwai1727a772013-01-10 09:52:52 +01001911 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01001912
Takashi Iwai1d045db2011-07-07 18:23:21 +02001913 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02001914
1915 error:
1916 alc_free(codec);
1917 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02001918}
1919
1920
1921/*
1922 * ALC882/883/885/888/889 support
1923 *
1924 * ALC882 is almost identical with ALC880 but has cleaner and more flexible
1925 * configuration. Each pin widget can choose any input DACs and a mixer.
1926 * Each ADC is connected from a mixer of all inputs. This makes possible
1927 * 6-channel independent captures.
1928 *
1929 * In addition, an independent DAC for the multi-playback (not used in this
1930 * driver yet).
1931 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02001932
1933/*
1934 * Pin config fixes
1935 */
1936enum {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001937 ALC882_FIXUP_ABIT_AW9D_MAX,
1938 ALC882_FIXUP_LENOVO_Y530,
1939 ALC882_FIXUP_PB_M5210,
1940 ALC882_FIXUP_ACER_ASPIRE_7736,
1941 ALC882_FIXUP_ASUS_W90V,
Marton Balint8f239212012-03-05 21:33:23 +01001942 ALC889_FIXUP_CD,
David Henningssonb2c53e22014-01-01 14:01:34 +01001943 ALC889_FIXUP_FRONT_HP_NO_PRESENCE,
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01001944 ALC889_FIXUP_VAIO_TT,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01001945 ALC888_FIXUP_EEE1601,
PeiSen Hou4841b8e2021-02-02 10:30:22 +01001946 ALC886_FIXUP_EAPD,
Takashi Iwai177943a32011-11-09 12:55:18 +01001947 ALC882_FIXUP_EAPD,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01001948 ALC883_FIXUP_EAPD,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01001949 ALC883_FIXUP_ACER_EAPD,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001950 ALC882_FIXUP_GPIO1,
1951 ALC882_FIXUP_GPIO2,
Takashi Iwaieb844d52011-11-09 18:03:07 +01001952 ALC882_FIXUP_GPIO3,
Takashi Iwai68ef0562011-11-09 18:24:44 +01001953 ALC889_FIXUP_COEF,
1954 ALC882_FIXUP_ASUS_W2JC,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01001955 ALC882_FIXUP_ACER_ASPIRE_4930G,
1956 ALC882_FIXUP_ACER_ASPIRE_8930G,
1957 ALC882_FIXUP_ASPIRE_8930G_VERBS,
Takashi Iwai56710872011-11-14 17:42:11 +01001958 ALC885_FIXUP_MACPRO_GPIO,
Takashi Iwai02a237b2012-02-13 15:25:07 +01001959 ALC889_FIXUP_DAC_ROUTE,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01001960 ALC889_FIXUP_MBP_VREF,
1961 ALC889_FIXUP_IMAC91_VREF,
Adrien Vergée7729a42014-01-24 14:56:14 -05001962 ALC889_FIXUP_MBA11_VREF,
Takashi Iwai0756f092013-12-04 13:59:45 +01001963 ALC889_FIXUP_MBA21_VREF,
Takashi Iwaic20f31e2014-02-03 11:02:10 +01001964 ALC889_FIXUP_MP11_VREF,
Mario Kleiner9f660a12015-12-22 00:45:43 +01001965 ALC889_FIXUP_MP41_VREF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02001966 ALC882_FIXUP_INV_DMIC,
Takashi Iwaie427c232012-07-29 10:04:08 +02001967 ALC882_FIXUP_NO_PRIMARY_HP,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01001968 ALC887_FIXUP_ASUS_BASS,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01001969 ALC887_FIXUP_BASS_CHMAP,
Takashi Iwai7beb3a62017-04-10 18:05:52 +02001970 ALC1220_FIXUP_GB_DUAL_CODECS,
Christian Lachnerc1933002022-01-03 15:05:17 +01001971 ALC1220_FIXUP_GB_X570,
Peisen0202f5c2017-10-26 10:35:36 +08001972 ALC1220_FIXUP_CLEVO_P950,
Richard Sailer80690a22019-04-02 15:52:04 +02001973 ALC1220_FIXUP_CLEVO_PB51ED,
1974 ALC1220_FIXUP_CLEVO_PB51ED_PINS,
Jian-Hong Panca184352020-10-07 13:22:25 +08001975 ALC887_FIXUP_ASUS_AUDIO,
1976 ALC887_FIXUP_ASUS_HMIC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02001977};
1978
Takashi Iwai68ef0562011-11-09 18:24:44 +01001979static void alc889_fixup_coef(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001980 const struct hda_fixup *fix, int action)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001981{
Takashi Iwai1727a772013-01-10 09:52:52 +01001982 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai68ef0562011-11-09 18:24:44 +01001983 return;
Kailang Yang1df88742014-10-29 16:10:13 +08001984 alc_update_coef_idx(codec, 7, 0, 0x2030);
Takashi Iwai68ef0562011-11-09 18:24:44 +01001985}
1986
Takashi Iwai56710872011-11-14 17:42:11 +01001987/* set up GPIO at initialization */
1988static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01001989 const struct hda_fixup *fix, int action)
Takashi Iwai56710872011-11-14 17:42:11 +01001990{
Takashi Iwai215c8502018-06-19 22:34:26 +02001991 struct alc_spec *spec = codec->spec;
1992
1993 spec->gpio_write_delay = true;
1994 alc_fixup_gpio3(codec, fix, action);
Takashi Iwai56710872011-11-14 17:42:11 +01001995}
1996
Takashi Iwai02a237b2012-02-13 15:25:07 +01001997/* Fix the connection of some pins for ALC889:
1998 * At least, Acer Aspire 5935 shows the connections to DAC3/4 don't
1999 * work correctly (bko#42740)
2000 */
2001static void alc889_fixup_dac_route(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002002 const struct hda_fixup *fix, int action)
Takashi Iwai02a237b2012-02-13 15:25:07 +01002003{
Takashi Iwai1727a772013-01-10 09:52:52 +01002004 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01002005 /* fake the connections during parsing the tree */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002006 static const hda_nid_t conn1[] = { 0x0c, 0x0d };
2007 static const hda_nid_t conn2[] = { 0x0e, 0x0f };
2008 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2009 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2010 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2011 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
Takashi Iwai1727a772013-01-10 09:52:52 +01002012 } else if (action == HDA_FIXUP_ACT_PROBE) {
Takashi Iwaief8d60f2012-02-17 10:12:38 +01002013 /* restore the connections */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002014 static const hda_nid_t conn[] = { 0x0c, 0x0d, 0x0e, 0x0f, 0x26 };
2015 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2016 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2017 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2018 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
Takashi Iwai02a237b2012-02-13 15:25:07 +01002019 }
2020}
2021
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002022/* Set VREF on HP pin */
2023static void alc889_fixup_mbp_vref(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002024 const struct hda_fixup *fix, int action)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002025{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002026 static const hda_nid_t nids[] = { 0x14, 0x15, 0x19 };
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002027 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002028 int i;
2029
Takashi Iwai1727a772013-01-10 09:52:52 +01002030 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002031 return;
2032 for (i = 0; i < ARRAY_SIZE(nids); i++) {
2033 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2034 if (get_defcfg_device(val) != AC_JACK_HP_OUT)
2035 continue;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002036 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002037 val |= AC_PINCTL_VREF_80;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002038 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai08c189f2012-12-19 15:22:24 +01002039 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002040 break;
2041 }
2042}
2043
Takashi Iwai0756f092013-12-04 13:59:45 +01002044static void alc889_fixup_mac_pins(struct hda_codec *codec,
2045 const hda_nid_t *nids, int num_nids)
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002046{
2047 struct alc_spec *spec = codec->spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002048 int i;
2049
Takashi Iwai0756f092013-12-04 13:59:45 +01002050 for (i = 0; i < num_nids; i++) {
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002051 unsigned int val;
Takashi Iwaid3f02d62013-01-10 10:12:22 +01002052 val = snd_hda_codec_get_pin_target(codec, nids[i]);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002053 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +02002054 snd_hda_set_pin_ctl(codec, nids[i], val);
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002055 }
Takashi Iwai08c189f2012-12-19 15:22:24 +01002056 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002057}
2058
Takashi Iwai0756f092013-12-04 13:59:45 +01002059/* Set VREF on speaker pins on imac91 */
2060static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2061 const struct hda_fixup *fix, int action)
2062{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002063 static const hda_nid_t nids[] = { 0x18, 0x1a };
Takashi Iwai0756f092013-12-04 13:59:45 +01002064
2065 if (action == HDA_FIXUP_ACT_INIT)
2066 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2067}
2068
Adrien Vergée7729a42014-01-24 14:56:14 -05002069/* Set VREF on speaker pins on mba11 */
2070static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2071 const struct hda_fixup *fix, int action)
2072{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002073 static const hda_nid_t nids[] = { 0x18 };
Adrien Vergée7729a42014-01-24 14:56:14 -05002074
2075 if (action == HDA_FIXUP_ACT_INIT)
2076 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2077}
2078
Takashi Iwai0756f092013-12-04 13:59:45 +01002079/* Set VREF on speaker pins on mba21 */
2080static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2081 const struct hda_fixup *fix, int action)
2082{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002083 static const hda_nid_t nids[] = { 0x18, 0x19 };
Takashi Iwai0756f092013-12-04 13:59:45 +01002084
2085 if (action == HDA_FIXUP_ACT_INIT)
2086 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2087}
2088
Takashi Iwaie427c232012-07-29 10:04:08 +02002089/* Don't take HP output as primary
Fernando Luis Vázquez Caod9111492013-02-12 16:49:46 +09002090 * Strangely, the speaker output doesn't work on Vaio Z and some Vaio
2091 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
Takashi Iwaie427c232012-07-29 10:04:08 +02002092 */
2093static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01002094 const struct hda_fixup *fix, int action)
Takashi Iwaie427c232012-07-29 10:04:08 +02002095{
2096 struct alc_spec *spec = codec->spec;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002097 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai08c189f2012-12-19 15:22:24 +01002098 spec->gen.no_primary_hp = 1;
Takashi Iwaida96fb52013-07-29 16:54:36 +02002099 spec->gen.no_multi_io = 1;
2100 }
Takashi Iwaie427c232012-07-29 10:04:08 +02002101}
2102
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002103static void alc_fixup_bass_chmap(struct hda_codec *codec,
2104 const struct hda_fixup *fix, int action);
2105
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002106/* For dual-codec configuration, we need to disable some features to avoid
2107 * conflicts of kctls and PCM streams
2108 */
2109static void alc_fixup_dual_codecs(struct hda_codec *codec,
2110 const struct hda_fixup *fix, int action)
2111{
2112 struct alc_spec *spec = codec->spec;
2113
2114 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2115 return;
2116 /* disable vmaster */
2117 spec->gen.suppress_vmaster = 1;
2118 /* auto-mute and auto-mic switch don't work with multiple codecs */
2119 spec->gen.suppress_auto_mute = 1;
2120 spec->gen.suppress_auto_mic = 1;
2121 /* disable aamix as well */
2122 spec->gen.mixer_nid = 0;
2123 /* add location prefix to avoid conflicts */
2124 codec->force_pin_prefix = 1;
2125}
2126
2127static void rename_ctl(struct hda_codec *codec, const char *oldname,
2128 const char *newname)
2129{
2130 struct snd_kcontrol *kctl;
2131
2132 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2133 if (kctl)
2134 strcpy(kctl->id.name, newname);
2135}
2136
2137static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2138 const struct hda_fixup *fix,
2139 int action)
2140{
2141 alc_fixup_dual_codecs(codec, fix, action);
2142 switch (action) {
2143 case HDA_FIXUP_ACT_PRE_PROBE:
2144 /* override card longname to provide a unique UCM profile */
2145 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2146 break;
2147 case HDA_FIXUP_ACT_BUILD:
2148 /* rename Capture controls depending on the codec */
2149 rename_ctl(codec, "Capture Volume",
2150 codec->addr == 0 ?
2151 "Rear-Panel Capture Volume" :
2152 "Front-Panel Capture Volume");
2153 rename_ctl(codec, "Capture Switch",
2154 codec->addr == 0 ?
2155 "Rear-Panel Capture Switch" :
2156 "Front-Panel Capture Switch");
2157 break;
2158 }
2159}
2160
Christian Lachnerc1933002022-01-03 15:05:17 +01002161static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2162 const struct hda_fixup *fix,
2163 int action)
2164{
2165 static const hda_nid_t conn1[] = { 0x0c };
2166 static const struct coef_fw gb_x570_coefs[] = {
Christian Lachner41a86012022-01-29 12:32:42 +01002167 WRITE_COEF(0x07, 0x03c0),
Christian Lachnerc1933002022-01-03 15:05:17 +01002168 WRITE_COEF(0x1a, 0x01c1),
2169 WRITE_COEF(0x1b, 0x0202),
2170 WRITE_COEF(0x43, 0x3005),
2171 {}
2172 };
2173
2174 switch (action) {
2175 case HDA_FIXUP_ACT_PRE_PROBE:
2176 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2177 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2178 break;
2179 case HDA_FIXUP_ACT_INIT:
2180 alc_process_coef_fw(codec, gb_x570_coefs);
2181 break;
2182 }
2183}
2184
Peisen0202f5c2017-10-26 10:35:36 +08002185static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2186 const struct hda_fixup *fix,
2187 int action)
2188{
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002189 static const hda_nid_t conn1[] = { 0x0c };
Peisen0202f5c2017-10-26 10:35:36 +08002190
2191 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2192 return;
2193
2194 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2195 /* We therefore want to make sure 0x14 (front headphone) and
2196 * 0x1b (speakers) use the stereo DAC 0x02
2197 */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01002198 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2199 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
Peisen0202f5c2017-10-26 10:35:36 +08002200}
2201
Jeremy Soller7f665b12019-02-13 10:56:19 -07002202static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2203 const struct hda_fixup *fix, int action);
2204
Richard Sailer80690a22019-04-02 15:52:04 +02002205static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002206 const struct hda_fixup *fix,
2207 int action)
2208{
2209 alc1220_fixup_clevo_p950(codec, fix, action);
2210 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2211}
2212
Jian-Hong Panca184352020-10-07 13:22:25 +08002213static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2214 struct hda_jack_callback *jack)
2215{
2216 struct alc_spec *spec = codec->spec;
2217 unsigned int vref;
2218
2219 snd_hda_gen_hp_automute(codec, jack);
2220
2221 if (spec->gen.hp_jack_present)
2222 vref = AC_PINCTL_VREF_80;
2223 else
2224 vref = AC_PINCTL_VREF_HIZ;
2225 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2226}
2227
2228static void alc887_fixup_asus_jack(struct hda_codec *codec,
2229 const struct hda_fixup *fix, int action)
2230{
2231 struct alc_spec *spec = codec->spec;
2232 if (action != HDA_FIXUP_ACT_PROBE)
2233 return;
2234 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2235 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook;
2236}
2237
Takashi Iwai1727a772013-01-10 09:52:52 +01002238static const struct hda_fixup alc882_fixups[] = {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002239 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002240 .type = HDA_FIXUP_PINS,
2241 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002242 { 0x15, 0x01080104 }, /* side */
2243 { 0x16, 0x01011012 }, /* rear */
2244 { 0x17, 0x01016011 }, /* clfe */
2245 { }
2246 }
2247 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002248 [ALC882_FIXUP_LENOVO_Y530] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002249 .type = HDA_FIXUP_PINS,
2250 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002251 { 0x15, 0x99130112 }, /* rear int speakers */
2252 { 0x16, 0x99130111 }, /* subwoofer */
2253 { }
2254 }
2255 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002256 [ALC882_FIXUP_PB_M5210] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002257 .type = HDA_FIXUP_PINCTLS,
2258 .v.pins = (const struct hda_pintbl[]) {
2259 { 0x19, PIN_VREF50 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002260 {}
2261 }
2262 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002263 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002264 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02002265 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002266 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002267 [ALC882_FIXUP_ASUS_W90V] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002268 .type = HDA_FIXUP_PINS,
2269 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5cdf7452011-10-26 23:04:08 +02002270 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
2271 { }
2272 }
2273 },
Marton Balint8f239212012-03-05 21:33:23 +01002274 [ALC889_FIXUP_CD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002275 .type = HDA_FIXUP_PINS,
2276 .v.pins = (const struct hda_pintbl[]) {
Marton Balint8f239212012-03-05 21:33:23 +01002277 { 0x1c, 0x993301f0 }, /* CD */
2278 { }
2279 }
2280 },
David Henningssonb2c53e22014-01-01 14:01:34 +01002281 [ALC889_FIXUP_FRONT_HP_NO_PRESENCE] = {
2282 .type = HDA_FIXUP_PINS,
2283 .v.pins = (const struct hda_pintbl[]) {
2284 { 0x1b, 0x02214120 }, /* Front HP jack is flaky, disable jack detect */
2285 { }
2286 },
2287 .chained = true,
2288 .chain_id = ALC889_FIXUP_CD,
2289 },
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002290 [ALC889_FIXUP_VAIO_TT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002291 .type = HDA_FIXUP_PINS,
2292 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002293 { 0x17, 0x90170111 }, /* hidden surround speaker */
2294 { }
2295 }
2296 },
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002297 [ALC888_FIXUP_EEE1601] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002298 .type = HDA_FIXUP_VERBS,
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002299 .v.verbs = (const struct hda_verb[]) {
2300 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2301 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
2302 { }
2303 }
Takashi Iwai177943a32011-11-09 12:55:18 +01002304 },
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002305 [ALC886_FIXUP_EAPD] = {
2306 .type = HDA_FIXUP_VERBS,
2307 .v.verbs = (const struct hda_verb[]) {
2308 /* change to EAPD mode */
2309 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2310 { 0x20, AC_VERB_SET_PROC_COEF, 0x0068 },
2311 { }
2312 }
2313 },
Takashi Iwai177943a32011-11-09 12:55:18 +01002314 [ALC882_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002315 .type = HDA_FIXUP_VERBS,
Takashi Iwai177943a32011-11-09 12:55:18 +01002316 .v.verbs = (const struct hda_verb[]) {
2317 /* change to EAPD mode */
2318 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2319 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
2320 { }
2321 }
2322 },
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002323 [ALC883_FIXUP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002324 .type = HDA_FIXUP_VERBS,
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002325 .v.verbs = (const struct hda_verb[]) {
2326 /* change to EAPD mode */
2327 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2328 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2329 { }
2330 }
2331 },
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002332 [ALC883_FIXUP_ACER_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002333 .type = HDA_FIXUP_VERBS,
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002334 .v.verbs = (const struct hda_verb[]) {
2335 /* eanable EAPD on Acer laptops */
2336 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2337 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2338 { }
2339 }
2340 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002341 [ALC882_FIXUP_GPIO1] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002342 .type = HDA_FIXUP_FUNC,
2343 .v.func = alc_fixup_gpio1,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002344 },
2345 [ALC882_FIXUP_GPIO2] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002346 .type = HDA_FIXUP_FUNC,
2347 .v.func = alc_fixup_gpio2,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002348 },
Takashi Iwaieb844d52011-11-09 18:03:07 +01002349 [ALC882_FIXUP_GPIO3] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002350 .type = HDA_FIXUP_FUNC,
2351 .v.func = alc_fixup_gpio3,
Takashi Iwaieb844d52011-11-09 18:03:07 +01002352 },
Takashi Iwai68ef0562011-11-09 18:24:44 +01002353 [ALC882_FIXUP_ASUS_W2JC] = {
Takashi Iwai5579cd62018-06-19 22:22:41 +02002354 .type = HDA_FIXUP_FUNC,
2355 .v.func = alc_fixup_gpio1,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002356 .chained = true,
2357 .chain_id = ALC882_FIXUP_EAPD,
2358 },
2359 [ALC889_FIXUP_COEF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002360 .type = HDA_FIXUP_FUNC,
Takashi Iwai68ef0562011-11-09 18:24:44 +01002361 .v.func = alc889_fixup_coef,
2362 },
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002363 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002364 .type = HDA_FIXUP_PINS,
2365 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002366 { 0x16, 0x99130111 }, /* CLFE speaker */
2367 { 0x17, 0x99130112 }, /* surround speaker */
2368 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002369 },
2370 .chained = true,
2371 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002372 },
2373 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002374 .type = HDA_FIXUP_PINS,
2375 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002376 { 0x16, 0x99130111 }, /* CLFE speaker */
2377 { 0x1b, 0x99130112 }, /* surround speaker */
2378 { }
2379 },
2380 .chained = true,
2381 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
2382 },
2383 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
2384 /* additional init verbs for Acer Aspire 8930G */
Takashi Iwai1727a772013-01-10 09:52:52 +01002385 .type = HDA_FIXUP_VERBS,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002386 .v.verbs = (const struct hda_verb[]) {
2387 /* Enable all DACs */
2388 /* DAC DISABLE/MUTE 1? */
2389 /* setting bits 1-5 disables DAC nids 0x02-0x06
2390 * apparently. Init=0x38 */
2391 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
2392 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2393 /* DAC DISABLE/MUTE 2? */
2394 /* some bit here disables the other DACs.
2395 * Init=0x4900 */
2396 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
2397 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
2398 /* DMIC fix
2399 * This laptop has a stereo digital microphone.
2400 * The mics are only 1cm apart which makes the stereo
2401 * useless. However, either the mic or the ALC889
2402 * makes the signal become a difference/sum signal
2403 * instead of standard stereo, which is annoying.
2404 * So instead we flip this bit which makes the
2405 * codec replicate the sum signal to both channels,
2406 * turning it into a normal mono mic.
2407 */
2408 /* DMIC_CONTROL? Init value = 0x0001 */
2409 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
2410 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
2411 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2412 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2413 { }
Takashi Iwai038d4fe2012-04-11 17:18:12 +02002414 },
2415 .chained = true,
2416 .chain_id = ALC882_FIXUP_GPIO1,
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002417 },
Takashi Iwai56710872011-11-14 17:42:11 +01002418 [ALC885_FIXUP_MACPRO_GPIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002419 .type = HDA_FIXUP_FUNC,
Takashi Iwai56710872011-11-14 17:42:11 +01002420 .v.func = alc885_fixup_macpro_gpio,
2421 },
Takashi Iwai02a237b2012-02-13 15:25:07 +01002422 [ALC889_FIXUP_DAC_ROUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002423 .type = HDA_FIXUP_FUNC,
Takashi Iwai02a237b2012-02-13 15:25:07 +01002424 .v.func = alc889_fixup_dac_route,
2425 },
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002426 [ALC889_FIXUP_MBP_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002427 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002428 .v.func = alc889_fixup_mbp_vref,
2429 .chained = true,
2430 .chain_id = ALC882_FIXUP_GPIO1,
2431 },
2432 [ALC889_FIXUP_IMAC91_VREF] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002433 .type = HDA_FIXUP_FUNC,
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002434 .v.func = alc889_fixup_imac91_vref,
2435 .chained = true,
2436 .chain_id = ALC882_FIXUP_GPIO1,
2437 },
Adrien Vergée7729a42014-01-24 14:56:14 -05002438 [ALC889_FIXUP_MBA11_VREF] = {
2439 .type = HDA_FIXUP_FUNC,
2440 .v.func = alc889_fixup_mba11_vref,
2441 .chained = true,
2442 .chain_id = ALC889_FIXUP_MBP_VREF,
2443 },
Takashi Iwai0756f092013-12-04 13:59:45 +01002444 [ALC889_FIXUP_MBA21_VREF] = {
2445 .type = HDA_FIXUP_FUNC,
2446 .v.func = alc889_fixup_mba21_vref,
2447 .chained = true,
2448 .chain_id = ALC889_FIXUP_MBP_VREF,
2449 },
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002450 [ALC889_FIXUP_MP11_VREF] = {
2451 .type = HDA_FIXUP_FUNC,
2452 .v.func = alc889_fixup_mba11_vref,
2453 .chained = true,
2454 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2455 },
Mario Kleiner9f660a12015-12-22 00:45:43 +01002456 [ALC889_FIXUP_MP41_VREF] = {
2457 .type = HDA_FIXUP_FUNC,
2458 .v.func = alc889_fixup_mbp_vref,
2459 .chained = true,
2460 .chain_id = ALC885_FIXUP_MACPRO_GPIO,
2461 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002462 [ALC882_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002463 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002464 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002465 },
Takashi Iwaie427c232012-07-29 10:04:08 +02002466 [ALC882_FIXUP_NO_PRIMARY_HP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002467 .type = HDA_FIXUP_FUNC,
Takashi Iwaie427c232012-07-29 10:04:08 +02002468 .v.func = alc882_fixup_no_primary_hp,
2469 },
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002470 [ALC887_FIXUP_ASUS_BASS] = {
2471 .type = HDA_FIXUP_PINS,
2472 .v.pins = (const struct hda_pintbl[]) {
2473 {0x16, 0x99130130}, /* bass speaker */
2474 {}
2475 },
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +01002476 .chained = true,
2477 .chain_id = ALC887_FIXUP_BASS_CHMAP,
2478 },
2479 [ALC887_FIXUP_BASS_CHMAP] = {
2480 .type = HDA_FIXUP_FUNC,
2481 .v.func = alc_fixup_bass_chmap,
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002482 },
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002483 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2484 .type = HDA_FIXUP_FUNC,
2485 .v.func = alc1220_fixup_gb_dual_codecs,
2486 },
Christian Lachnerc1933002022-01-03 15:05:17 +01002487 [ALC1220_FIXUP_GB_X570] = {
2488 .type = HDA_FIXUP_FUNC,
2489 .v.func = alc1220_fixup_gb_x570,
2490 },
Peisen0202f5c2017-10-26 10:35:36 +08002491 [ALC1220_FIXUP_CLEVO_P950] = {
2492 .type = HDA_FIXUP_FUNC,
2493 .v.func = alc1220_fixup_clevo_p950,
2494 },
Richard Sailer80690a22019-04-02 15:52:04 +02002495 [ALC1220_FIXUP_CLEVO_PB51ED] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002496 .type = HDA_FIXUP_FUNC,
Richard Sailer80690a22019-04-02 15:52:04 +02002497 .v.func = alc1220_fixup_clevo_pb51ed,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002498 },
Richard Sailer80690a22019-04-02 15:52:04 +02002499 [ALC1220_FIXUP_CLEVO_PB51ED_PINS] = {
Jeremy Soller7f665b12019-02-13 10:56:19 -07002500 .type = HDA_FIXUP_PINS,
2501 .v.pins = (const struct hda_pintbl[]) {
2502 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
2503 {}
2504 },
2505 .chained = true,
Richard Sailer80690a22019-04-02 15:52:04 +02002506 .chain_id = ALC1220_FIXUP_CLEVO_PB51ED,
Jeremy Soller7f665b12019-02-13 10:56:19 -07002507 },
Jian-Hong Panca184352020-10-07 13:22:25 +08002508 [ALC887_FIXUP_ASUS_AUDIO] = {
2509 .type = HDA_FIXUP_PINS,
2510 .v.pins = (const struct hda_pintbl[]) {
2511 { 0x15, 0x02a14150 }, /* use as headset mic, without its own jack detect */
2512 { 0x19, 0x22219420 },
2513 {}
2514 },
2515 },
2516 [ALC887_FIXUP_ASUS_HMIC] = {
2517 .type = HDA_FIXUP_FUNC,
2518 .v.func = alc887_fixup_asus_jack,
2519 .chained = true,
2520 .chain_id = ALC887_FIXUP_ASUS_AUDIO,
2521 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002522};
2523
2524static const struct snd_pci_quirk alc882_fixup_tbl[] = {
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002525 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
2526 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaib5d724b2015-06-02 19:57:08 +02002527 SND_PCI_QUIRK(0x1025, 0x0107, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
Takashi Iwai8812c4f2011-11-09 17:39:15 +01002528 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
2529 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
2530 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
2531 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002532 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2533 ALC882_FIXUP_ACER_ASPIRE_4930G),
2534 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2535 ALC882_FIXUP_ACER_ASPIRE_4930G),
2536 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2537 ALC882_FIXUP_ACER_ASPIRE_8930G),
2538 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2539 ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaib2650472021-04-28 13:26:52 +02002540 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2541 ALC882_FIXUP_ACER_ASPIRE_4930G),
2542 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
Takashi Iwaic3e837b2011-11-10 16:01:47 +01002543 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2544 ALC882_FIXUP_ACER_ASPIRE_4930G),
2545 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2546 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwaif5c53d82012-05-07 10:07:33 +02002547 SND_PCI_QUIRK(0x1025, 0x021e, "Acer Aspire 5739G",
2548 ALC882_FIXUP_ACER_ASPIRE_4930G),
Takashi Iwai02a237b2012-02-13 15:25:07 +01002549 SND_PCI_QUIRK(0x1025, 0x0259, "Acer Aspire 5935", ALC889_FIXUP_DAC_ROUTE),
Takashi Iwaife97da12012-04-12 08:00:19 +02002550 SND_PCI_QUIRK(0x1025, 0x026b, "Acer Aspire 8940G", ALC882_FIXUP_ACER_ASPIRE_8930G),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002551 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
Takashi Iwai177943a32011-11-09 12:55:18 +01002552 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002553 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002554 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
Jian-Hong Panca184352020-10-07 13:22:25 +08002555 SND_PCI_QUIRK(0x1043, 0x2390, "Asus D700SA", ALC887_FIXUP_ASUS_HMIC),
Takashi Iwai0e7cc2e2011-11-09 12:42:48 +01002556 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
Takashi Iwai1f0bbf02013-11-28 15:21:21 +01002557 SND_PCI_QUIRK(0x1043, 0x84bc, "ASUS ET2700", ALC887_FIXUP_ASUS_BASS),
Takashi Iwai85bcf962016-12-06 16:20:36 +01002558 SND_PCI_QUIRK(0x1043, 0x8691, "ASUS ROG Ranger VIII", ALC882_FIXUP_GPIO3),
Takashi Iwaib7529c12021-04-28 13:26:53 +02002559 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2560 SND_PCI_QUIRK(0x104d, 0x9044, "Sony VAIO AiO", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002561 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
Takashi Iwaie427c232012-07-29 10:04:08 +02002562 SND_PCI_QUIRK(0x104d, 0x905a, "Sony Vaio Z", ALC882_FIXUP_NO_PRIMARY_HP),
Sergei A. Trusov3f3c3712017-08-02 20:23:48 +10002563 SND_PCI_QUIRK(0x104d, 0x9060, "Sony Vaio VPCL14M1R", ALC882_FIXUP_NO_PRIMARY_HP),
Takashi Iwai56710872011-11-14 17:42:11 +01002564
2565 /* All Apple entries are in codec SSIDs */
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002566 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2567 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
2568 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwaic20f31e2014-02-03 11:02:10 +01002569 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002570 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
2571 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002572 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
2573 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002574 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
Adrien Vergée7729a42014-01-24 14:56:14 -05002575 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai0756f092013-12-04 13:59:45 +01002576 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002577 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2578 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002579 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002580 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2581 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2582 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
Mario Kleiner9f660a12015-12-22 00:45:43 +01002583 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
Takashi Iwai05193632012-11-12 10:07:36 +01002584 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002585 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
2586 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
Takashi Iwai649ccd02015-07-30 22:30:29 +02002587 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_MBA11_VREF),
Takashi Iwai56710872011-11-14 17:42:11 +01002588
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002589 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
PeiSen Hou4841b8e2021-02-02 10:30:22 +01002590 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
David Henningssonb2c53e22014-01-01 14:01:34 +01002591 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
Takashi Iwai7beb3a62017-04-10 18:05:52 +02002592 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Christian Lachnerc1933002022-01-03 15:05:17 +01002593 SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
Christian Lachnerea354192022-01-29 12:32:43 +01002594 SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
Christian Lachner41a86012022-01-29 12:32:42 +01002595 SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
Takashi Iwaia0b03952020-06-16 15:21:50 +02002596 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaia655e2b2020-02-17 16:19:47 +01002597 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai09926202020-12-20 09:09:43 +01002598 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai1d3aa4a2020-04-08 15:56:45 +02002599 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7dafba32020-02-12 09:10:47 +01002600 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaicc5049a2020-02-18 09:09:15 +01002601 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002602 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
Takashi Iwai26af1772021-03-03 15:23:46 +01002603 SND_PCI_QUIRK(0x1462, 0xcc34, "MSI Godlike X570", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwai63691582017-05-22 16:32:46 +02002604 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
Takashi Iwaid2c3b142017-06-01 09:35:30 +02002605 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
Takashi Iwai5c0ebfb2011-11-07 17:59:13 +01002606 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
PeiSen Hou259eb822020-05-19 08:50:12 +02002607 SND_PCI_QUIRK(0x1558, 0x50d3, "Clevo PC50[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002608 SND_PCI_QUIRK(0x1558, 0x65d1, "Clevo PB51[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2609 SND_PCI_QUIRK(0x1558, 0x65d2, "Clevo PB51R[CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2610 SND_PCI_QUIRK(0x1558, 0x65e1, "Clevo PB51[ED][DF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002611 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Steven Clarksonaef454b2021-10-14 06:35:54 -07002612 SND_PCI_QUIRK(0x1558, 0x65f1, "Clevo PC50HS", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Houb5acfe12020-11-11 08:58:59 +01002613 SND_PCI_QUIRK(0x1558, 0x67d1, "Clevo PB71[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2614 SND_PCI_QUIRK(0x1558, 0x67e1, "Clevo PB71[DE][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Eckhart Mohr970e3012021-04-27 17:30:25 +02002615 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Tim Crawforddbfe83502021-11-01 10:21:34 -06002616 SND_PCI_QUIRK(0x1558, 0x67f1, "Clevo PC70H[PRS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
PeiSen Hou259eb822020-05-19 08:50:12 +02002617 SND_PCI_QUIRK(0x1558, 0x70d1, "Clevo PC70[ER][CDF]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembach1f8d3982021-10-01 15:31:10 +02002618 SND_PCI_QUIRK(0x1558, 0x7714, "Clevo X170SM", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
Werner Sembachcc030692021-10-01 15:31:11 +02002619 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
Takashi Iwai13e1a4c2021-04-28 13:26:54 +02002620 SND_PCI_QUIRK(0x1558, 0x9501, "Clevo P950HR", ALC1220_FIXUP_CLEVO_P950),
2621 SND_PCI_QUIRK(0x1558, 0x9506, "Clevo P955HQ", ALC1220_FIXUP_CLEVO_P950),
2622 SND_PCI_QUIRK(0x1558, 0x950a, "Clevo P955H[PR]", ALC1220_FIXUP_CLEVO_P950),
2623 SND_PCI_QUIRK(0x1558, 0x95e1, "Clevo P95xER", ALC1220_FIXUP_CLEVO_P950),
2624 SND_PCI_QUIRK(0x1558, 0x95e2, "Clevo P950ER", ALC1220_FIXUP_CLEVO_P950),
2625 SND_PCI_QUIRK(0x1558, 0x95e3, "Clevo P955[ER]T", ALC1220_FIXUP_CLEVO_P950),
2626 SND_PCI_QUIRK(0x1558, 0x95e4, "Clevo P955ER", ALC1220_FIXUP_CLEVO_P950),
2627 SND_PCI_QUIRK(0x1558, 0x95e5, "Clevo P955EE6", ALC1220_FIXUP_CLEVO_P950),
2628 SND_PCI_QUIRK(0x1558, 0x95e6, "Clevo P950R[CDF]", ALC1220_FIXUP_CLEVO_P950),
2629 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2630 SND_PCI_QUIRK(0x1558, 0x97e1, "Clevo P970[ER][CDFN]", ALC1220_FIXUP_CLEVO_P950),
2631 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
Takashi Iwai7a6069b2011-11-09 15:22:01 +01002632 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2633 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
Takashi Iwaiac9b1cd2011-11-09 17:45:55 +01002634 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
Takashi Iwai68ef0562011-11-09 18:24:44 +01002635 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002636 {}
2637};
2638
Takashi Iwai1727a772013-01-10 09:52:52 +01002639static const struct hda_model_fixup alc882_fixup_models[] = {
Takashi Iwai772c2912018-06-26 17:17:53 +02002640 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2641 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2642 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2643 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2644 {.id = ALC889_FIXUP_CD, .name = "cd"},
2645 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2646 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2647 {.id = ALC888_FIXUP_EEE1601, .name = "eee1601"},
2648 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2649 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2650 {.id = ALC882_FIXUP_GPIO1, .name = "gpio1"},
2651 {.id = ALC882_FIXUP_GPIO2, .name = "gpio2"},
2652 {.id = ALC882_FIXUP_GPIO3, .name = "gpio3"},
2653 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2654 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002655 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2656 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2657 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002658 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2659 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2660 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2661 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2662 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2663 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2664 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2665 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002666 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie427c232012-07-29 10:04:08 +02002667 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002668 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02002669 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
Christian Lachner63394a12022-01-29 12:32:41 +01002670 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
Takashi Iwai772c2912018-06-26 17:17:53 +02002671 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
Takashi Iwai912093b2012-04-11 14:03:41 +02002672 {}
2673};
2674
Hui Wang119b75c2021-05-22 11:47:41 +08002675static const struct snd_hda_pin_quirk alc882_pin_fixup_tbl[] = {
2676 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1043, "ASUS", ALC1220_FIXUP_CLEVO_P950,
2677 {0x14, 0x01014010},
2678 {0x15, 0x01011012},
2679 {0x16, 0x01016011},
2680 {0x18, 0x01a19040},
2681 {0x19, 0x02a19050},
2682 {0x1a, 0x0181304f},
2683 {0x1b, 0x0221401f},
2684 {0x1e, 0x01456130}),
2685 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2686 {0x14, 0x01015010},
2687 {0x15, 0x01011012},
2688 {0x16, 0x01011011},
2689 {0x18, 0x01a11040},
2690 {0x19, 0x02a19050},
2691 {0x1a, 0x0181104f},
2692 {0x1b, 0x0221401f},
2693 {0x1e, 0x01451130}),
2694 {}
2695};
2696
Takashi Iwai1d045db2011-07-07 18:23:21 +02002697/*
2698 * BIOS auto configuration
2699 */
2700/* almost identical with ALC880 parser... */
2701static int alc882_parse_auto_config(struct hda_codec *codec)
2702{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002703 static const hda_nid_t alc882_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002704 static const hda_nid_t alc882_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2705 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002706}
2707
Takashi Iwai1d045db2011-07-07 18:23:21 +02002708/*
2709 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002710static int patch_alc882(struct hda_codec *codec)
2711{
2712 struct alc_spec *spec;
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002713 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002714
Takashi Iwai3de95172012-05-07 18:03:15 +02002715 err = alc_alloc_spec(codec, 0x0b);
2716 if (err < 0)
2717 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002718
Takashi Iwai3de95172012-05-07 18:03:15 +02002719 spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002720
Takashi Iwai7639a062015-03-03 10:07:24 +01002721 switch (codec->core.vendor_id) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002722 case 0x10ec0882:
2723 case 0x10ec0885:
Takashi Iwaiacf08082014-09-02 07:21:56 +02002724 case 0x10ec0900:
Kailang Yang6d9ffcf2020-01-03 16:24:06 +08002725 case 0x10ec0b00:
Kailang Yanga535ad52017-01-16 16:59:26 +08002726 case 0x10ec1220:
Takashi Iwai1d045db2011-07-07 18:23:21 +02002727 break;
2728 default:
2729 /* ALC883 and variants */
2730 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2731 break;
2732 }
2733
Takashi Iwaic9af7532019-05-10 11:01:43 +02002734 alc_pre_init(codec);
2735
Takashi Iwai1727a772013-01-10 09:52:52 +01002736 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
Takashi Iwai912093b2012-04-11 14:03:41 +02002737 alc882_fixups);
Hui Wang119b75c2021-05-22 11:47:41 +08002738 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +01002739 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002740
2741 alc_auto_parse_customize_define(codec);
2742
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002743 if (has_cdefine_beep(codec))
2744 spec->gen.beep_nid = 0x01;
2745
Takashi Iwai1a97b7f2012-02-21 11:11:48 +01002746 /* automatic parse from the BIOS config */
2747 err = alc882_parse_auto_config(codec);
2748 if (err < 0)
2749 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002750
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002751 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2752 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2753 if (err < 0)
2754 goto error;
2755 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002756
Takashi Iwai1727a772013-01-10 09:52:52 +01002757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002758
Takashi Iwai1d045db2011-07-07 18:23:21 +02002759 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002760
2761 error:
2762 alc_free(codec);
2763 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002764}
2765
2766
2767/*
2768 * ALC262 support
2769 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002770static int alc262_parse_auto_config(struct hda_codec *codec)
2771{
Takashi Iwai1d045db2011-07-07 18:23:21 +02002772 static const hda_nid_t alc262_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002773 static const hda_nid_t alc262_ssids[] = { 0x15, 0x1b, 0x14, 0 };
2774 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002775}
2776
2777/*
2778 * Pin config fixes
2779 */
2780enum {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002781 ALC262_FIXUP_FSC_H270,
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002782 ALC262_FIXUP_FSC_S7110,
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002783 ALC262_FIXUP_HP_Z200,
2784 ALC262_FIXUP_TYAN,
Takashi Iwaic4701502011-11-07 14:20:07 +01002785 ALC262_FIXUP_LENOVO_3000,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002786 ALC262_FIXUP_BENQ,
2787 ALC262_FIXUP_BENQ_T31,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002788 ALC262_FIXUP_INV_DMIC,
Mengdong Linb5c66112013-11-29 00:35:35 -05002789 ALC262_FIXUP_INTEL_BAYLEYBAY,
Takashi Iwai1d045db2011-07-07 18:23:21 +02002790};
2791
Takashi Iwai1727a772013-01-10 09:52:52 +01002792static const struct hda_fixup alc262_fixups[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002793 [ALC262_FIXUP_FSC_H270] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002794 .type = HDA_FIXUP_PINS,
2795 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002796 { 0x14, 0x99130110 }, /* speaker */
2797 { 0x15, 0x0221142f }, /* front HP */
2798 { 0x1b, 0x0121141f }, /* rear HP */
2799 { }
2800 }
2801 },
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002802 [ALC262_FIXUP_FSC_S7110] = {
2803 .type = HDA_FIXUP_PINS,
2804 .v.pins = (const struct hda_pintbl[]) {
2805 { 0x15, 0x90170110 }, /* speaker */
2806 { }
2807 },
2808 .chained = true,
2809 .chain_id = ALC262_FIXUP_BENQ,
2810 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002811 [ALC262_FIXUP_HP_Z200] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002812 .type = HDA_FIXUP_PINS,
2813 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02002814 { 0x16, 0x99130120 }, /* internal speaker */
2815 { }
2816 }
2817 },
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002818 [ALC262_FIXUP_TYAN] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002819 .type = HDA_FIXUP_PINS,
2820 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002821 { 0x14, 0x1993e1f0 }, /* int AUX */
2822 { }
2823 }
2824 },
Takashi Iwaic4701502011-11-07 14:20:07 +01002825 [ALC262_FIXUP_LENOVO_3000] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01002826 .type = HDA_FIXUP_PINCTLS,
2827 .v.pins = (const struct hda_pintbl[]) {
2828 { 0x19, PIN_VREF50 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002829 {}
2830 },
2831 .chained = true,
2832 .chain_id = ALC262_FIXUP_BENQ,
2833 },
2834 [ALC262_FIXUP_BENQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002835 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002836 .v.verbs = (const struct hda_verb[]) {
Takashi Iwaic4701502011-11-07 14:20:07 +01002837 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2838 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
2839 {}
2840 }
2841 },
Takashi Iwaib42590b2011-11-07 14:41:01 +01002842 [ALC262_FIXUP_BENQ_T31] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002843 .type = HDA_FIXUP_VERBS,
Takashi Iwaib42590b2011-11-07 14:41:01 +01002844 .v.verbs = (const struct hda_verb[]) {
2845 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
2846 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
2847 {}
2848 }
2849 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002850 [ALC262_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002851 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002852 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002853 },
Mengdong Linb5c66112013-11-29 00:35:35 -05002854 [ALC262_FIXUP_INTEL_BAYLEYBAY] = {
2855 .type = HDA_FIXUP_FUNC,
2856 .v.func = alc_fixup_no_depop_delay,
2857 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002858};
2859
2860static const struct snd_pci_quirk alc262_fixup_tbl[] = {
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002861 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
Takashi Iwai7513e6d2013-01-18 15:41:34 +01002862 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu Lifebook S7110", ALC262_FIXUP_FSC_S7110),
Takashi Iwai3dcd3be2011-11-07 14:59:40 +01002863 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002864 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
Takashi Iwai275ec0c2018-06-22 12:17:45 +02002865 SND_PCI_QUIRK(0x1734, 0x1141, "FSC ESPRIMO U9210", ALC262_FIXUP_FSC_H270),
Takashi Iwaiea4e7af2011-11-07 12:23:55 +01002866 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
Takashi Iwaic4701502011-11-07 14:20:07 +01002867 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
Takashi Iwaib42590b2011-11-07 14:41:01 +01002868 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
2869 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
Mengdong Linb5c66112013-11-29 00:35:35 -05002870 SND_PCI_QUIRK(0x8086, 0x7270, "BayleyBay", ALC262_FIXUP_INTEL_BAYLEYBAY),
Takashi Iwai1d045db2011-07-07 18:23:21 +02002871 {}
2872};
2873
Takashi Iwai1727a772013-01-10 09:52:52 +01002874static const struct hda_model_fixup alc262_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002875 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaie43c44d2018-06-26 17:02:08 +02002876 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2877 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2878 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2879 {.id = ALC262_FIXUP_TYAN, .name = "tyan"},
2880 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2881 {.id = ALC262_FIXUP_BENQ, .name = "benq"},
2882 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2883 {.id = ALC262_FIXUP_INTEL_BAYLEYBAY, .name = "bayleybay"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002884 {}
2885};
Takashi Iwai1d045db2011-07-07 18:23:21 +02002886
Takashi Iwai1d045db2011-07-07 18:23:21 +02002887/*
2888 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002889static int patch_alc262(struct hda_codec *codec)
2890{
2891 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002892 int err;
2893
Takashi Iwai3de95172012-05-07 18:03:15 +02002894 err = alc_alloc_spec(codec, 0x0b);
2895 if (err < 0)
2896 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002897
Takashi Iwai3de95172012-05-07 18:03:15 +02002898 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01002899 spec->gen.shared_mic_vref_pin = 0x18;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002900
Takashi Iwai225068a2015-05-29 10:42:14 +02002901 spec->shutup = alc_eapd_shutup;
2902
Takashi Iwai1d045db2011-07-07 18:23:21 +02002903#if 0
2904 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is
2905 * under-run
2906 */
Takashi Iwai98b24882014-08-18 13:47:50 +02002907 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002908#endif
Takashi Iwai1d045db2011-07-07 18:23:21 +02002909 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2910
Takashi Iwaic9af7532019-05-10 11:01:43 +02002911 alc_pre_init(codec);
2912
Takashi Iwai1727a772013-01-10 09:52:52 +01002913 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002914 alc262_fixups);
Takashi Iwai1727a772013-01-10 09:52:52 +01002915 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +02002916
Takashi Iwaiaf741c12012-05-07 18:09:48 +02002917 alc_auto_parse_customize_define(codec);
2918
Takashi Iwai7504b6c2013-03-18 11:25:51 +01002919 if (has_cdefine_beep(codec))
2920 spec->gen.beep_nid = 0x01;
2921
Takashi Iwai42399f72011-11-07 17:18:44 +01002922 /* automatic parse from the BIOS config */
2923 err = alc262_parse_auto_config(codec);
2924 if (err < 0)
2925 goto error;
Takashi Iwai3e6179b2011-07-08 16:55:13 +02002926
Takashi Iwaifea80fa2018-06-20 12:52:46 +02002927 if (!spec->gen.no_analog && spec->gen.beep_nid) {
2928 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
2929 if (err < 0)
2930 goto error;
2931 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02002932
Takashi Iwai1727a772013-01-10 09:52:52 +01002933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +01002934
Takashi Iwai1d045db2011-07-07 18:23:21 +02002935 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02002936
2937 error:
2938 alc_free(codec);
2939 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02002940}
2941
2942/*
2943 * ALC268
2944 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02002945/* bind Beep switches of both NID 0x0f and 0x10 */
Takashi Iwaia7177772017-05-10 12:04:08 +02002946static int alc268_beep_switch_put(struct snd_kcontrol *kcontrol,
2947 struct snd_ctl_elem_value *ucontrol)
2948{
2949 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
2950 unsigned long pval;
2951 int err;
2952
2953 mutex_lock(&codec->control_mutex);
2954 pval = kcontrol->private_value;
2955 kcontrol->private_value = (pval & ~0xff) | 0x0f;
2956 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2957 if (err >= 0) {
2958 kcontrol->private_value = (pval & ~0xff) | 0x10;
2959 err = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
2960 }
2961 kcontrol->private_value = pval;
2962 mutex_unlock(&codec->control_mutex);
2963 return err;
2964}
Takashi Iwai1d045db2011-07-07 18:23:21 +02002965
2966static const struct snd_kcontrol_new alc268_beep_mixer[] = {
2967 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
Takashi Iwaia7177772017-05-10 12:04:08 +02002968 {
2969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2970 .name = "Beep Playback Switch",
2971 .subdevice = HDA_SUBDEV_AMP_FLAG,
2972 .info = snd_hda_mixer_amp_switch_info,
2973 .get = snd_hda_mixer_amp_switch_get,
2974 .put = alc268_beep_switch_put,
2975 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
2976 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02002977};
2978
2979/* set PCBEEP vol = 0, mute connections */
2980static const struct hda_verb alc268_beep_init_verbs[] = {
2981 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2982 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2983 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2984 { }
2985};
2986
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002987enum {
2988 ALC268_FIXUP_INV_DMIC,
Takashi Iwaicb766402012-10-20 10:55:21 +02002989 ALC268_FIXUP_HP_EAPD,
Takashi Iwai24eff322013-11-04 18:21:08 +01002990 ALC268_FIXUP_SPDIF,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002991};
2992
Takashi Iwai1727a772013-01-10 09:52:52 +01002993static const struct hda_fixup alc268_fixups[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002994 [ALC268_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002995 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02002996 .v.func = alc_fixup_inv_dmic,
Takashi Iwai6e72aa52012-06-25 10:52:25 +02002997 },
Takashi Iwaicb766402012-10-20 10:55:21 +02002998 [ALC268_FIXUP_HP_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01002999 .type = HDA_FIXUP_VERBS,
Takashi Iwaicb766402012-10-20 10:55:21 +02003000 .v.verbs = (const struct hda_verb[]) {
3001 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 0},
3002 {}
3003 }
3004 },
Takashi Iwai24eff322013-11-04 18:21:08 +01003005 [ALC268_FIXUP_SPDIF] = {
3006 .type = HDA_FIXUP_PINS,
3007 .v.pins = (const struct hda_pintbl[]) {
3008 { 0x1e, 0x014b1180 }, /* enable SPDIF out */
3009 {}
3010 }
3011 },
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003012};
3013
Takashi Iwai1727a772013-01-10 09:52:52 +01003014static const struct hda_model_fixup alc268_fixup_models[] = {
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003015 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaicb766402012-10-20 10:55:21 +02003016 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
Takashi Iwai03bf11c2018-06-26 16:56:41 +02003017 {.id = ALC268_FIXUP_SPDIF, .name = "spdif"},
Takashi Iwaicb766402012-10-20 10:55:21 +02003018 {}
3019};
3020
3021static const struct snd_pci_quirk alc268_fixup_tbl[] = {
Takashi Iwai24eff322013-11-04 18:21:08 +01003022 SND_PCI_QUIRK(0x1025, 0x0139, "Acer TravelMate 6293", ALC268_FIXUP_SPDIF),
David Henningssonfcd8f3b2013-01-28 05:45:47 +01003023 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
Takashi Iwaicb766402012-10-20 10:55:21 +02003024 /* below is codec SSID since multiple Toshiba laptops have the
3025 * same PCI SSID 1179:ff00
3026 */
3027 SND_PCI_QUIRK(0x1179, 0xff06, "Toshiba P200", ALC268_FIXUP_HP_EAPD),
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003028 {}
3029};
3030
Takashi Iwai1d045db2011-07-07 18:23:21 +02003031/*
3032 * BIOS auto configuration
3033 */
3034static int alc268_parse_auto_config(struct hda_codec *codec)
3035{
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003036 static const hda_nid_t alc268_ssids[] = { 0x15, 0x1b, 0x14, 0 };
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003037 return alc_parse_auto_config(codec, NULL, alc268_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003038}
3039
Takashi Iwai1d045db2011-07-07 18:23:21 +02003040/*
3041 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003042static int patch_alc268(struct hda_codec *codec)
3043{
3044 struct alc_spec *spec;
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003045 int i, err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003046
Takashi Iwai1d045db2011-07-07 18:23:21 +02003047 /* ALC268 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +02003048 err = alc_alloc_spec(codec, 0);
3049 if (err < 0)
3050 return err;
3051
3052 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +02003053 if (has_cdefine_beep(codec))
3054 spec->gen.beep_nid = 0x01;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003055
Takashi Iwai225068a2015-05-29 10:42:14 +02003056 spec->shutup = alc_eapd_shutup;
3057
Takashi Iwaic9af7532019-05-10 11:01:43 +02003058 alc_pre_init(codec);
3059
Takashi Iwai1727a772013-01-10 09:52:52 +01003060 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3061 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003062
Takashi Iwai6ebb8052011-08-16 15:15:40 +02003063 /* automatic parse from the BIOS config */
3064 err = alc268_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003065 if (err < 0)
3066 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003067
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003068 if (err > 0 && !spec->gen.no_analog &&
3069 spec->gen.autocfg.speaker_pins[0] != 0x1d) {
Takashi Iwaia5cb4632018-06-20 12:50:11 +02003070 for (i = 0; i < ARRAY_SIZE(alc268_beep_mixer); i++) {
3071 if (!snd_hda_gen_add_kctl(&spec->gen, NULL,
3072 &alc268_beep_mixer[i])) {
3073 err = -ENOMEM;
3074 goto error;
3075 }
3076 }
Takashi Iwai7504b6c2013-03-18 11:25:51 +01003077 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003078 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3079 /* override the amp caps for beep generator */
3080 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3081 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
3082 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
3083 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
3084 (0 << AC_AMPCAP_MUTE_SHIFT));
3085 }
3086
Takashi Iwai1727a772013-01-10 09:52:52 +01003087 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai6e72aa52012-06-25 10:52:25 +02003088
Takashi Iwai1d045db2011-07-07 18:23:21 +02003089 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02003090
3091 error:
3092 alc_free(codec);
3093 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02003094}
3095
3096/*
3097 * ALC269
3098 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01003099
Takashi Iwai1d045db2011-07-07 18:23:21 +02003100static const struct hda_pcm_stream alc269_44k_pcm_analog_playback = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003101 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003102};
3103
3104static const struct hda_pcm_stream alc269_44k_pcm_analog_capture = {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003105 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */
Takashi Iwai1d045db2011-07-07 18:23:21 +02003106};
3107
Takashi Iwai1d045db2011-07-07 18:23:21 +02003108/* different alc269-variants */
3109enum {
3110 ALC269_TYPE_ALC269VA,
3111 ALC269_TYPE_ALC269VB,
3112 ALC269_TYPE_ALC269VC,
Kailang Yangadcc70b2012-05-25 08:08:38 +02003113 ALC269_TYPE_ALC269VD,
Kailang Yang065380f2013-01-10 10:25:48 +01003114 ALC269_TYPE_ALC280,
3115 ALC269_TYPE_ALC282,
Kailang Yang2af02be2013-08-22 10:03:50 +02003116 ALC269_TYPE_ALC283,
Kailang Yang065380f2013-01-10 10:25:48 +01003117 ALC269_TYPE_ALC284,
Kailang Yang4731d5d2017-06-30 15:22:57 +08003118 ALC269_TYPE_ALC293,
Kailang Yang7fc7d042013-04-25 11:04:43 +02003119 ALC269_TYPE_ALC286,
Kailang Yang506b62c2014-12-18 17:07:44 +08003120 ALC269_TYPE_ALC298,
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003121 ALC269_TYPE_ALC255,
Kailang Yang4344aec2014-12-17 17:39:05 +08003122 ALC269_TYPE_ALC256,
Kailang Yangf429e7e2017-12-05 15:38:24 +08003123 ALC269_TYPE_ALC257,
Kailang Yang0a6f0602017-06-30 16:00:48 +08003124 ALC269_TYPE_ALC215,
Kailang Yang42314302016-02-03 15:03:50 +08003125 ALC269_TYPE_ALC225,
Kailang Yang99cee0342021-07-01 09:09:37 +08003126 ALC269_TYPE_ALC287,
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003127 ALC269_TYPE_ALC294,
Kailang Yang1078bef2018-11-08 16:36:15 +08003128 ALC269_TYPE_ALC300,
Kailang Yangf0778872019-10-24 15:13:32 +08003129 ALC269_TYPE_ALC623,
Kailang Yang6fbae352016-05-30 16:44:20 +08003130 ALC269_TYPE_ALC700,
Takashi Iwai1d045db2011-07-07 18:23:21 +02003131};
3132
3133/*
3134 * BIOS auto configuration
3135 */
3136static int alc269_parse_auto_config(struct hda_codec *codec)
3137{
Takashi Iwai1d045db2011-07-07 18:23:21 +02003138 static const hda_nid_t alc269_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003139 static const hda_nid_t alc269_ssids[] = { 0, 0x1b, 0x14, 0x21 };
3140 static const hda_nid_t alc269va_ssids[] = { 0x15, 0x1b, 0x14, 0 };
3141 struct alc_spec *spec = codec->spec;
Kailang Yangadcc70b2012-05-25 08:08:38 +02003142 const hda_nid_t *ssids;
3143
3144 switch (spec->codec_variant) {
3145 case ALC269_TYPE_ALC269VA:
3146 case ALC269_TYPE_ALC269VC:
Kailang Yang065380f2013-01-10 10:25:48 +01003147 case ALC269_TYPE_ALC280:
3148 case ALC269_TYPE_ALC284:
Kailang Yang4731d5d2017-06-30 15:22:57 +08003149 case ALC269_TYPE_ALC293:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003150 ssids = alc269va_ssids;
3151 break;
3152 case ALC269_TYPE_ALC269VB:
3153 case ALC269_TYPE_ALC269VD:
Kailang Yang065380f2013-01-10 10:25:48 +01003154 case ALC269_TYPE_ALC282:
Kailang Yang2af02be2013-08-22 10:03:50 +02003155 case ALC269_TYPE_ALC283:
Kailang Yang7fc7d042013-04-25 11:04:43 +02003156 case ALC269_TYPE_ALC286:
Kailang Yang506b62c2014-12-18 17:07:44 +08003157 case ALC269_TYPE_ALC298:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02003158 case ALC269_TYPE_ALC255:
Kailang Yang4344aec2014-12-17 17:39:05 +08003159 case ALC269_TYPE_ALC256:
Kailang Yangf429e7e2017-12-05 15:38:24 +08003160 case ALC269_TYPE_ALC257:
Kailang Yang0a6f0602017-06-30 16:00:48 +08003161 case ALC269_TYPE_ALC215:
Kailang Yang42314302016-02-03 15:03:50 +08003162 case ALC269_TYPE_ALC225:
Kailang Yang99cee0342021-07-01 09:09:37 +08003163 case ALC269_TYPE_ALC287:
Kailang Yangdcd4f0d2016-05-04 15:50:18 +08003164 case ALC269_TYPE_ALC294:
Kailang Yang1078bef2018-11-08 16:36:15 +08003165 case ALC269_TYPE_ALC300:
Kailang Yangf0778872019-10-24 15:13:32 +08003166 case ALC269_TYPE_ALC623:
Kailang Yang6fbae352016-05-30 16:44:20 +08003167 case ALC269_TYPE_ALC700:
Kailang Yangadcc70b2012-05-25 08:08:38 +02003168 ssids = alc269_ssids;
3169 break;
3170 default:
3171 ssids = alc269_ssids;
3172 break;
3173 }
Takashi Iwai1d045db2011-07-07 18:23:21 +02003174
Takashi Iwai3e6179b2011-07-08 16:55:13 +02003175 return alc_parse_auto_config(codec, alc269_ignore, ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003176}
3177
Hui Wang476c02e2020-03-29 16:20:18 +08003178static const struct hda_jack_keymap alc_headset_btn_keymap[] = {
3179 { SND_JACK_BTN_0, KEY_PLAYPAUSE },
3180 { SND_JACK_BTN_1, KEY_VOICECOMMAND },
3181 { SND_JACK_BTN_2, KEY_VOLUMEUP },
3182 { SND_JACK_BTN_3, KEY_VOLUMEDOWN },
3183 {}
3184};
3185
3186static void alc_headset_btn_callback(struct hda_codec *codec,
3187 struct hda_jack_callback *jack)
3188{
3189 int report = 0;
3190
3191 if (jack->unsol_res & (7 << 13))
3192 report |= SND_JACK_BTN_0;
3193
3194 if (jack->unsol_res & (1 << 16 | 3 << 8))
3195 report |= SND_JACK_BTN_1;
3196
3197 /* Volume up key */
3198 if (jack->unsol_res & (7 << 23))
3199 report |= SND_JACK_BTN_2;
3200
3201 /* Volume down key */
3202 if (jack->unsol_res & (7 << 10))
3203 report |= SND_JACK_BTN_3;
3204
Hui Wang04f77912021-03-05 17:26:08 +08003205 snd_hda_jack_set_button_state(codec, jack->nid, report);
Hui Wang476c02e2020-03-29 16:20:18 +08003206}
3207
3208static void alc_disable_headset_jack_key(struct hda_codec *codec)
3209{
3210 struct alc_spec *spec = codec->spec;
3211
3212 if (!spec->has_hs_key)
3213 return;
3214
3215 switch (codec->core.vendor_id) {
3216 case 0x10ec0215:
3217 case 0x10ec0225:
3218 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003219 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003220 case 0x10ec0295:
3221 case 0x10ec0289:
3222 case 0x10ec0299:
3223 alc_write_coef_idx(codec, 0x48, 0x0);
3224 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3225 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3226 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003227 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003228 case 0x10ec0236:
3229 case 0x10ec0256:
3230 alc_write_coef_idx(codec, 0x48, 0x0);
3231 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3232 break;
3233 }
3234}
3235
3236static void alc_enable_headset_jack_key(struct hda_codec *codec)
3237{
3238 struct alc_spec *spec = codec->spec;
3239
3240 if (!spec->has_hs_key)
3241 return;
3242
3243 switch (codec->core.vendor_id) {
3244 case 0x10ec0215:
3245 case 0x10ec0225:
3246 case 0x10ec0285:
Hui Wangc72b9bf2020-12-05 13:11:30 +08003247 case 0x10ec0287:
Hui Wang476c02e2020-03-29 16:20:18 +08003248 case 0x10ec0295:
3249 case 0x10ec0289:
3250 case 0x10ec0299:
3251 alc_write_coef_idx(codec, 0x48, 0xd011);
3252 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3253 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3254 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02003255 case 0x10ec0230:
Hui Wang476c02e2020-03-29 16:20:18 +08003256 case 0x10ec0236:
3257 case 0x10ec0256:
3258 alc_write_coef_idx(codec, 0x48, 0xd011);
3259 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3260 break;
3261 }
3262}
3263
3264static void alc_fixup_headset_jack(struct hda_codec *codec,
3265 const struct hda_fixup *fix, int action)
3266{
3267 struct alc_spec *spec = codec->spec;
Hui Wang04f77912021-03-05 17:26:08 +08003268 hda_nid_t hp_pin;
Hui Wang476c02e2020-03-29 16:20:18 +08003269
3270 switch (action) {
3271 case HDA_FIXUP_ACT_PRE_PROBE:
3272 spec->has_hs_key = 1;
3273 snd_hda_jack_detect_enable_callback(codec, 0x55,
3274 alc_headset_btn_callback);
Hui Wang476c02e2020-03-29 16:20:18 +08003275 break;
Hui Wang04f77912021-03-05 17:26:08 +08003276 case HDA_FIXUP_ACT_BUILD:
3277 hp_pin = alc_get_hp_pin(spec);
3278 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
3279 alc_headset_btn_keymap,
3280 hp_pin))
3281 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
3282 false, SND_JACK_HEADSET,
3283 alc_headset_btn_keymap);
3284
Hui Wang476c02e2020-03-29 16:20:18 +08003285 alc_enable_headset_jack_key(codec);
3286 break;
3287 }
3288}
3289
Kailang Yang1387e2d2012-11-08 10:23:18 +01003290static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
Takashi Iwai1d045db2011-07-07 18:23:21 +02003291{
Takashi Iwai98b24882014-08-18 13:47:50 +02003292 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003293}
3294
3295static void alc269_shutup(struct hda_codec *codec)
3296{
Kailang Yangadcc70b2012-05-25 08:08:38 +02003297 struct alc_spec *spec = codec->spec;
3298
Kailang Yang1387e2d2012-11-08 10:23:18 +01003299 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
3300 alc269vb_toggle_power_output(codec, 0);
3301 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
3302 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02003303 msleep(150);
3304 }
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003305 alc_shutup_pins(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02003306}
3307
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003308static const struct coef_fw alc282_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003309 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang32fa7e42014-10-24 16:26:01 +08003310 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003311 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3312 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3313 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3314 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3315 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3316 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3317 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3318 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3319 WRITE_COEF(0x6f, 0x0), /* Class D test 4 */
3320 UPDATE_COEF(0x0c, 0xfe00, 0), /* IO power down directly */
3321 WRITE_COEF(0x34, 0xa0c0), /* ANC */
3322 UPDATE_COEF(0x16, 0x0008, 0), /* AGC MUX */
3323 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3324 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3325 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3326 WRITE_COEF(0x63, 0x2902), /* PLL */
3327 WRITE_COEF(0x68, 0xa080), /* capless control 2 */
3328 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3329 WRITE_COEF(0x6a, 0x2f3e), /* capless control 4 */
3330 WRITE_COEF(0x6b, 0x0), /* capless control 5 */
3331 UPDATE_COEF(0x6d, 0x0fff, 0x0900), /* class D test 2 */
3332 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3333 UPDATE_COEF(0x70, 0x00f8, 0x00d8), /* class D test 5 */
3334 WRITE_COEF(0x71, 0x0014), /* class D test 6 */
3335 WRITE_COEF(0x72, 0xc2ba), /* classD OCP */
3336 UPDATE_COEF(0x77, 0x0f80, 0), /* classD pure DC test */
3337 WRITE_COEF(0x6c, 0xfc06), /* Class D amp control */
3338 {}
3339};
3340
Kailang Yangcb149cb2014-03-18 16:45:32 +08003341static void alc282_restore_default_value(struct hda_codec *codec)
3342{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003343 alc_process_coef_fw(codec, alc282_coefs);
Kailang Yangcb149cb2014-03-18 16:45:32 +08003344}
3345
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003346static void alc282_init(struct hda_codec *codec)
3347{
3348 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003349 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003350 bool hp_pin_sense;
3351 int coef78;
3352
Kailang Yangcb149cb2014-03-18 16:45:32 +08003353 alc282_restore_default_value(codec);
3354
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003355 if (!hp_pin)
3356 return;
3357 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3358 coef78 = alc_read_coef_idx(codec, 0x78);
3359
3360 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */
3361 /* Headphone capless set to high power mode */
3362 alc_write_coef_idx(codec, 0x78, 0x9004);
3363
3364 if (hp_pin_sense)
3365 msleep(2);
3366
3367 snd_hda_codec_write(codec, hp_pin, 0,
3368 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3369
3370 if (hp_pin_sense)
3371 msleep(85);
3372
3373 snd_hda_codec_write(codec, hp_pin, 0,
3374 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3375
3376 if (hp_pin_sense)
3377 msleep(100);
3378
3379 /* Headphone capless set to normal mode */
3380 alc_write_coef_idx(codec, 0x78, coef78);
3381}
3382
3383static void alc282_shutup(struct hda_codec *codec)
3384{
3385 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003386 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003387 bool hp_pin_sense;
3388 int coef78;
3389
3390 if (!hp_pin) {
3391 alc269_shutup(codec);
3392 return;
3393 }
3394
3395 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3396 coef78 = alc_read_coef_idx(codec, 0x78);
3397 alc_write_coef_idx(codec, 0x78, 0x9004);
3398
3399 if (hp_pin_sense)
3400 msleep(2);
3401
3402 snd_hda_codec_write(codec, hp_pin, 0,
3403 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3404
3405 if (hp_pin_sense)
3406 msleep(85);
3407
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003408 if (!spec->no_shutup_pins)
3409 snd_hda_codec_write(codec, hp_pin, 0,
3410 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003411
3412 if (hp_pin_sense)
3413 msleep(100);
3414
3415 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003416 alc_shutup_pins(codec);
Kailang Yang7b5c7a02014-03-18 16:15:54 +08003417 alc_write_coef_idx(codec, 0x78, coef78);
3418}
3419
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01003420static const struct coef_fw alc283_coefs[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02003421 WRITE_COEF(0x03, 0x0002), /* Power Down Control */
Kailang Yang56779862014-10-24 16:17:51 +08003422 UPDATE_COEF(0x05, 0xff3f, 0x0700), /* FIFO and filter clock */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003423 WRITE_COEF(0x07, 0x0200), /* DMIC control */
3424 UPDATE_COEF(0x06, 0x00f0, 0), /* Analog clock */
3425 UPDATE_COEF(0x08, 0xfffc, 0x0c2c), /* JD */
3426 WRITE_COEF(0x0a, 0xcccc), /* JD offset1 */
3427 WRITE_COEF(0x0b, 0xcccc), /* JD offset2 */
3428 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3429 UPDATE_COEF(0x0f, 0xf800, 0x1000), /* JD */
3430 UPDATE_COEF(0x10, 0xfc00, 0x0c00), /* Capless */
3431 WRITE_COEF(0x3a, 0x0), /* Class D test 4 */
3432 UPDATE_COEF(0x0c, 0xfe00, 0x0), /* IO power down directly */
3433 WRITE_COEF(0x22, 0xa0c0), /* ANC */
3434 UPDATE_COEFEX(0x53, 0x01, 0x000f, 0x0008), /* AGC MUX */
3435 UPDATE_COEF(0x1d, 0x00e0, 0), /* DAC simple content protection */
3436 UPDATE_COEF(0x1f, 0x00e0, 0), /* ADC simple content protection */
3437 WRITE_COEF(0x21, 0x8804), /* DAC ADC Zero Detection */
3438 WRITE_COEF(0x2e, 0x2902), /* PLL */
3439 WRITE_COEF(0x33, 0xa080), /* capless control 2 */
3440 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3441 WRITE_COEF(0x35, 0x2f3e), /* capless control 4 */
3442 WRITE_COEF(0x36, 0x0), /* capless control 5 */
3443 UPDATE_COEF(0x38, 0x0fff, 0x0900), /* class D test 2 */
3444 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3445 UPDATE_COEF(0x3b, 0x00f8, 0x00d8), /* class D test 5 */
3446 WRITE_COEF(0x3c, 0x0014), /* class D test 6 */
3447 WRITE_COEF(0x3d, 0xc2ba), /* classD OCP */
3448 UPDATE_COEF(0x42, 0x0f80, 0x0), /* classD pure DC test */
3449 WRITE_COEF(0x49, 0x0), /* test mode */
3450 UPDATE_COEF(0x40, 0xf800, 0x9800), /* Class D DC enable */
3451 UPDATE_COEF(0x42, 0xf000, 0x2000), /* DC offset */
3452 WRITE_COEF(0x37, 0xfc06), /* Class D amp control */
Kailang Yang56779862014-10-24 16:17:51 +08003453 UPDATE_COEF(0x1b, 0x8000, 0), /* HP JD control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02003454 {}
3455};
3456
Kailang Yang6bd55b02014-03-17 13:51:27 +08003457static void alc283_restore_default_value(struct hda_codec *codec)
3458{
Takashi Iwai54db6c32014-08-18 15:11:19 +02003459 alc_process_coef_fw(codec, alc283_coefs);
Kailang Yang6bd55b02014-03-17 13:51:27 +08003460}
3461
Kailang Yang2af02be2013-08-22 10:03:50 +02003462static void alc283_init(struct hda_codec *codec)
3463{
3464 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003465 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003466 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003467
Kailang Yang6bd55b02014-03-17 13:51:27 +08003468 alc283_restore_default_value(codec);
3469
Kailang Yang2af02be2013-08-22 10:03:50 +02003470 if (!hp_pin)
3471 return;
Kailang Yanga59d7192015-04-08 16:34:00 +08003472
3473 msleep(30);
Kailang Yang2af02be2013-08-22 10:03:50 +02003474 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3475
3476 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */
3477 /* Headphone capless set to high power mode */
3478 alc_write_coef_idx(codec, 0x43, 0x9004);
3479
3480 snd_hda_codec_write(codec, hp_pin, 0,
3481 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3482
3483 if (hp_pin_sense)
3484 msleep(85);
3485
3486 snd_hda_codec_write(codec, hp_pin, 0,
3487 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3488
3489 if (hp_pin_sense)
3490 msleep(85);
3491 /* Index 0x46 Combo jack auto switch control 2 */
3492 /* 3k pull low control for Headset jack. */
Takashi Iwai98b24882014-08-18 13:47:50 +02003493 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003494 /* Headphone capless set to normal mode */
3495 alc_write_coef_idx(codec, 0x43, 0x9614);
3496}
3497
3498static void alc283_shutup(struct hda_codec *codec)
3499{
3500 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003501 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003502 bool hp_pin_sense;
Kailang Yang2af02be2013-08-22 10:03:50 +02003503
3504 if (!hp_pin) {
3505 alc269_shutup(codec);
3506 return;
3507 }
3508
3509 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3510
3511 alc_write_coef_idx(codec, 0x43, 0x9004);
3512
Harsha Priyab450b172014-10-09 11:04:56 +00003513 /*depop hp during suspend*/
3514 alc_write_coef_idx(codec, 0x06, 0x2100);
3515
Kailang Yang2af02be2013-08-22 10:03:50 +02003516 snd_hda_codec_write(codec, hp_pin, 0,
3517 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3518
3519 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003520 msleep(100);
Kailang Yang2af02be2013-08-22 10:03:50 +02003521
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003522 if (!spec->no_shutup_pins)
3523 snd_hda_codec_write(codec, hp_pin, 0,
3524 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang2af02be2013-08-22 10:03:50 +02003525
Takashi Iwai98b24882014-08-18 13:47:50 +02003526 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Kailang Yang2af02be2013-08-22 10:03:50 +02003527
3528 if (hp_pin_sense)
Kailang Yang88011c092013-10-24 15:45:24 +02003529 msleep(100);
Kailang Yang0435b3f2014-04-08 17:14:14 +08003530 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003531 alc_shutup_pins(codec);
Kailang Yang2af02be2013-08-22 10:03:50 +02003532 alc_write_coef_idx(codec, 0x43, 0x9614);
3533}
3534
Kailang Yang4a219ef2017-06-16 16:54:35 +08003535static void alc256_init(struct hda_codec *codec)
3536{
3537 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003538 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003539 bool hp_pin_sense;
3540
3541 if (!hp_pin)
Kailang Yang6447c962019-05-08 16:27:03 +08003542 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003543
3544 msleep(30);
3545
3546 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3547
3548 if (hp_pin_sense)
3549 msleep(2);
3550
3551 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yang6447c962019-05-08 16:27:03 +08003552 if (spec->ultra_low_power) {
3553 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3554 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3555 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3556 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3557 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3558 msleep(30);
3559 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003560
3561 snd_hda_codec_write(codec, hp_pin, 0,
3562 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3563
Kailang Yang6447c962019-05-08 16:27:03 +08003564 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003565 msleep(85);
3566
3567 snd_hda_codec_write(codec, hp_pin, 0,
3568 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3569
Kailang Yang6447c962019-05-08 16:27:03 +08003570 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003571 msleep(100);
3572
3573 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3574 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
Kailang Yang88d42b22018-03-14 16:08:57 +08003575 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3576 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
Thomas Hebbc4473742020-03-30 12:09:38 -04003577 /*
3578 * Expose headphone mic (or possibly Line In on some machines) instead
3579 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See
3580 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of
3581 * this register.
3582 */
3583 alc_write_coef_idx(codec, 0x36, 0x5757);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003584}
3585
3586static void alc256_shutup(struct hda_codec *codec)
3587{
3588 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003589 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003590 bool hp_pin_sense;
3591
Kailang Yang6447c962019-05-08 16:27:03 +08003592 if (!hp_pin)
3593 hp_pin = 0x21;
Kailang Yang4a219ef2017-06-16 16:54:35 +08003594
3595 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3596
3597 if (hp_pin_sense)
3598 msleep(2);
3599
3600 snd_hda_codec_write(codec, hp_pin, 0,
3601 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3602
Kailang Yang6447c962019-05-08 16:27:03 +08003603 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003604 msleep(85);
3605
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003606 /* 3k pull low control for Headset jack. */
3607 /* NOTE: call this before clearing the pin, otherwise codec stalls */
Hui Wang3f742492020-09-14 14:51:18 +08003608 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly
3609 * when booting with headset plugged. So skip setting it for the codec alc257
3610 */
Kailang Yang5aec9892021-10-05 14:35:14 +08003611 if (spec->codec_variant != ALC269_TYPE_ALC257 &&
3612 spec->codec_variant != ALC269_TYPE_ALC256)
Hui Wang3f742492020-09-14 14:51:18 +08003613 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
Takashi Iwai1c9609e2018-01-19 14:18:34 +01003614
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003615 if (!spec->no_shutup_pins)
3616 snd_hda_codec_write(codec, hp_pin, 0,
3617 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang4a219ef2017-06-16 16:54:35 +08003618
Kailang Yang6447c962019-05-08 16:27:03 +08003619 if (hp_pin_sense || spec->ultra_low_power)
Kailang Yang4a219ef2017-06-16 16:54:35 +08003620 msleep(100);
3621
3622 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003623 alc_shutup_pins(codec);
Kailang Yang6447c962019-05-08 16:27:03 +08003624 if (spec->ultra_low_power) {
3625 msleep(50);
3626 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3627 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3628 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3629 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3630 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3631 msleep(30);
3632 }
Kailang Yang4a219ef2017-06-16 16:54:35 +08003633}
3634
Kailang Yang3c24e482021-07-01 09:33:33 +08003635static void alc285_hp_init(struct hda_codec *codec)
3636{
3637 struct alc_spec *spec = codec->spec;
3638 hda_nid_t hp_pin = alc_get_hp_pin(spec);
3639 int i, val;
3640 int coef38, coef0d, coef36;
3641
3642 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
3643 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
3644 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
3645 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
3646 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
3647 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
3648
3649 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
3650
3651 if (hp_pin)
3652 snd_hda_codec_write(codec, hp_pin, 0,
3653 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3654
3655 msleep(130);
3656 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
3657 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
3658
3659 if (hp_pin)
3660 snd_hda_codec_write(codec, hp_pin, 0,
3661 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3662 msleep(10);
3663 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
3664 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
3665 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
3666 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
3667
3668 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
3669 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3670 for (i = 0; i < 20 && val & 0x8000; i++) {
3671 msleep(50);
3672 val = alc_read_coefex_idx(codec, 0x58, 0x00);
3673 } /* Wait for depop procedure finish */
3674
3675 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
3676 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
3677 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
3678 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
3679
3680 msleep(50);
3681 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
3682}
3683
Kailang Yangda911b12018-01-05 16:50:08 +08003684static void alc225_init(struct hda_codec *codec)
3685{
3686 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003687 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003688 bool hp1_pin_sense, hp2_pin_sense;
3689
Kailang Yang3c24e482021-07-01 09:33:33 +08003690 if (spec->codec_variant != ALC269_TYPE_ALC287)
3691 /* required only at boot or S3 and S4 resume time */
3692 if (!spec->done_hp_init ||
3693 is_s3_resume(codec) ||
3694 is_s4_resume(codec)) {
3695 alc285_hp_init(codec);
3696 spec->done_hp_init = true;
3697 }
3698
Kailang Yangda911b12018-01-05 16:50:08 +08003699 if (!hp_pin)
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003700 hp_pin = 0x21;
Kailang Yangda911b12018-01-05 16:50:08 +08003701 msleep(30);
3702
3703 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3704 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3705
3706 if (hp1_pin_sense || hp2_pin_sense)
3707 msleep(2);
3708
3709 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003710 if (spec->ultra_low_power) {
3711 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3712 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3713 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3714 msleep(30);
3715 }
Kailang Yangda911b12018-01-05 16:50:08 +08003716
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003717 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003718 snd_hda_codec_write(codec, hp_pin, 0,
3719 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3720 if (hp2_pin_sense)
3721 snd_hda_codec_write(codec, 0x16, 0,
3722 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3723
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003724 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003725 msleep(85);
3726
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003727 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003728 snd_hda_codec_write(codec, hp_pin, 0,
3729 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3730 if (hp2_pin_sense)
3731 snd_hda_codec_write(codec, 0x16, 0,
3732 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3733
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003734 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003735 msleep(100);
3736
3737 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3738 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3739}
3740
3741static void alc225_shutup(struct hda_codec *codec)
3742{
3743 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003744 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangda911b12018-01-05 16:50:08 +08003745 bool hp1_pin_sense, hp2_pin_sense;
3746
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003747 if (!hp_pin)
3748 hp_pin = 0x21;
Hui Wang476c02e2020-03-29 16:20:18 +08003749
3750 alc_disable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003751 /* 3k pull low control for Headset jack. */
3752 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3753
3754 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3755 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3756
3757 if (hp1_pin_sense || hp2_pin_sense)
3758 msleep(2);
3759
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003760 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003761 snd_hda_codec_write(codec, hp_pin, 0,
3762 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3763 if (hp2_pin_sense)
3764 snd_hda_codec_write(codec, 0x16, 0,
3765 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3766
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003767 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003768 msleep(85);
3769
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003770 if (hp1_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003771 snd_hda_codec_write(codec, hp_pin, 0,
3772 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3773 if (hp2_pin_sense)
3774 snd_hda_codec_write(codec, 0x16, 0,
3775 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
3776
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003777 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power)
Kailang Yangda911b12018-01-05 16:50:08 +08003778 msleep(100);
3779
3780 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003781 alc_shutup_pins(codec);
Kailang Yangd3ba58b2019-05-06 15:09:42 +08003782 if (spec->ultra_low_power) {
3783 msleep(50);
3784 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3785 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3786 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3787 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3788 msleep(30);
3789 }
Hui Wang476c02e2020-03-29 16:20:18 +08003790
3791 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3792 alc_enable_headset_jack_key(codec);
Kailang Yangda911b12018-01-05 16:50:08 +08003793}
3794
Kailang Yangc2d6af52017-06-21 14:50:54 +08003795static void alc_default_init(struct hda_codec *codec)
3796{
3797 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003798 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003799 bool hp_pin_sense;
3800
3801 if (!hp_pin)
3802 return;
3803
3804 msleep(30);
3805
3806 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3807
3808 if (hp_pin_sense)
3809 msleep(2);
3810
3811 snd_hda_codec_write(codec, hp_pin, 0,
3812 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3813
3814 if (hp_pin_sense)
3815 msleep(85);
3816
3817 snd_hda_codec_write(codec, hp_pin, 0,
3818 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
3819
3820 if (hp_pin_sense)
3821 msleep(100);
3822}
3823
3824static void alc_default_shutup(struct hda_codec *codec)
3825{
3826 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003827 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003828 bool hp_pin_sense;
3829
3830 if (!hp_pin) {
3831 alc269_shutup(codec);
3832 return;
3833 }
3834
3835 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3836
3837 if (hp_pin_sense)
3838 msleep(2);
3839
3840 snd_hda_codec_write(codec, hp_pin, 0,
3841 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3842
3843 if (hp_pin_sense)
3844 msleep(85);
3845
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003846 if (!spec->no_shutup_pins)
3847 snd_hda_codec_write(codec, hp_pin, 0,
3848 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003849
3850 if (hp_pin_sense)
3851 msleep(100);
3852
3853 alc_auto_setup_eapd(codec, false);
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003854 alc_shutup_pins(codec);
Kailang Yangc2d6af52017-06-21 14:50:54 +08003855}
3856
Kailang Yang693abe12019-01-29 15:38:21 +08003857static void alc294_hp_init(struct hda_codec *codec)
3858{
3859 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01003860 hda_nid_t hp_pin = alc_get_hp_pin(spec);
Kailang Yang693abe12019-01-29 15:38:21 +08003861 int i, val;
3862
3863 if (!hp_pin)
3864 return;
3865
3866 snd_hda_codec_write(codec, hp_pin, 0,
3867 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
3868
3869 msleep(100);
3870
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01003871 if (!spec->no_shutup_pins)
3872 snd_hda_codec_write(codec, hp_pin, 0,
3873 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
Kailang Yang693abe12019-01-29 15:38:21 +08003874
3875 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3876 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3877
3878 /* Wait for depop procedure finish */
3879 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3880 for (i = 0; i < 20 && val & 0x0080; i++) {
3881 msleep(50);
3882 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3883 }
3884 /* Set HP depop to auto mode */
3885 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3886 msleep(50);
3887}
3888
3889static void alc294_init(struct hda_codec *codec)
3890{
3891 struct alc_spec *spec = codec->spec;
3892
Takashi Iwaif6ef4e02019-01-29 14:14:51 +01003893 /* required only at boot or S4 resume time */
3894 if (!spec->done_hp_init ||
3895 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
Kailang Yang693abe12019-01-29 15:38:21 +08003896 alc294_hp_init(codec);
3897 spec->done_hp_init = true;
3898 }
3899 alc_default_init(codec);
3900}
3901
Kailang Yangad60d502013-06-28 12:03:01 +02003902static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3903 unsigned int val)
3904{
3905 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3906 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3907 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3908}
3909
3910static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3911{
3912 unsigned int val;
3913
3914 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3915 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3916 & 0xffff;
3917 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3918 << 16;
3919 return val;
3920}
3921
3922static void alc5505_dsp_halt(struct hda_codec *codec)
3923{
3924 unsigned int val;
3925
3926 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3927 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3928 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3929 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3930 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3931 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3932 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3933 val = alc5505_coef_get(codec, 0x6220);
3934 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3935}
3936
3937static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3938{
3939 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3940 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3941 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3942 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3943 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3944 alc5505_coef_set(codec, 0x880c, 0x00000004);
3945}
3946
3947static void alc5505_dsp_init(struct hda_codec *codec)
3948{
3949 unsigned int val;
3950
3951 alc5505_dsp_halt(codec);
3952 alc5505_dsp_back_from_halt(codec);
3953 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3954 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3955 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3956 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3957 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3958 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3959 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3960 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3961 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3962 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3963 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3964 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3965 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3966
3967 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3968 if (val <= 3)
3969 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3970 else
3971 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3972
3973 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3974 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3975 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3976 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3977 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3978 alc5505_coef_set(codec, 0x880c, 0x00000003);
3979 alc5505_coef_set(codec, 0x880c, 0x00000010);
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003980
3981#ifdef HALT_REALTEK_ALC5505
3982 alc5505_dsp_halt(codec);
3983#endif
Kailang Yangad60d502013-06-28 12:03:01 +02003984}
3985
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003986#ifdef HALT_REALTEK_ALC5505
Pierre-Louis Bossart8a718212020-01-11 15:47:35 -06003987#define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3988#define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02003989#else
3990#define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3991#define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3992#endif
3993
Takashi Iwai2a439522011-07-26 09:52:50 +02003994#ifdef CONFIG_PM
Kailang Yangad60d502013-06-28 12:03:01 +02003995static int alc269_suspend(struct hda_codec *codec)
3996{
3997 struct alc_spec *spec = codec->spec;
3998
3999 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02004000 alc5505_dsp_suspend(codec);
Kailang Yangad60d502013-06-28 12:03:01 +02004001 return alc_suspend(codec);
4002}
4003
Takashi Iwai1d045db2011-07-07 18:23:21 +02004004static int alc269_resume(struct hda_codec *codec)
4005{
Kailang Yangadcc70b2012-05-25 08:08:38 +02004006 struct alc_spec *spec = codec->spec;
4007
Kailang Yang1387e2d2012-11-08 10:23:18 +01004008 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4009 alc269vb_toggle_power_output(codec, 0);
4010 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02004011 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02004012 msleep(150);
4013 }
4014
4015 codec->patch_ops.init(codec);
4016
Kailang Yang1387e2d2012-11-08 10:23:18 +01004017 if (spec->codec_variant == ALC269_TYPE_ALC269VB)
4018 alc269vb_toggle_power_output(codec, 1);
4019 if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
Kailang Yangadcc70b2012-05-25 08:08:38 +02004020 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02004021 msleep(200);
4022 }
4023
Takashi Iwai1a462be2020-01-09 10:01:04 +01004024 snd_hda_regmap_sync(codec);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004025 hda_call_check_power_status(codec, 0x01);
Hui Wangf4753712014-08-19 12:07:03 +08004026
4027 /* on some machine, the BIOS will clear the codec gpio data when enter
4028 * suspend, and won't restore the data after resume, so we restore it
4029 * in the driver.
4030 */
Takashi Iwaid261eec2018-06-19 22:32:29 +02004031 if (spec->gpio_data)
4032 alc_write_gpio_data(codec);
Hui Wangf4753712014-08-19 12:07:03 +08004033
Kailang Yangad60d502013-06-28 12:03:01 +02004034 if (spec->has_alc5505_dsp)
Takashi Iwaicd63a5f2013-07-05 12:13:59 +02004035 alc5505_dsp_resume(codec);
Kailang Yangc5177c82013-07-24 14:39:49 +02004036
Takashi Iwai1d045db2011-07-07 18:23:21 +02004037 return 0;
4038}
Takashi Iwai2a439522011-07-26 09:52:50 +02004039#endif /* CONFIG_PM */
Takashi Iwai1d045db2011-07-07 18:23:21 +02004040
David Henningsson108cc102012-07-20 10:37:25 +02004041static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004042 const struct hda_fixup *fix, int action)
David Henningsson108cc102012-07-20 10:37:25 +02004043{
4044 struct alc_spec *spec = codec->spec;
4045
Takashi Iwai1727a772013-01-10 09:52:52 +01004046 if (action == HDA_FIXUP_ACT_PRE_PROBE)
David Henningsson108cc102012-07-20 10:37:25 +02004047 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
4048}
4049
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01004050static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4051 const struct hda_fixup *fix,
4052 int action)
4053{
4054 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4055 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4056
4057 if (cfg_headphone && cfg_headset_mic == 0x411111f0)
4058 snd_hda_codec_set_pincfg(codec, 0x19,
4059 (cfg_headphone & ~AC_DEFCFG_DEVICE) |
4060 (AC_JACK_MIC_IN << AC_DEFCFG_DEVICE_SHIFT));
4061}
4062
Takashi Iwai1d045db2011-07-07 18:23:21 +02004063static void alc269_fixup_hweq(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004064 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004065{
Takashi Iwai98b24882014-08-18 13:47:50 +02004066 if (action == HDA_FIXUP_ACT_INIT)
4067 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004068}
4069
David Henningsson7c478f02013-10-11 10:18:46 +02004070static void alc269_fixup_headset_mic(struct hda_codec *codec,
4071 const struct hda_fixup *fix, int action)
4072{
4073 struct alc_spec *spec = codec->spec;
4074
4075 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4076 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4077}
4078
Takashi Iwai1d045db2011-07-07 18:23:21 +02004079static void alc271_fixup_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004080 const struct hda_fixup *fix, int action)
Takashi Iwai1d045db2011-07-07 18:23:21 +02004081{
4082 static const struct hda_verb verbs[] = {
4083 {0x20, AC_VERB_SET_COEF_INDEX, 0x0d},
4084 {0x20, AC_VERB_SET_PROC_COEF, 0x4000},
4085 {}
4086 };
4087 unsigned int cfg;
4088
Takashi Iwai7639a062015-03-03 10:07:24 +01004089 if (strcmp(codec->core.chip_name, "ALC271X") &&
4090 strcmp(codec->core.chip_name, "ALC269VB"))
Takashi Iwai1d045db2011-07-07 18:23:21 +02004091 return;
4092 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4093 if (get_defcfg_connect(cfg) == AC_JACK_PORT_FIXED)
4094 snd_hda_sequence_write(codec, verbs);
4095}
4096
Takashi Iwaic8426b22021-04-07 11:57:30 +02004097/* Fix the speaker amp after resume, etc */
4098static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4099 const struct hda_fixup *fix,
4100 int action)
4101{
4102 if (action == HDA_FIXUP_ACT_INIT)
4103 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4104}
4105
Takashi Iwai017f2a12011-07-09 14:42:25 +02004106static void alc269_fixup_pcm_44k(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004107 const struct hda_fixup *fix, int action)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004108{
4109 struct alc_spec *spec = codec->spec;
4110
Takashi Iwai1727a772013-01-10 09:52:52 +01004111 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai017f2a12011-07-09 14:42:25 +02004112 return;
4113
4114 /* Due to a hardware problem on Lenovo Ideadpad, we need to
4115 * fix the sample rate of analog I/O to 44.1kHz
4116 */
Takashi Iwai08c189f2012-12-19 15:22:24 +01004117 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback;
4118 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture;
Takashi Iwai017f2a12011-07-09 14:42:25 +02004119}
4120
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004121static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004122 const struct hda_fixup *fix, int action)
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004123{
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004124 /* The digital-mic unit sends PDM (differential signal) instead of
4125 * the standard PCM, thus you can't record a valid mono stream as is.
4126 * Below is a workaround specific to ALC269 to control the dmic
4127 * signal source as mono.
4128 */
Takashi Iwai98b24882014-08-18 13:47:50 +02004129 if (action == HDA_FIXUP_ACT_INIT)
4130 alc_update_coef_idx(codec, 0x07, 0, 0x80);
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02004131}
4132
Takashi Iwai24519912011-08-16 15:08:49 +02004133static void alc269_quanta_automute(struct hda_codec *codec)
4134{
Takashi Iwai08c189f2012-12-19 15:22:24 +01004135 snd_hda_gen_update_outputs(codec);
Takashi Iwai24519912011-08-16 15:08:49 +02004136
Takashi Iwai1687ccc2014-08-18 13:49:35 +02004137 alc_write_coef_idx(codec, 0x0c, 0x680);
4138 alc_write_coef_idx(codec, 0x0c, 0x480);
Takashi Iwai24519912011-08-16 15:08:49 +02004139}
4140
4141static void alc269_fixup_quanta_mute(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01004142 const struct hda_fixup *fix, int action)
Takashi Iwai24519912011-08-16 15:08:49 +02004143{
4144 struct alc_spec *spec = codec->spec;
Takashi Iwai1727a772013-01-10 09:52:52 +01004145 if (action != HDA_FIXUP_ACT_PROBE)
Takashi Iwai24519912011-08-16 15:08:49 +02004146 return;
Takashi Iwai08c189f2012-12-19 15:22:24 +01004147 spec->gen.automute_hook = alc269_quanta_automute;
Takashi Iwai24519912011-08-16 15:08:49 +02004148}
4149
David Henningssond240d1d2013-04-15 12:50:02 +02004150static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02004151 struct hda_jack_callback *jack)
David Henningssond240d1d2013-04-15 12:50:02 +02004152{
4153 struct alc_spec *spec = codec->spec;
4154 int vref;
4155 msleep(200);
4156 snd_hda_gen_hp_automute(codec, jack);
4157
4158 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
4159 msleep(100);
4160 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4161 vref);
4162 msleep(500);
4163 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4164 vref);
4165}
4166
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02004167/*
4168 * Magic sequence to make Huawei Matebook X right speaker working (bko#197801)
4169 */
4170struct hda_alc298_mbxinit {
4171 unsigned char value_0x23;
4172 unsigned char value_0x25;
4173};
4174
4175static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4176 const struct hda_alc298_mbxinit *initval,
4177 bool first)
4178{
4179 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4180 alc_write_coef_idx(codec, 0x26, 0xb000);
4181
4182 if (first)
4183 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4184
4185 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4186 alc_write_coef_idx(codec, 0x26, 0xf000);
4187 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4188
4189 if (initval->value_0x23 != 0x1e)
4190 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4191
4192 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4193 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4194}
4195
4196static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4197 const struct hda_fixup *fix,
4198 int action)
4199{
4200 /* Initialization magic */
4201 static const struct hda_alc298_mbxinit dac_init[] = {
4202 {0x0c, 0x00}, {0x0d, 0x00}, {0x0e, 0x00}, {0x0f, 0x00},
4203 {0x10, 0x00}, {0x1a, 0x40}, {0x1b, 0x82}, {0x1c, 0x00},
4204 {0x1d, 0x00}, {0x1e, 0x00}, {0x1f, 0x00},
4205 {0x20, 0xc2}, {0x21, 0xc8}, {0x22, 0x26}, {0x23, 0x24},
4206 {0x27, 0xff}, {0x28, 0xff}, {0x29, 0xff}, {0x2a, 0x8f},
4207 {0x2b, 0x02}, {0x2c, 0x48}, {0x2d, 0x34}, {0x2e, 0x00},
4208 {0x2f, 0x00},
4209 {0x30, 0x00}, {0x31, 0x00}, {0x32, 0x00}, {0x33, 0x00},
4210 {0x34, 0x00}, {0x35, 0x01}, {0x36, 0x93}, {0x37, 0x0c},
4211 {0x38, 0x00}, {0x39, 0x00}, {0x3a, 0xf8}, {0x38, 0x80},
4212 {}
4213 };
4214 const struct hda_alc298_mbxinit *seq;
4215
4216 if (action != HDA_FIXUP_ACT_INIT)
4217 return;
4218
4219 /* Start */
4220 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4221 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4222 alc_write_coef_idx(codec, 0x26, 0xf000);
4223 alc_write_coef_idx(codec, 0x22, 0x31);
4224 alc_write_coef_idx(codec, 0x23, 0x0b);
4225 alc_write_coef_idx(codec, 0x25, 0x00);
4226 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4227 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4228
4229 for (seq = dac_init; seq->value_0x23; seq++)
4230 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4231}
4232
David Henningssond240d1d2013-04-15 12:50:02 +02004233static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4234 const struct hda_fixup *fix, int action)
4235{
4236 struct alc_spec *spec = codec->spec;
4237 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4238 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
4239 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook;
4240 }
4241}
4242
Takashi Iwai766538a2020-06-18 13:08:41 +02004243static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4244 bool polarity, bool on)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004245{
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004246 unsigned int pinval;
4247
Takashi Iwai766538a2020-06-18 13:08:41 +02004248 if (!pin)
4249 return;
4250 if (polarity)
4251 on = !on;
4252 pinval = snd_hda_codec_get_pin_target(codec, pin);
Takashi Iwai415d5552014-04-03 11:51:21 +02004253 pinval &= ~AC_PINCTL_VREFEN;
Takashi Iwai766538a2020-06-18 13:08:41 +02004254 pinval |= on ? AC_PINCTL_VREF_80 : AC_PINCTL_VREF_HIZ;
4255 /* temporarily power up/down for setting VREF */
4256 snd_hda_power_up_pm(codec);
4257 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4258 snd_hda_power_down_pm(codec);
4259}
Takashi Iwai1d045db2011-07-07 18:23:21 +02004260
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004261/* update mute-LED according to the speaker mute state via mic VREF pin */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004262static int vref_mute_led_set(struct led_classdev *led_cdev,
4263 enum led_brightness brightness)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004264{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004265 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004266 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004267
Takashi Iwai766538a2020-06-18 13:08:41 +02004268 alc_update_vref_led(codec, spec->mute_led_nid,
4269 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004270 return 0;
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004271}
4272
David Henningssond5b6b652013-11-06 10:50:44 +01004273/* Make sure the led works even in runtime suspend */
4274static unsigned int led_power_filter(struct hda_codec *codec,
4275 hda_nid_t nid,
4276 unsigned int power_state)
4277{
4278 struct alc_spec *spec = codec->spec;
4279
Hui Wang50dd9052014-07-08 17:56:15 +08004280 if (power_state != AC_PWRST_D3 || nid == 0 ||
4281 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid))
David Henningssond5b6b652013-11-06 10:50:44 +01004282 return power_state;
4283
4284 /* Set pin ctl again, it might have just been set to 0 */
4285 snd_hda_set_pin_ctl(codec, nid,
4286 snd_hda_codec_get_pin_target(codec, nid));
4287
Takashi Iwaicffd3962015-04-09 10:30:25 +02004288 return snd_hda_gen_path_power_filter(codec, nid, power_state);
David Henningssond5b6b652013-11-06 10:50:44 +01004289}
4290
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004291static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4292 const struct hda_fixup *fix, int action)
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004293{
4294 struct alc_spec *spec = codec->spec;
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004295 const struct dmi_device *dev = NULL;
4296
4297 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4298 return;
4299
4300 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
4301 int pol, pin;
4302 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2)
4303 continue;
4304 if (pin < 0x0a || pin >= 0x10)
4305 break;
4306 spec->mute_led_polarity = pol;
4307 spec->mute_led_nid = pin - 0x0a + 0x18;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004308 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004309 codec->power_filter = led_power_filter;
Takashi Iwai4e76a882014-02-25 12:21:03 +01004310 codec_dbg(codec,
4311 "Detected mute LED for %x:%d\n", spec->mute_led_nid,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004312 spec->mute_led_polarity);
David Henningsson6d3cd5d2013-01-07 12:03:47 +01004313 break;
4314 }
4315}
4316
Takashi Iwai85c467d2018-05-29 11:38:38 +02004317static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4318 const struct hda_fixup *fix,
4319 int action, hda_nid_t pin)
David Henningssond06ac142013-02-18 11:41:55 +01004320{
4321 struct alc_spec *spec = codec->spec;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004322
David Henningssond06ac142013-02-18 11:41:55 +01004323 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4324 spec->mute_led_polarity = 0;
Takashi Iwai85c467d2018-05-29 11:38:38 +02004325 spec->mute_led_nid = pin;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004326 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
David Henningssond5b6b652013-11-06 10:50:44 +01004327 codec->power_filter = led_power_filter;
David Henningssond06ac142013-02-18 11:41:55 +01004328 }
4329}
4330
Takashi Iwai85c467d2018-05-29 11:38:38 +02004331static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4332 const struct hda_fixup *fix, int action)
4333{
4334 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4335}
4336
Takashi Iwai08fb0d02013-01-10 17:33:58 +01004337static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4338 const struct hda_fixup *fix, int action)
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004339{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004340 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
Takashi Iwai420b0fe2012-03-12 12:35:27 +01004341}
4342
Tom Briden7f783bd2017-03-25 10:12:01 +00004343static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4344 const struct hda_fixup *fix, int action)
4345{
Takashi Iwai85c467d2018-05-29 11:38:38 +02004346 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
Tom Briden7f783bd2017-03-25 10:12:01 +00004347}
4348
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004349/* update LED status via GPIO */
4350static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004351 int polarity, bool enabled)
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004352{
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004353 if (polarity)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004354 enabled = !enabled;
Takashi Iwaid261eec2018-06-19 22:32:29 +02004355 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004356}
4357
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004358/* turn on/off mute LED via GPIO per vmaster hook */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004359static int gpio_mute_led_set(struct led_classdev *led_cdev,
4360 enum led_brightness brightness)
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004361{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004362 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004363 struct alc_spec *spec = codec->spec;
4364
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08004365 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004366 spec->mute_led_polarity, !brightness);
4367 return 0;
Takashi Iwai0f32fd192014-11-19 12:16:14 +01004368}
4369
4370/* turn on/off mic-mute LED via GPIO per capture hook */
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004371static int micmute_led_set(struct led_classdev *led_cdev,
4372 enum led_brightness brightness)
4373{
4374 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4375 struct alc_spec *spec = codec->spec;
4376
4377 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
Hui Wang40469062020-08-11 20:24:30 +08004378 spec->micmute_led_polarity, !brightness);
Kai-Heng Feng87dc3642020-04-30 21:52:07 +08004379 return 0;
4380}
4381
Takashi Iwai01e4a272018-06-19 22:47:30 +02004382/* setup mute and mic-mute GPIO bits, add hooks appropriately */
4383static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4384 int action,
4385 unsigned int mute_mask,
4386 unsigned int micmute_mask)
4387{
4388 struct alc_spec *spec = codec->spec;
4389
4390 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4391
4392 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4393 return;
4394 if (mute_mask) {
4395 spec->gpio_mute_led_mask = mute_mask;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004396 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004397 }
4398 if (micmute_mask) {
4399 spec->gpio_mic_led_mask = micmute_mask;
Takashi Iwai7cdf8c42020-06-18 13:08:31 +02004400 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
Takashi Iwai01e4a272018-06-19 22:47:30 +02004401 }
4402}
4403
Jeremy Szue7d66cf2021-03-16 15:46:24 +08004404static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4405 const struct hda_fixup *fix, int action)
4406{
4407 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4408}
4409
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004410static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4411 const struct hda_fixup *fix, int action)
4412{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004413 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01004414}
4415
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004416static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4417 const struct hda_fixup *fix, int action)
4418{
Kai-Heng Feng3e0650a2020-04-30 16:32:52 +08004419 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08004420}
4421
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08004422static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4423 const struct hda_fixup *fix, int action)
4424{
Takashi Iwai01e4a272018-06-19 22:47:30 +02004425 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
Takashi Iwai1d045db2011-07-07 18:23:21 +02004426}
4427
Kailang Yanga0ccbc52020-11-06 15:20:38 +08004428static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4429 const struct hda_fixup *fix, int action)
4430{
4431 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4432}
4433
Johnathon Clark5fc462c2021-10-20 14:12:51 +01004434static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4435 const struct hda_fixup *fix, int action)
4436{
4437 struct alc_spec *spec = codec->spec;
4438
4439 if (action == HDA_FIXUP_ACT_PRE_PROBE)
4440 spec->micmute_led_polarity = 1;
4441 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4442}
4443
Takashi Iwai8a503552020-06-18 13:08:32 +02004444/* turn on/off mic-mute LED per capture hook via VREF change */
4445static int vref_micmute_led_set(struct led_classdev *led_cdev,
4446 enum led_brightness brightness)
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004447{
Takashi Iwai8a503552020-06-18 13:08:32 +02004448 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004449 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004450
Takashi Iwai766538a2020-06-18 13:08:41 +02004451 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4452 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004453 return 0;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004454}
4455
4456static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4457 const struct hda_fixup *fix, int action)
4458{
4459 struct alc_spec *spec = codec->spec;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004460
Takashi Iwai01e4a272018-06-19 22:47:30 +02004461 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004462 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02004463 /* Like hp_gpio_mic1_led, but also needs GPIO4 low to
4464 * enable headphone amp
4465 */
4466 spec->gpio_mask |= 0x10;
4467 spec->gpio_dir |= 0x10;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004468 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004469 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Hui Wang50dd9052014-07-08 17:56:15 +08004470 codec->power_filter = led_power_filter;
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004471 }
4472}
4473
David Henningsson7a5255f2014-10-30 08:26:01 +01004474static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4475 const struct hda_fixup *fix, int action)
4476{
David Henningsson7a5255f2014-10-30 08:26:01 +01004477 struct alc_spec *spec = codec->spec;
David Henningsson7a5255f2014-10-30 08:26:01 +01004478
Takashi Iwai01e4a272018-06-19 22:47:30 +02004479 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
David Henningsson7a5255f2014-10-30 08:26:01 +01004480 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson7a5255f2014-10-30 08:26:01 +01004481 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004482 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
David Henningsson7a5255f2014-10-30 08:26:01 +01004483 codec->power_filter = led_power_filter;
4484 }
4485}
4486
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01004487/* HP Spectre x360 14 model needs a unique workaround for enabling the amp;
4488 * it needs to toggle the GPIO0 once on and off at each time (bko#210633)
4489 */
4490static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4491 const struct hda_fixup *fix, int action)
4492{
4493 struct alc_spec *spec = codec->spec;
4494
4495 switch (action) {
4496 case HDA_FIXUP_ACT_PRE_PROBE:
4497 spec->gpio_mask |= 0x01;
4498 spec->gpio_dir |= 0x01;
4499 break;
4500 case HDA_FIXUP_ACT_INIT:
4501 /* need to toggle GPIO to enable the amp */
4502 alc_update_gpio_data(codec, 0x01, true);
4503 msleep(100);
4504 alc_update_gpio_data(codec, 0x01, false);
4505 break;
4506 }
4507}
4508
Takashi Iwai622464c2021-05-04 11:18:02 +02004509/* toggle GPIO2 at each time stream is started; we use PREPARE state instead */
4510static void alc274_hp_envy_pcm_hook(struct hda_pcm_stream *hinfo,
4511 struct hda_codec *codec,
4512 struct snd_pcm_substream *substream,
4513 int action)
4514{
4515 switch (action) {
4516 case HDA_GEN_PCM_ACT_PREPARE:
4517 alc_update_gpio_data(codec, 0x04, true);
4518 break;
4519 case HDA_GEN_PCM_ACT_CLEANUP:
4520 alc_update_gpio_data(codec, 0x04, false);
4521 break;
4522 }
4523}
4524
4525static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4526 const struct hda_fixup *fix,
4527 int action)
4528{
4529 struct alc_spec *spec = codec->spec;
4530
4531 if (action == HDA_FIXUP_ACT_PROBE) {
4532 spec->gpio_mask |= 0x04;
4533 spec->gpio_dir |= 0x04;
4534 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook;
4535 }
4536}
4537
Takashi Iwai766538a2020-06-18 13:08:41 +02004538static void alc_update_coef_led(struct hda_codec *codec,
4539 struct alc_coef_led *led,
4540 bool polarity, bool on)
Kailang Yang431e76c2020-04-07 14:40:20 +08004541{
Takashi Iwai766538a2020-06-18 13:08:41 +02004542 if (polarity)
4543 on = !on;
4544 /* temporarily power up/down for setting COEF bit */
4545 alc_update_coef_idx(codec, led->idx, led->mask,
4546 on ? led->on : led->off);
4547}
4548
Kailang Yang431e76c2020-04-07 14:40:20 +08004549/* update mute-LED according to the speaker mute state via COEF bit */
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004550static int coef_mute_led_set(struct led_classdev *led_cdev,
4551 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004552{
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004553 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004554 struct alc_spec *spec = codec->spec;
4555
Takashi Iwai766538a2020-06-18 13:08:41 +02004556 alc_update_coef_led(codec, &spec->mute_led_coef,
4557 spec->mute_led_polarity, brightness);
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004558 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004559}
4560
4561static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4562 const struct hda_fixup *fix,
4563 int action)
4564{
4565 struct alc_spec *spec = codec->spec;
4566
4567 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4568 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004569 spec->mute_led_coef.idx = 0x0b;
4570 spec->mute_led_coef.mask = 1 << 3;
4571 spec->mute_led_coef.on = 1 << 3;
4572 spec->mute_led_coef.off = 0;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004573 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004574 }
4575}
4576
Kailang Yang24164f42020-04-07 14:52:42 +08004577static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4578 const struct hda_fixup *fix,
4579 int action)
4580{
4581 struct alc_spec *spec = codec->spec;
4582
4583 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4584 spec->mute_led_polarity = 0;
Takashi Iwai766538a2020-06-18 13:08:41 +02004585 spec->mute_led_coef.idx = 0x34;
4586 spec->mute_led_coef.mask = 1 << 5;
4587 spec->mute_led_coef.on = 0;
4588 spec->mute_led_coef.off = 1 << 5;
Takashi Iwai8d3d1ec2020-06-18 13:08:38 +02004589 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004590 }
4591}
4592
Kailang Yang431e76c2020-04-07 14:40:20 +08004593/* turn on/off mic-mute LED per capture hook by coef bit */
Takashi Iwai8a503552020-06-18 13:08:32 +02004594static int coef_micmute_led_set(struct led_classdev *led_cdev,
4595 enum led_brightness brightness)
Kailang Yang431e76c2020-04-07 14:40:20 +08004596{
Takashi Iwai8a503552020-06-18 13:08:32 +02004597 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
Kailang Yang431e76c2020-04-07 14:40:20 +08004598 struct alc_spec *spec = codec->spec;
4599
Takashi Iwai766538a2020-06-18 13:08:41 +02004600 alc_update_coef_led(codec, &spec->mic_led_coef,
4601 spec->micmute_led_polarity, brightness);
Takashi Iwai8a503552020-06-18 13:08:32 +02004602 return 0;
Kailang Yang431e76c2020-04-07 14:40:20 +08004603}
4604
4605static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4606 const struct hda_fixup *fix, int action)
4607{
4608 struct alc_spec *spec = codec->spec;
4609
4610 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004611 spec->mic_led_coef.idx = 0x19;
4612 spec->mic_led_coef.mask = 1 << 13;
4613 spec->mic_led_coef.on = 1 << 13;
4614 spec->mic_led_coef.off = 0;
Takashi Iwai8a503552020-06-18 13:08:32 +02004615 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang431e76c2020-04-07 14:40:20 +08004616 }
4617}
4618
Kailang Yang24164f42020-04-07 14:52:42 +08004619static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4620 const struct hda_fixup *fix, int action)
4621{
4622 struct alc_spec *spec = codec->spec;
4623
4624 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai766538a2020-06-18 13:08:41 +02004625 spec->mic_led_coef.idx = 0x35;
4626 spec->mic_led_coef.mask = 3 << 2;
4627 spec->mic_led_coef.on = 2 << 2;
4628 spec->mic_led_coef.off = 1 << 2;
Takashi Iwai8a503552020-06-18 13:08:32 +02004629 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
Kailang Yang24164f42020-04-07 14:52:42 +08004630 }
4631}
4632
Kailang Yang431e76c2020-04-07 14:40:20 +08004633static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4634 const struct hda_fixup *fix, int action)
4635{
4636 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4637 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4638}
4639
Kailang Yang24164f42020-04-07 14:52:42 +08004640static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4641 const struct hda_fixup *fix, int action)
4642{
4643 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4644 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4645}
4646
Jonas Witschel75b62ab2021-04-16 12:58:54 +02004647static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4648 const struct hda_fixup *fix, int action)
4649{
4650 struct alc_spec *spec = codec->spec;
4651
4652 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4653 spec->cap_mute_led_nid = 0x1a;
4654 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4655 codec->power_filter = led_power_filter;
4656 }
4657}
4658
4659static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4660 const struct hda_fixup *fix, int action)
4661{
4662 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4663 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4664}
4665
Takashi Iwai6a30aba2018-04-27 17:17:35 +02004666#if IS_REACHABLE(CONFIG_INPUT)
David Henningsson33f4acd2015-01-07 15:50:13 +01004667static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4668 struct hda_jack_callback *event)
4669{
4670 struct alc_spec *spec = codec->spec;
4671
4672 /* GPIO2 just toggles on a keypress/keyrelease cycle. Therefore
4673 send both key on and key off event for every interrupt. */
Hui Wangc7b60a82015-12-28 11:35:25 +08004674 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1);
David Henningsson33f4acd2015-01-07 15:50:13 +01004675 input_sync(spec->kb_dev);
Hui Wangc7b60a82015-12-28 11:35:25 +08004676 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0);
David Henningsson33f4acd2015-01-07 15:50:13 +01004677 input_sync(spec->kb_dev);
4678}
David Henningsson33f4acd2015-01-07 15:50:13 +01004679
Kailang3694cb22015-12-28 11:35:24 +08004680static int alc_register_micmute_input_device(struct hda_codec *codec)
4681{
4682 struct alc_spec *spec = codec->spec;
Hui Wangc7b60a82015-12-28 11:35:25 +08004683 int i;
Kailang3694cb22015-12-28 11:35:24 +08004684
4685 spec->kb_dev = input_allocate_device();
4686 if (!spec->kb_dev) {
4687 codec_err(codec, "Out of memory (input_allocate_device)\n");
4688 return -ENOMEM;
4689 }
Hui Wangc7b60a82015-12-28 11:35:25 +08004690
4691 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE;
4692
Kailang3694cb22015-12-28 11:35:24 +08004693 spec->kb_dev->name = "Microphone Mute Button";
4694 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY);
Hui Wangc7b60a82015-12-28 11:35:25 +08004695 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]);
4696 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map);
4697 spec->kb_dev->keycode = spec->alc_mute_keycode_map;
4698 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++)
4699 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit);
Kailang3694cb22015-12-28 11:35:24 +08004700
4701 if (input_register_device(spec->kb_dev)) {
4702 codec_err(codec, "input_register_device failed\n");
4703 input_free_device(spec->kb_dev);
4704 spec->kb_dev = NULL;
4705 return -ENOMEM;
4706 }
4707
4708 return 0;
4709}
4710
Takashi Iwai01e4a272018-06-19 22:47:30 +02004711/* GPIO1 = set according to SKU external amp
4712 * GPIO2 = mic mute hotkey
4713 * GPIO3 = mute LED
4714 * GPIO4 = mic mute LED
4715 */
David Henningsson33f4acd2015-01-07 15:50:13 +01004716static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4717 const struct hda_fixup *fix, int action)
4718{
David Henningsson33f4acd2015-01-07 15:50:13 +01004719 struct alc_spec *spec = codec->spec;
4720
Takashi Iwai01e4a272018-06-19 22:47:30 +02004721 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
David Henningsson33f4acd2015-01-07 15:50:13 +01004722 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004723 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004724 if (alc_register_micmute_input_device(codec) != 0)
David Henningsson33f4acd2015-01-07 15:50:13 +01004725 return;
David Henningsson33f4acd2015-01-07 15:50:13 +01004726
Takashi Iwai01e4a272018-06-19 22:47:30 +02004727 spec->gpio_mask |= 0x06;
4728 spec->gpio_dir |= 0x02;
4729 spec->gpio_data |= 0x02;
Takashi Iwai7639a062015-03-03 10:07:24 +01004730 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
David Henningsson33f4acd2015-01-07 15:50:13 +01004731 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x04);
Takashi Iwai7639a062015-03-03 10:07:24 +01004732 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
David Henningsson33f4acd2015-01-07 15:50:13 +01004733 gpio2_mic_hotkey_event);
David Henningsson33f4acd2015-01-07 15:50:13 +01004734 return;
4735 }
4736
4737 if (!spec->kb_dev)
4738 return;
4739
4740 switch (action) {
David Henningsson33f4acd2015-01-07 15:50:13 +01004741 case HDA_FIXUP_ACT_FREE:
4742 input_unregister_device(spec->kb_dev);
David Henningsson33f4acd2015-01-07 15:50:13 +01004743 spec->kb_dev = NULL;
4744 }
David Henningsson33f4acd2015-01-07 15:50:13 +01004745}
4746
Takashi Iwai01e4a272018-06-19 22:47:30 +02004747/* Line2 = mic mute hotkey
4748 * GPIO2 = mic mute LED
4749 */
Kailang3694cb22015-12-28 11:35:24 +08004750static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4751 const struct hda_fixup *fix, int action)
4752{
Kailang3694cb22015-12-28 11:35:24 +08004753 struct alc_spec *spec = codec->spec;
4754
Takashi Iwai01e4a272018-06-19 22:47:30 +02004755 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
Kailang3694cb22015-12-28 11:35:24 +08004756 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai1c76aa52018-06-21 16:37:54 +02004757 spec->init_amp = ALC_INIT_DEFAULT;
Kailang3694cb22015-12-28 11:35:24 +08004758 if (alc_register_micmute_input_device(codec) != 0)
4759 return;
4760
Kailang3694cb22015-12-28 11:35:24 +08004761 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4762 gpio2_mic_hotkey_event);
Kailang3694cb22015-12-28 11:35:24 +08004763 return;
4764 }
4765
4766 if (!spec->kb_dev)
4767 return;
4768
4769 switch (action) {
Kailang3694cb22015-12-28 11:35:24 +08004770 case HDA_FIXUP_ACT_FREE:
4771 input_unregister_device(spec->kb_dev);
4772 spec->kb_dev = NULL;
4773 }
4774}
Takashi Iwaic4696522018-01-15 10:44:35 +01004775#else /* INPUT */
4776#define alc280_fixup_hp_gpio2_mic_hotkey NULL
4777#define alc233_fixup_lenovo_line2_mic_hotkey NULL
4778#endif /* INPUT */
Kailang3694cb22015-12-28 11:35:24 +08004779
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004780static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4781 const struct hda_fixup *fix, int action)
4782{
4783 struct alc_spec *spec = codec->spec;
4784
Takashi Iwai1bce62a2018-06-19 23:15:59 +02004785 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004786 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004787 spec->cap_mute_led_nid = 0x18;
Takashi Iwai8a503552020-06-18 13:08:32 +02004788 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08004789 }
4790}
4791
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004792static const struct coef_fw alc225_pre_hsmode[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004793 UPDATE_COEF(0x4a, 1<<8, 0),
4794 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4795 UPDATE_COEF(0x63, 3<<14, 3<<14),
4796 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4797 UPDATE_COEF(0x4a, 3<<10, 3<<10),
4798 UPDATE_COEF(0x45, 0x3f<<10, 0x34<<10),
4799 UPDATE_COEF(0x4a, 3<<10, 0),
4800 {}
4801};
4802
David Henningsson73bdd592013-04-15 15:44:14 +02004803static void alc_headset_mode_unplugged(struct hda_codec *codec)
4804{
Kailang Yang92666d42020-11-19 17:04:21 +08004805 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004806 static const struct coef_fw coef0255[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004807 WRITE_COEF(0x1b, 0x0c0b), /* LDO and MISC control */
Takashi Iwai54db6c32014-08-18 15:11:19 +02004808 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4809 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
4810 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4811 WRITE_COEFEX(0x57, 0x03, 0x8aa6), /* Direct Drive HP Amp control */
4812 {}
4813 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004814 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08004815 WRITE_COEF(0x1b, 0x0c4b), /* LDO and MISC control */
Kailang Yang717f43d2019-05-31 17:16:53 +08004816 WRITE_COEF(0x45, 0xd089), /* UAJ function set to menual mode */
4817 WRITE_COEF(0x06, 0x6104), /* Set MIC2 Vref gate with HP */
4818 WRITE_COEFEX(0x57, 0x03, 0x09a3), /* Direct Drive HP Amp control */
4819 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
Kailang Yange69e7e02016-05-30 15:58:28 +08004820 {}
4821 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004822 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004823 WRITE_COEF(0x1b, 0x0c0b),
4824 WRITE_COEF(0x45, 0xc429),
4825 UPDATE_COEF(0x35, 0x4000, 0),
4826 WRITE_COEF(0x06, 0x2104),
4827 WRITE_COEF(0x1a, 0x0001),
4828 WRITE_COEF(0x26, 0x0004),
4829 WRITE_COEF(0x32, 0x42a3),
4830 {}
4831 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004832 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08004833 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4834 UPDATE_COEF(0x50, 0x2000, 0x2000),
4835 UPDATE_COEF(0x56, 0x0006, 0x0006),
4836 UPDATE_COEF(0x66, 0x0008, 0),
4837 UPDATE_COEF(0x67, 0x2000, 0),
4838 {}
4839 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004840 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004841 UPDATE_COEF(0x19, 0x1300, 0x0300),
4842 {}
4843 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004844 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004845 WRITE_COEF(0x76, 0x000e),
4846 WRITE_COEF(0x6c, 0x2400),
4847 WRITE_COEF(0x18, 0x7308),
4848 WRITE_COEF(0x6b, 0xc429),
4849 {}
4850 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004851 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004852 UPDATE_COEF(0x10, 7<<8, 6<<8), /* SET Line1 JD to 0 */
4853 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */
4854 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */
4855 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */
4856 WRITE_COEF(0x45, 0xc429), /* Set to TRS type */
4857 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
4858 {}
4859 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004860 static const struct coef_fw coef0668[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004861 WRITE_COEF(0x15, 0x0d40),
4862 WRITE_COEF(0xb7, 0x802b),
4863 {}
4864 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004865 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08004866 UPDATE_COEF(0x63, 3<<14, 0),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004867 {}
4868 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004869 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004870 UPDATE_COEF(0x4a, 0x0100, 0),
4871 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0),
4872 UPDATE_COEF(0x6b, 0xf000, 0x5000),
4873 UPDATE_COEF(0x4a, 0x0010, 0),
4874 UPDATE_COEF(0x4a, 0x0c00, 0x0c00),
4875 WRITE_COEF(0x45, 0x5289),
4876 UPDATE_COEF(0x4a, 0x0c00, 0),
4877 {}
4878 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004879
Kailang Yang92666d42020-11-19 17:04:21 +08004880 if (spec->no_internal_mic_pin) {
4881 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4882 return;
4883 }
4884
Takashi Iwai7639a062015-03-03 10:07:24 +01004885 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004886 case 0x10ec0255:
Kailang Yange69e7e02016-05-30 15:58:28 +08004887 alc_process_coef_fw(codec, coef0255);
4888 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02004889 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08004890 case 0x10ec0236:
Kailang Yang7081adf2015-03-30 17:05:37 +08004891 case 0x10ec0256:
Kailang Yange69e7e02016-05-30 15:58:28 +08004892 alc_process_coef_fw(codec, coef0256);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004893 break;
Kailang Yang71683c32017-06-20 16:33:50 +08004894 case 0x10ec0234:
4895 case 0x10ec0274:
4896 case 0x10ec0294:
4897 alc_process_coef_fw(codec, coef0274);
4898 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08004899 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02004900 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004901 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02004902 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08004903 case 0x10ec0286:
4904 case 0x10ec0288:
Kailang Yang89542932017-07-17 15:03:43 +08004905 alc_process_coef_fw(codec, coef0288);
4906 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08004907 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08004908 alc_process_coef_fw(codec, coef0298);
Kailang Yangf3b70332015-04-08 15:01:17 +08004909 alc_process_coef_fw(codec, coef0288);
4910 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004911 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004912 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02004913 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08004914 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004915 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08004916 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004917 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02004918 alc_process_coef_fw(codec, coef0668);
David Henningsson73bdd592013-04-15 15:44:14 +02004919 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08004920 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004921 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004922 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08004923 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08004924 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08004925 case 0x10ec0299:
Kailang Yang4d4b0c52019-01-09 16:23:37 +08004926 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004927 alc_process_coef_fw(codec, coef0225);
4928 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08004929 case 0x10ec0867:
4930 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4931 break;
David Henningsson73bdd592013-04-15 15:44:14 +02004932 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01004933 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02004934}
4935
4936
4937static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
4938 hda_nid_t mic_pin)
4939{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004940 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004941 WRITE_COEFEX(0x57, 0x03, 0x8aa6),
4942 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4943 {}
4944 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004945 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08004946 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/
4947 WRITE_COEFEX(0x57, 0x03, 0x09a3),
4948 WRITE_COEF(0x06, 0x6100), /* Set MIC2 Vref gate to normal */
4949 {}
4950 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004951 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004952 UPDATE_COEF(0x35, 0, 1<<14),
4953 WRITE_COEF(0x06, 0x2100),
4954 WRITE_COEF(0x1a, 0x0021),
4955 WRITE_COEF(0x26, 0x008c),
4956 {}
4957 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004958 static const struct coef_fw coef0288[] = {
Kailang Yang89542932017-07-17 15:03:43 +08004959 UPDATE_COEF(0x4f, 0x00c0, 0),
Kailang Yangf3b70332015-04-08 15:01:17 +08004960 UPDATE_COEF(0x50, 0x2000, 0),
4961 UPDATE_COEF(0x56, 0x0006, 0),
4962 UPDATE_COEF(0x4f, 0xfcc0, 0xc400),
4963 UPDATE_COEF(0x66, 0x0008, 0x0008),
4964 UPDATE_COEF(0x67, 0x2000, 0x2000),
4965 {}
4966 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004967 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004968 WRITE_COEF(0x19, 0xa208),
4969 WRITE_COEF(0x2e, 0xacf0),
4970 {}
4971 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004972 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004973 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */
4974 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */
4975 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
4976 {}
4977 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004978 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02004979 WRITE_COEF(0xb7, 0x802b),
4980 WRITE_COEF(0xb5, 0x1040),
4981 UPDATE_COEF(0xc3, 0, 1<<12),
4982 {}
4983 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004984 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08004985 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14),
4986 UPDATE_COEF(0x4a, 3<<4, 2<<4),
4987 UPDATE_COEF(0x63, 3<<14, 0),
4988 {}
4989 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01004990 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08004991 UPDATE_COEFEX(0x57, 0x05, 0x4000, 0x4000),
4992 UPDATE_COEF(0x4a, 0x0010, 0),
4993 UPDATE_COEF(0x6b, 0xf000, 0),
4994 {}
4995 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02004996
Takashi Iwai7639a062015-03-03 10:07:24 +01004997 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08004998 case 0x10ec0255:
4999 alc_write_coef_idx(codec, 0x45, 0xc489);
5000 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005001 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005002 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5003 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005004 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005005 case 0x10ec0236:
5006 case 0x10ec0256:
5007 alc_write_coef_idx(codec, 0x45, 0xc489);
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5009 alc_process_coef_fw(codec, coef0256);
5010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5011 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005012 case 0x10ec0234:
5013 case 0x10ec0274:
5014 case 0x10ec0294:
5015 alc_write_coef_idx(codec, 0x45, 0x4689);
5016 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5017 alc_process_coef_fw(codec, coef0274);
5018 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5019 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005020 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005021 case 0x10ec0283:
5022 alc_write_coef_idx(codec, 0x45, 0xc429);
5023 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005024 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005025 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5026 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005027 case 0x10ec0286:
5028 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005029 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005030 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5031 alc_process_coef_fw(codec, coef0288);
5032 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5033 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005034 case 0x10ec0292:
5035 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005036 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005037 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005038 case 0x10ec0293:
5039 /* Set to TRS mode */
5040 alc_write_coef_idx(codec, 0x45, 0xc429);
5041 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005042 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005043 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5044 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005045 case 0x10ec0867:
5046 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
Gustavo A. R. Silvac0dbbda2020-07-08 15:32:36 -05005047 fallthrough;
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08005048 case 0x10ec0221:
David Henningsson1f8b46c2015-05-12 14:38:15 +02005049 case 0x10ec0662:
5050 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5051 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5052 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005053 case 0x10ec0668:
5054 alc_write_coef_idx(codec, 0x11, 0x0001);
5055 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
Takashi Iwai54db6c32014-08-18 15:11:19 +02005056 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005057 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5058 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005059 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005060 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005061 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005062 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005063 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005064 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005065 alc_process_coef_fw(codec, alc225_pre_hsmode);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005066 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5067 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5068 alc_process_coef_fw(codec, coef0225);
5069 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5070 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005071 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005072 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005073}
5074
5075static void alc_headset_mode_default(struct hda_codec *codec)
5076{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005077 static const struct coef_fw coef0225[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005078 UPDATE_COEF(0x45, 0x3f<<10, 0x30<<10),
5079 UPDATE_COEF(0x45, 0x3f<<10, 0x31<<10),
5080 UPDATE_COEF(0x49, 3<<8, 0<<8),
5081 UPDATE_COEF(0x4a, 3<<4, 3<<4),
5082 UPDATE_COEF(0x63, 3<<14, 0),
5083 UPDATE_COEF(0x67, 0xf000, 0x3000),
David Henningsson2ae95572016-02-25 09:37:05 +01005084 {}
5085 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005086 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005087 WRITE_COEF(0x45, 0xc089),
5088 WRITE_COEF(0x45, 0xc489),
5089 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5090 WRITE_COEF(0x49, 0x0049),
5091 {}
5092 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005093 static const struct coef_fw coef0256[] = {
Kailang Yang717f43d2019-05-31 17:16:53 +08005094 WRITE_COEF(0x45, 0xc489),
5095 WRITE_COEFEX(0x57, 0x03, 0x0da3),
5096 WRITE_COEF(0x49, 0x0049),
5097 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/
5098 WRITE_COEF(0x06, 0x6100),
5099 {}
5100 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005101 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005102 WRITE_COEF(0x06, 0x2100),
5103 WRITE_COEF(0x32, 0x4ea3),
5104 {}
5105 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005106 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005107 UPDATE_COEF(0x4f, 0xfcc0, 0xc400), /* Set to TRS type */
5108 UPDATE_COEF(0x50, 0x2000, 0x2000),
5109 UPDATE_COEF(0x56, 0x0006, 0x0006),
5110 UPDATE_COEF(0x66, 0x0008, 0),
5111 UPDATE_COEF(0x67, 0x2000, 0),
5112 {}
5113 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005114 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005115 WRITE_COEF(0x76, 0x000e),
5116 WRITE_COEF(0x6c, 0x2400),
5117 WRITE_COEF(0x6b, 0xc429),
5118 WRITE_COEF(0x18, 0x7308),
5119 {}
5120 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005121 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005122 UPDATE_COEF(0x4a, 0x000f, 0x000e), /* Combo Jack auto detect */
5123 WRITE_COEF(0x45, 0xC429), /* Set to TRS type */
5124 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */
5125 {}
5126 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005127 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005128 WRITE_COEF(0x11, 0x0041),
5129 WRITE_COEF(0x15, 0x0d40),
5130 WRITE_COEF(0xb7, 0x802b),
5131 {}
5132 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005133 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005134 WRITE_COEF(0x45, 0x4289),
5135 UPDATE_COEF(0x4a, 0x0010, 0x0010),
5136 UPDATE_COEF(0x6b, 0x0f00, 0),
5137 UPDATE_COEF(0x49, 0x0300, 0x0300),
5138 {}
5139 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005140
Takashi Iwai7639a062015-03-03 10:07:24 +01005141 switch (codec->core.vendor_id) {
Kailang Yangc2b691e2018-01-17 15:22:55 +08005142 case 0x10ec0215:
David Henningsson2ae95572016-02-25 09:37:05 +01005143 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005144 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005145 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005146 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005147 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005148 alc_process_coef_fw(codec, alc225_pre_hsmode);
David Henningsson2ae95572016-02-25 09:37:05 +01005149 alc_process_coef_fw(codec, coef0225);
5150 break;
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005151 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005152 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005153 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005154 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005155 case 0x10ec0236:
5156 case 0x10ec0256:
5157 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5158 alc_write_coef_idx(codec, 0x45, 0xc089);
5159 msleep(50);
5160 alc_process_coef_fw(codec, coef0256);
5161 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005162 case 0x10ec0234:
5163 case 0x10ec0274:
5164 case 0x10ec0294:
5165 alc_process_coef_fw(codec, coef0274);
5166 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005167 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005168 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005169 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005170 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005171 case 0x10ec0286:
5172 case 0x10ec0288:
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005173 case 0x10ec0298:
Kailang Yangf3b70332015-04-08 15:01:17 +08005174 alc_process_coef_fw(codec, coef0288);
5175 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005176 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005177 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005178 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005179 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005180 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005181 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005182 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005183 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005184 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005185 case 0x10ec0867:
5186 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5187 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005188 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005189 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005190}
5191
5192/* Iphone type */
5193static void alc_headset_mode_ctia(struct hda_codec *codec)
5194{
Kailang Yang89542932017-07-17 15:03:43 +08005195 int val;
5196
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005197 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005198 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
5199 WRITE_COEF(0x1b, 0x0c2b),
5200 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5201 {}
5202 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005203 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005204 WRITE_COEF(0x45, 0xd489), /* Set to CTIA type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005205 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005206 {}
5207 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005208 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005209 WRITE_COEF(0x45, 0xd429),
5210 WRITE_COEF(0x1b, 0x0c2b),
5211 WRITE_COEF(0x32, 0x4ea3),
5212 {}
5213 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005214 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005215 UPDATE_COEF(0x50, 0x2000, 0x2000),
5216 UPDATE_COEF(0x56, 0x0006, 0x0006),
5217 UPDATE_COEF(0x66, 0x0008, 0),
5218 UPDATE_COEF(0x67, 0x2000, 0),
5219 {}
5220 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005221 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005222 WRITE_COEF(0x6b, 0xd429),
5223 WRITE_COEF(0x76, 0x0008),
5224 WRITE_COEF(0x18, 0x7388),
5225 {}
5226 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005227 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005228 WRITE_COEF(0x45, 0xd429), /* Set to ctia type */
5229 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5230 {}
5231 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005232 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005233 WRITE_COEF(0x11, 0x0001),
5234 WRITE_COEF(0x15, 0x0d60),
5235 WRITE_COEF(0xc3, 0x0000),
5236 {}
5237 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005238 static const struct coef_fw coef0225_1[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005239 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005240 UPDATE_COEF(0x63, 3<<14, 2<<14),
5241 {}
5242 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005243 static const struct coef_fw coef0225_2[] = {
Kailang Yang5a367672017-07-21 15:23:53 +08005244 UPDATE_COEF(0x45, 0x3f<<10, 0x35<<10),
5245 UPDATE_COEF(0x63, 3<<14, 1<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005246 {}
5247 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005248
Takashi Iwai7639a062015-03-03 10:07:24 +01005249 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005250 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005251 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005252 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005253 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005254 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005255 case 0x10ec0256:
5256 alc_process_coef_fw(codec, coef0256);
5257 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005258 case 0x10ec0234:
5259 case 0x10ec0274:
5260 case 0x10ec0294:
5261 alc_write_coef_idx(codec, 0x45, 0xd689);
5262 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005263 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005264 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005265 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005266 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005267 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005268 val = alc_read_coef_idx(codec, 0x50);
5269 if (val & (1 << 12)) {
5270 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5271 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5272 msleep(300);
5273 } else {
5274 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5275 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5276 msleep(300);
5277 }
5278 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005279 case 0x10ec0286:
5280 case 0x10ec0288:
5281 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5282 msleep(300);
5283 alc_process_coef_fw(codec, coef0288);
5284 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005285 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005286 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005287 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005288 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005289 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005290 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005291 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005292 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005293 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005294 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005295 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005296 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005297 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005298 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005299 case 0x10ec0299:
Kailang Yang5a367672017-07-21 15:23:53 +08005300 val = alc_read_coef_idx(codec, 0x45);
5301 if (val & (1 << 9))
5302 alc_process_coef_fw(codec, coef0225_2);
5303 else
5304 alc_process_coef_fw(codec, coef0225_1);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005305 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005306 case 0x10ec0867:
5307 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5308 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005309 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005310 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005311}
5312
5313/* Nokia type */
5314static void alc_headset_mode_omtp(struct hda_codec *codec)
5315{
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005316 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005317 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
5318 WRITE_COEF(0x1b, 0x0c2b),
5319 WRITE_COEFEX(0x57, 0x03, 0x8ea6),
5320 {}
5321 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005322 static const struct coef_fw coef0256[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005323 WRITE_COEF(0x45, 0xe489), /* Set to OMTP Type */
Kailang Yang717f43d2019-05-31 17:16:53 +08005324 WRITE_COEF(0x1b, 0x0e6b),
Kailang Yange69e7e02016-05-30 15:58:28 +08005325 {}
5326 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005327 static const struct coef_fw coef0233[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005328 WRITE_COEF(0x45, 0xe429),
5329 WRITE_COEF(0x1b, 0x0c2b),
5330 WRITE_COEF(0x32, 0x4ea3),
5331 {}
5332 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005333 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005334 UPDATE_COEF(0x50, 0x2000, 0x2000),
5335 UPDATE_COEF(0x56, 0x0006, 0x0006),
5336 UPDATE_COEF(0x66, 0x0008, 0),
5337 UPDATE_COEF(0x67, 0x2000, 0),
5338 {}
5339 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005340 static const struct coef_fw coef0292[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005341 WRITE_COEF(0x6b, 0xe429),
5342 WRITE_COEF(0x76, 0x0008),
5343 WRITE_COEF(0x18, 0x7388),
5344 {}
5345 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005346 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005347 WRITE_COEF(0x45, 0xe429), /* Set to omtp type */
5348 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */
5349 {}
5350 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005351 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005352 WRITE_COEF(0x11, 0x0001),
5353 WRITE_COEF(0x15, 0x0d50),
5354 WRITE_COEF(0xc3, 0x0000),
5355 {}
5356 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005357 static const struct coef_fw coef0225[] = {
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005358 UPDATE_COEF(0x45, 0x3f<<10, 0x39<<10),
Kailang Yang5a367672017-07-21 15:23:53 +08005359 UPDATE_COEF(0x63, 3<<14, 2<<14),
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005360 {}
5361 };
Takashi Iwai54db6c32014-08-18 15:11:19 +02005362
Takashi Iwai7639a062015-03-03 10:07:24 +01005363 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005364 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005365 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005366 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005367 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005368 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005369 case 0x10ec0256:
5370 alc_process_coef_fw(codec, coef0256);
5371 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005372 case 0x10ec0234:
5373 case 0x10ec0274:
5374 case 0x10ec0294:
5375 alc_write_coef_idx(codec, 0x45, 0xe689);
5376 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005377 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005378 case 0x10ec0283:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005379 alc_process_coef_fw(codec, coef0233);
David Henningsson73bdd592013-04-15 15:44:14 +02005380 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005381 case 0x10ec0298:
5382 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
Kailang Yang89542932017-07-17 15:03:43 +08005383 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5384 msleep(300);
5385 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005386 case 0x10ec0286:
5387 case 0x10ec0288:
5388 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5389 msleep(300);
5390 alc_process_coef_fw(codec, coef0288);
5391 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005392 case 0x10ec0292:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005393 alc_process_coef_fw(codec, coef0292);
David Henningsson73bdd592013-04-15 15:44:14 +02005394 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005395 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005396 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005397 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005398 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005399 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005400 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005401 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005402 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005403 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005404 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005405 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005406 case 0x10ec0299:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005407 alc_process_coef_fw(codec, coef0225);
5408 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005409 }
Takashi Iwai4e76a882014-02-25 12:21:03 +01005410 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
David Henningsson73bdd592013-04-15 15:44:14 +02005411}
5412
5413static void alc_determine_headset_type(struct hda_codec *codec)
5414{
5415 int val;
5416 bool is_ctia = false;
5417 struct alc_spec *spec = codec->spec;
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005418 static const struct coef_fw coef0255[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005419 WRITE_COEF(0x45, 0xd089), /* combo jack auto switch control(Check type)*/
5420 WRITE_COEF(0x49, 0x0149), /* combo jack auto switch control(Vref
5421 conteol) */
5422 {}
5423 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005424 static const struct coef_fw coef0288[] = {
Kailang Yangf3b70332015-04-08 15:01:17 +08005425 UPDATE_COEF(0x4f, 0xfcc0, 0xd400), /* Check Type */
5426 {}
5427 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005428 static const struct coef_fw coef0298[] = {
Kailang Yang89542932017-07-17 15:03:43 +08005429 UPDATE_COEF(0x50, 0x2000, 0x2000),
5430 UPDATE_COEF(0x56, 0x0006, 0x0006),
5431 UPDATE_COEF(0x66, 0x0008, 0),
5432 UPDATE_COEF(0x67, 0x2000, 0),
5433 UPDATE_COEF(0x19, 0x1300, 0x1300),
5434 {}
5435 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005436 static const struct coef_fw coef0293[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005437 UPDATE_COEF(0x4a, 0x000f, 0x0008), /* Combo Jack auto detect */
5438 WRITE_COEF(0x45, 0xD429), /* Set to ctia type */
5439 {}
5440 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005441 static const struct coef_fw coef0688[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005442 WRITE_COEF(0x11, 0x0001),
5443 WRITE_COEF(0xb7, 0x802b),
5444 WRITE_COEF(0x15, 0x0d60),
5445 WRITE_COEF(0xc3, 0x0c00),
5446 {}
5447 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005448 static const struct coef_fw coef0274[] = {
Kailang Yang71683c32017-06-20 16:33:50 +08005449 UPDATE_COEF(0x4a, 0x0010, 0),
5450 UPDATE_COEF(0x4a, 0x8000, 0),
5451 WRITE_COEF(0x45, 0xd289),
5452 UPDATE_COEF(0x49, 0x0300, 0x0300),
5453 {}
5454 };
David Henningsson73bdd592013-04-15 15:44:14 +02005455
Kailang Yang92666d42020-11-19 17:04:21 +08005456 if (spec->no_internal_mic_pin) {
5457 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5458 return;
5459 }
5460
Takashi Iwai7639a062015-03-03 10:07:24 +01005461 switch (codec->core.vendor_id) {
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005462 case 0x10ec0255:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005463 alc_process_coef_fw(codec, coef0255);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005464 msleep(300);
5465 val = alc_read_coef_idx(codec, 0x46);
5466 is_ctia = (val & 0x0070) == 0x0070;
5467 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005468 case 0x10ec0230:
Kailang Yang717f43d2019-05-31 17:16:53 +08005469 case 0x10ec0236:
5470 case 0x10ec0256:
5471 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5472 alc_write_coef_idx(codec, 0x06, 0x6104);
5473 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5474
5475 snd_hda_codec_write(codec, 0x21, 0,
5476 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5477 msleep(80);
5478 snd_hda_codec_write(codec, 0x21, 0,
5479 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5480
5481 alc_process_coef_fw(codec, coef0255);
5482 msleep(300);
5483 val = alc_read_coef_idx(codec, 0x46);
5484 is_ctia = (val & 0x0070) == 0x0070;
5485
5486 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5487 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5488
5489 snd_hda_codec_write(codec, 0x21, 0,
5490 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5491 msleep(80);
5492 snd_hda_codec_write(codec, 0x21, 0,
5493 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5494 break;
Kailang Yang71683c32017-06-20 16:33:50 +08005495 case 0x10ec0234:
5496 case 0x10ec0274:
5497 case 0x10ec0294:
5498 alc_process_coef_fw(codec, coef0274);
Hui Wangfebf22562021-03-20 17:15:41 +08005499 msleep(850);
Kailang Yang71683c32017-06-20 16:33:50 +08005500 val = alc_read_coef_idx(codec, 0x46);
5501 is_ctia = (val & 0x00f0) == 0x00f0;
5502 break;
Kailang Yang13fd08a2014-05-21 16:49:48 +08005503 case 0x10ec0233:
David Henningsson73bdd592013-04-15 15:44:14 +02005504 case 0x10ec0283:
5505 alc_write_coef_idx(codec, 0x45, 0xd029);
5506 msleep(300);
5507 val = alc_read_coef_idx(codec, 0x46);
5508 is_ctia = (val & 0x0070) == 0x0070;
5509 break;
Kailang Yang1a5bc8d2015-05-12 17:11:10 +08005510 case 0x10ec0298:
Kailang Yang89542932017-07-17 15:03:43 +08005511 snd_hda_codec_write(codec, 0x21, 0,
5512 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5513 msleep(100);
5514 snd_hda_codec_write(codec, 0x21, 0,
5515 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5516 msleep(200);
5517
5518 val = alc_read_coef_idx(codec, 0x50);
5519 if (val & (1 << 12)) {
5520 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5521 alc_process_coef_fw(codec, coef0288);
5522 msleep(350);
5523 val = alc_read_coef_idx(codec, 0x50);
5524 is_ctia = (val & 0x0070) == 0x0070;
5525 } else {
5526 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5527 alc_process_coef_fw(codec, coef0288);
5528 msleep(350);
5529 val = alc_read_coef_idx(codec, 0x50);
5530 is_ctia = (val & 0x0070) == 0x0070;
5531 }
5532 alc_process_coef_fw(codec, coef0298);
5533 snd_hda_codec_write(codec, 0x21, 0,
5534 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
5535 msleep(75);
5536 snd_hda_codec_write(codec, 0x21, 0,
5537 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
5538 break;
Kailang Yangf3b70332015-04-08 15:01:17 +08005539 case 0x10ec0286:
5540 case 0x10ec0288:
5541 alc_process_coef_fw(codec, coef0288);
5542 msleep(350);
5543 val = alc_read_coef_idx(codec, 0x50);
5544 is_ctia = (val & 0x0070) == 0x0070;
5545 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005546 case 0x10ec0292:
5547 alc_write_coef_idx(codec, 0x6b, 0xd429);
5548 msleep(300);
5549 val = alc_read_coef_idx(codec, 0x6c);
5550 is_ctia = (val & 0x001c) == 0x001c;
5551 break;
Kailang Yanga22aa262014-04-23 17:34:28 +08005552 case 0x10ec0293:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005553 alc_process_coef_fw(codec, coef0293);
Kailang Yanga22aa262014-04-23 17:34:28 +08005554 msleep(300);
5555 val = alc_read_coef_idx(codec, 0x46);
5556 is_ctia = (val & 0x0070) == 0x0070;
5557 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005558 case 0x10ec0668:
Takashi Iwai54db6c32014-08-18 15:11:19 +02005559 alc_process_coef_fw(codec, coef0688);
David Henningsson73bdd592013-04-15 15:44:14 +02005560 msleep(300);
5561 val = alc_read_coef_idx(codec, 0xbe);
5562 is_ctia = (val & 0x1c02) == 0x1c02;
5563 break;
Kailang Yangc2b691e2018-01-17 15:22:55 +08005564 case 0x10ec0215:
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005565 case 0x10ec0225:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005566 case 0x10ec0285:
Kailang Yang7d727862016-05-24 16:46:07 +08005567 case 0x10ec0295:
Kailang Yangc2b691e2018-01-17 15:22:55 +08005568 case 0x10ec0289:
Kailang Yang28f1f9b2017-01-04 14:49:07 +08005569 case 0x10ec0299:
Kailang Yangda911b12018-01-05 16:50:08 +08005570 snd_hda_codec_write(codec, 0x21, 0,
5571 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5572 msleep(80);
5573 snd_hda_codec_write(codec, 0x21, 0,
5574 AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0);
5575
Kailang Yang5a367672017-07-21 15:23:53 +08005576 alc_process_coef_fw(codec, alc225_pre_hsmode);
5577 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5578 val = alc_read_coef_idx(codec, 0x45);
5579 if (val & (1 << 9)) {
5580 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5581 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5582 msleep(800);
5583 val = alc_read_coef_idx(codec, 0x46);
5584 is_ctia = (val & 0x00f0) == 0x00f0;
5585 } else {
5586 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5587 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5588 msleep(800);
5589 val = alc_read_coef_idx(codec, 0x46);
5590 is_ctia = (val & 0x00f0) == 0x00f0;
5591 }
5592 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5593 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5594 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
Kailang Yangda911b12018-01-05 16:50:08 +08005595
5596 snd_hda_codec_write(codec, 0x21, 0,
5597 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
5598 msleep(80);
5599 snd_hda_codec_write(codec, 0x21, 0,
5600 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
Kailang Yang4cc9b9d2016-02-03 15:09:35 +08005601 break;
Kailang Yang78f4f7c2016-06-07 11:31:34 +08005602 case 0x10ec0867:
5603 is_ctia = true;
5604 break;
David Henningsson73bdd592013-04-15 15:44:14 +02005605 }
5606
Takashi Iwai4e76a882014-02-25 12:21:03 +01005607 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
David Henningsson73bdd592013-04-15 15:44:14 +02005608 is_ctia ? "yes" : "no");
5609 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP;
5610}
5611
5612static void alc_update_headset_mode(struct hda_codec *codec)
5613{
5614 struct alc_spec *spec = codec->spec;
5615
5616 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
Takashi Iwai35a39f92019-02-01 11:19:50 +01005617 hda_nid_t hp_pin = alc_get_hp_pin(spec);
David Henningsson73bdd592013-04-15 15:44:14 +02005618
5619 int new_headset_mode;
5620
5621 if (!snd_hda_jack_detect(codec, hp_pin))
5622 new_headset_mode = ALC_HEADSET_MODE_UNPLUGGED;
5623 else if (mux_pin == spec->headset_mic_pin)
5624 new_headset_mode = ALC_HEADSET_MODE_HEADSET;
5625 else if (mux_pin == spec->headphone_mic_pin)
5626 new_headset_mode = ALC_HEADSET_MODE_MIC;
5627 else
5628 new_headset_mode = ALC_HEADSET_MODE_HEADPHONE;
5629
David Henningsson5959a6b2013-11-12 11:10:57 +01005630 if (new_headset_mode == spec->current_headset_mode) {
5631 snd_hda_gen_update_outputs(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005632 return;
David Henningsson5959a6b2013-11-12 11:10:57 +01005633 }
David Henningsson73bdd592013-04-15 15:44:14 +02005634
5635 switch (new_headset_mode) {
5636 case ALC_HEADSET_MODE_UNPLUGGED:
5637 alc_headset_mode_unplugged(codec);
Kailang Yangaeac1a02019-05-16 16:10:44 +08005638 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5639 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
David Henningsson73bdd592013-04-15 15:44:14 +02005640 spec->gen.hp_jack_present = false;
5641 break;
5642 case ALC_HEADSET_MODE_HEADSET:
5643 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN)
5644 alc_determine_headset_type(codec);
5645 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA)
5646 alc_headset_mode_ctia(codec);
5647 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP)
5648 alc_headset_mode_omtp(codec);
5649 spec->gen.hp_jack_present = true;
5650 break;
5651 case ALC_HEADSET_MODE_MIC:
5652 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5653 spec->gen.hp_jack_present = false;
5654 break;
5655 case ALC_HEADSET_MODE_HEADPHONE:
5656 alc_headset_mode_default(codec);
5657 spec->gen.hp_jack_present = true;
5658 break;
5659 }
5660 if (new_headset_mode != ALC_HEADSET_MODE_MIC) {
5661 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5662 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005663 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin)
David Henningsson73bdd592013-04-15 15:44:14 +02005664 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5665 PIN_VREFHIZ);
5666 }
5667 spec->current_headset_mode = new_headset_mode;
5668
5669 snd_hda_gen_update_outputs(codec);
5670}
5671
5672static void alc_update_headset_mode_hook(struct hda_codec *codec,
Takashi Iwai7fe30712014-01-30 17:59:02 +01005673 struct snd_kcontrol *kcontrol,
5674 struct snd_ctl_elem_value *ucontrol)
David Henningsson73bdd592013-04-15 15:44:14 +02005675{
5676 alc_update_headset_mode(codec);
5677}
5678
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02005679static void alc_update_headset_jack_cb(struct hda_codec *codec,
5680 struct hda_jack_callback *jack)
David Henningsson73bdd592013-04-15 15:44:14 +02005681{
David Henningsson73bdd592013-04-15 15:44:14 +02005682 snd_hda_gen_hp_automute(codec, jack);
Hui Wange54f30b2021-03-20 17:15:42 +08005683 alc_update_headset_mode(codec);
David Henningsson73bdd592013-04-15 15:44:14 +02005684}
5685
5686static void alc_probe_headset_mode(struct hda_codec *codec)
5687{
5688 int i;
5689 struct alc_spec *spec = codec->spec;
5690 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5691
5692 /* Find mic pins */
5693 for (i = 0; i < cfg->num_inputs; i++) {
5694 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin)
5695 spec->headset_mic_pin = cfg->inputs[i].pin;
5696 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin)
5697 spec->headphone_mic_pin = cfg->inputs[i].pin;
5698 }
5699
Takashi Iwai0bed2aa2018-06-19 12:45:53 +02005700 WARN_ON(spec->gen.cap_sync_hook);
David Henningsson73bdd592013-04-15 15:44:14 +02005701 spec->gen.cap_sync_hook = alc_update_headset_mode_hook;
5702 spec->gen.automute_hook = alc_update_headset_mode;
5703 spec->gen.hp_automute_hook = alc_update_headset_jack_cb;
5704}
5705
5706static void alc_fixup_headset_mode(struct hda_codec *codec,
5707 const struct hda_fixup *fix, int action)
5708{
5709 struct alc_spec *spec = codec->spec;
5710
5711 switch (action) {
5712 case HDA_FIXUP_ACT_PRE_PROBE:
5713 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC;
5714 break;
5715 case HDA_FIXUP_ACT_PROBE:
5716 alc_probe_headset_mode(codec);
5717 break;
5718 case HDA_FIXUP_ACT_INIT:
Kailang Yangaeac1a02019-05-16 16:10:44 +08005719 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5720 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN;
5721 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN;
5722 }
David Henningsson73bdd592013-04-15 15:44:14 +02005723 alc_update_headset_mode(codec);
5724 break;
5725 }
5726}
5727
5728static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5729 const struct hda_fixup *fix, int action)
5730{
5731 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5732 struct alc_spec *spec = codec->spec;
5733 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5734 }
5735 else
5736 alc_fixup_headset_mode(codec, fix, action);
5737}
5738
Kailang Yang31278992014-03-03 15:27:22 +08005739static void alc255_set_default_jack_type(struct hda_codec *codec)
5740{
5741 /* Set to iphone type */
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005742 static const struct coef_fw alc255fw[] = {
Takashi Iwai54db6c32014-08-18 15:11:19 +02005743 WRITE_COEF(0x1b, 0x880b),
5744 WRITE_COEF(0x45, 0xd089),
5745 WRITE_COEF(0x1b, 0x080b),
5746 WRITE_COEF(0x46, 0x0004),
5747 WRITE_COEF(0x1b, 0x0c0b),
5748 {}
5749 };
Takashi Iwai6b0f95c2020-01-05 15:47:18 +01005750 static const struct coef_fw alc256fw[] = {
Kailang Yange69e7e02016-05-30 15:58:28 +08005751 WRITE_COEF(0x1b, 0x884b),
5752 WRITE_COEF(0x45, 0xd089),
5753 WRITE_COEF(0x1b, 0x084b),
5754 WRITE_COEF(0x46, 0x0004),
5755 WRITE_COEF(0x1b, 0x0c4b),
5756 {}
5757 };
5758 switch (codec->core.vendor_id) {
5759 case 0x10ec0255:
5760 alc_process_coef_fw(codec, alc255fw);
5761 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02005762 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08005763 case 0x10ec0236:
Kailang Yange69e7e02016-05-30 15:58:28 +08005764 case 0x10ec0256:
5765 alc_process_coef_fw(codec, alc256fw);
5766 break;
5767 }
Kailang Yang31278992014-03-03 15:27:22 +08005768 msleep(30);
5769}
5770
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005771static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5772 const struct hda_fixup *fix, int action)
5773{
5774 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Kailang Yang31278992014-03-03 15:27:22 +08005775 alc255_set_default_jack_type(codec);
Kailang Yang9a22a8f52013-11-08 15:54:49 +08005776 }
5777 alc_fixup_headset_mode(codec, fix, action);
5778}
5779
Kailang Yang31278992014-03-03 15:27:22 +08005780static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5781 const struct hda_fixup *fix, int action)
5782{
5783 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5784 struct alc_spec *spec = codec->spec;
5785 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5786 alc255_set_default_jack_type(codec);
5787 }
5788 else
5789 alc_fixup_headset_mode(codec, fix, action);
5790}
5791
Kailang Yange1e62b92015-04-08 16:01:22 +08005792static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5793 struct hda_jack_callback *jack)
5794{
5795 struct alc_spec *spec = codec->spec;
Kailang Yange1e62b92015-04-08 16:01:22 +08005796
5797 alc_update_headset_jack_cb(codec, jack);
5798 /* Headset Mic enable or disable, only for Dell Dino */
Takashi Iwaid44a6862018-06-19 23:04:03 +02005799 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
Kailang Yange1e62b92015-04-08 16:01:22 +08005800}
5801
5802static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5803 const struct hda_fixup *fix, int action)
5804{
5805 alc_fixup_headset_mode(codec, fix, action);
5806 if (action == HDA_FIXUP_ACT_PROBE) {
5807 struct alc_spec *spec = codec->spec;
Takashi Iwaid44a6862018-06-19 23:04:03 +02005808 /* toggled via hp_automute_hook */
5809 spec->gpio_mask |= 0x40;
5810 spec->gpio_dir |= 0x40;
Kailang Yange1e62b92015-04-08 16:01:22 +08005811 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb;
5812 }
5813}
5814
Hui Wang493a52a2014-01-14 14:07:36 +08005815static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5816 const struct hda_fixup *fix, int action)
5817{
5818 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5819 struct alc_spec *spec = codec->spec;
5820 spec->gen.auto_mute_via_amp = 1;
5821 }
5822}
5823
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005824static void alc_fixup_no_shutup(struct hda_codec *codec,
5825 const struct hda_fixup *fix, int action)
5826{
Takashi Iwaiefe55732018-06-15 11:55:02 +02005827 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005828 struct alc_spec *spec = codec->spec;
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01005829 spec->no_shutup_pins = 1;
Takashi Iwai9b745ab2014-03-07 08:37:19 +01005830 }
5831}
5832
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +02005833static void alc_fixup_disable_aamix(struct hda_codec *codec,
5834 const struct hda_fixup *fix, int action)
5835{
5836 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5837 struct alc_spec *spec = codec->spec;
5838 /* Disable AA-loopback as it causes white noise */
5839 spec->gen.mixer_nid = 0;
5840 }
5841}
5842
Takashi Iwai7f57d802015-09-24 17:36:51 +02005843/* fixup for Thinkpad docks: add dock pins, avoid HP parser fixup */
5844static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5845 const struct hda_fixup *fix, int action)
5846{
5847 static const struct hda_pintbl pincfgs[] = {
5848 { 0x16, 0x21211010 }, /* dock headphone */
5849 { 0x19, 0x21a11010 }, /* dock mic */
5850 { }
5851 };
5852 struct alc_spec *spec = codec->spec;
5853
5854 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5855 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
5856 codec->power_save_node = 0; /* avoid click noises */
5857 snd_hda_apply_pincfgs(codec, pincfgs);
5858 }
5859}
5860
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005861static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5862 const struct hda_fixup *fix, int action)
5863{
5864 static const struct hda_pintbl pincfgs[] = {
5865 { 0x17, 0x21211010 }, /* dock headphone */
5866 { 0x19, 0x21a11010 }, /* dock mic */
5867 { }
5868 };
5869 struct alc_spec *spec = codec->spec;
5870
5871 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5872 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
Takashi Iwai71db96d2018-02-26 15:36:38 +01005873 snd_hda_apply_pincfgs(codec, pincfgs);
5874 } else if (action == HDA_FIXUP_ACT_INIT) {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005875 /* Enable DOCK device */
5876 snd_hda_codec_write(codec, 0x17, 0,
5877 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
5878 /* Enable DOCK device */
5879 snd_hda_codec_write(codec, 0x19, 0,
5880 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0);
Kailang Yang61fcf8e2018-02-02 15:26:46 +08005881 }
5882}
5883
Takashi Iwai399c01a2020-05-26 08:24:06 +02005884static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5885 const struct hda_fixup *fix, int action)
5886{
5887 /* Assure the speaker pin to be coupled with DAC NID 0x03; otherwise
5888 * the speaker output becomes too low by some reason on Thinkpads with
5889 * ALC298 codec
5890 */
5891 static const hda_nid_t preferred_pairs[] = {
5892 0x14, 0x03, 0x17, 0x02, 0x21, 0x02,
5893 0
5894 };
5895 struct alc_spec *spec = codec->spec;
5896
5897 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5898 spec->gen.preferred_dacs = preferred_pairs;
5899}
5900
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02005901static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5902 const struct hda_fixup *fix, int action)
5903{
5904 static const hda_nid_t preferred_pairs[] = {
5905 0x17, 0x02, 0x21, 0x03, 0
5906 };
5907 struct alc_spec *spec = codec->spec;
5908
5909 if (action == HDA_FIXUP_ACT_PRE_PROBE)
5910 spec->gen.preferred_dacs = preferred_pairs;
5911}
5912
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005913static void alc_shutup_dell_xps13(struct hda_codec *codec)
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005914{
5915 struct alc_spec *spec = codec->spec;
Takashi Iwai35a39f92019-02-01 11:19:50 +01005916 int hp_pin = alc_get_hp_pin(spec);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005917
Gabriele Mazzotta9476d3692015-04-19 19:00:40 +02005918 /* Prevent pop noises when headphones are plugged in */
5919 snd_hda_codec_write(codec, hp_pin, 0,
5920 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
5921 msleep(20);
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005922}
5923
5924static void alc_fixup_dell_xps13(struct hda_codec *codec,
5925 const struct hda_fixup *fix, int action)
5926{
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005927 struct alc_spec *spec = codec->spec;
5928 struct hda_input_mux *imux = &spec->gen.input_mux;
5929 int i;
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005930
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005931 switch (action) {
5932 case HDA_FIXUP_ACT_PRE_PROBE:
5933 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise
5934 * it causes a click noise at start up
5935 */
5936 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
Takashi Iwaiefe55732018-06-15 11:55:02 +02005937 spec->shutup = alc_shutup_dell_xps13;
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005938 break;
5939 case HDA_FIXUP_ACT_PROBE:
Gabriele Mazzottaf38663a2014-08-08 19:34:40 +02005940 /* Make the internal mic the default input source. */
5941 for (i = 0; i < imux->num_items; i++) {
5942 if (spec->gen.imux_pins[i] == 0x12) {
5943 spec->gen.cur_mux[0] = i;
5944 break;
5945 }
5946 }
Takashi Iwai3e1b0c42015-04-27 10:43:22 +02005947 break;
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +02005948 }
5949}
5950
David Henningsson1f8b46c2015-05-12 14:38:15 +02005951static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
5952 const struct hda_fixup *fix, int action)
5953{
5954 struct alc_spec *spec = codec->spec;
5955
5956 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
5957 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
5958 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */
David Henningssonb40eda62015-05-28 09:40:23 +02005959
5960 /* Disable boost for mic-in permanently. (This code is only called
5961 from quirks that guarantee that the headphone is at NID 0x1b.) */
5962 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
5963 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
David Henningsson1f8b46c2015-05-12 14:38:15 +02005964 } else
5965 alc_fixup_headset_mode(codec, fix, action);
5966}
5967
David Henningsson73bdd592013-04-15 15:44:14 +02005968static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
5969 const struct hda_fixup *fix, int action)
5970{
5971 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
David Henningsson73bdd592013-04-15 15:44:14 +02005972 alc_write_coef_idx(codec, 0xc4, 0x8000);
Takashi Iwai98b24882014-08-18 13:47:50 +02005973 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
David Henningsson73bdd592013-04-15 15:44:14 +02005974 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
5975 }
5976 alc_fixup_headset_mode(codec, fix, action);
5977}
5978
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08005979/* Returns the nid of the external mic input pin, or 0 if it cannot be found. */
5980static int find_ext_mic_pin(struct hda_codec *codec)
5981{
5982 struct alc_spec *spec = codec->spec;
5983 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
5984 hda_nid_t nid;
5985 unsigned int defcfg;
5986 int i;
5987
5988 for (i = 0; i < cfg->num_inputs; i++) {
5989 if (cfg->inputs[i].type != AUTO_PIN_MIC)
5990 continue;
5991 nid = cfg->inputs[i].pin;
5992 defcfg = snd_hda_codec_get_pincfg(codec, nid);
5993 if (snd_hda_get_input_pin_attr(defcfg) == INPUT_PIN_ATTR_INT)
5994 continue;
5995 return nid;
5996 }
5997
5998 return 0;
5999}
6000
Dylan Reid08a978d2012-11-18 22:56:40 -08006001static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +01006002 const struct hda_fixup *fix,
Dylan Reid08a978d2012-11-18 22:56:40 -08006003 int action)
6004{
6005 struct alc_spec *spec = codec->spec;
6006
Takashi Iwai0db75792013-01-23 13:57:20 +01006007 if (action == HDA_FIXUP_ACT_PROBE) {
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08006008 int mic_pin = find_ext_mic_pin(codec);
Takashi Iwai35a39f92019-02-01 11:19:50 +01006009 int hp_pin = alc_get_hp_pin(spec);
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08006010
6011 if (snd_BUG_ON(!mic_pin || !hp_pin))
Takashi Iwai0db75792013-01-23 13:57:20 +01006012 return;
Chih-Chung Changbde7bc62013-08-05 16:38:42 +08006013 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
Takashi Iwai0db75792013-01-23 13:57:20 +01006014 }
Dylan Reid08a978d2012-11-18 22:56:40 -08006015}
David Henningsson693b6132012-06-22 19:12:10 +02006016
David Henningsson3e0d6112013-04-22 14:30:14 +02006017static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6018 const struct hda_fixup *fix,
6019 int action)
6020{
6021 struct alc_spec *spec = codec->spec;
6022 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
6023 int i;
6024
6025 /* The mic boosts on level 2 and 3 are too noisy
6026 on the internal mic input.
6027 Therefore limit the boost to 0 or 1. */
6028
6029 if (action != HDA_FIXUP_ACT_PROBE)
6030 return;
6031
6032 for (i = 0; i < cfg->num_inputs; i++) {
6033 hda_nid_t nid = cfg->inputs[i].pin;
6034 unsigned int defcfg;
6035 if (cfg->inputs[i].type != AUTO_PIN_MIC)
6036 continue;
6037 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6038 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
6039 continue;
6040
6041 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6042 (0x00 << AC_AMPCAP_OFFSET_SHIFT) |
6043 (0x01 << AC_AMPCAP_NUM_STEPS_SHIFT) |
6044 (0x2f << AC_AMPCAP_STEP_SIZE_SHIFT) |
6045 (0 << AC_AMPCAP_MUTE_SHIFT));
6046 }
6047}
6048
Kailang Yangcd217a62013-08-22 10:15:24 +02006049static void alc283_hp_automute_hook(struct hda_codec *codec,
Takashi Iwai1a4f69d2014-09-11 15:22:46 +02006050 struct hda_jack_callback *jack)
Kailang Yangcd217a62013-08-22 10:15:24 +02006051{
6052 struct alc_spec *spec = codec->spec;
6053 int vref;
6054
6055 msleep(200);
6056 snd_hda_gen_hp_automute(codec, jack);
6057
6058 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
6059
6060 msleep(600);
6061 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6062 vref);
6063}
6064
Kailang Yangcd217a62013-08-22 10:15:24 +02006065static void alc283_fixup_chromebook(struct hda_codec *codec,
6066 const struct hda_fixup *fix, int action)
6067{
6068 struct alc_spec *spec = codec->spec;
Kailang Yangcd217a62013-08-22 10:15:24 +02006069
6070 switch (action) {
6071 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yang0202e992013-12-02 15:20:15 +08006072 snd_hda_override_wcaps(codec, 0x03, 0);
Takashi Iwaid2e92702013-10-30 07:50:53 +01006073 /* Disable AA-loopback as it causes white noise */
6074 spec->gen.mixer_nid = 0;
Kailang Yang38070212013-11-01 15:57:35 +08006075 break;
6076 case HDA_FIXUP_ACT_INIT:
Kailang Yangde9481c2014-04-07 16:41:52 +08006077 /* MIC2-VREF control */
6078 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006079 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yang0202e992013-12-02 15:20:15 +08006080 /* Enable Line1 input control by verb */
Takashi Iwai98b24882014-08-18 13:47:50 +02006081 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
Kailang Yang0202e992013-12-02 15:20:15 +08006082 break;
6083 }
6084}
6085
6086static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6087 const struct hda_fixup *fix, int action)
6088{
6089 struct alc_spec *spec = codec->spec;
Kailang Yang0202e992013-12-02 15:20:15 +08006090
6091 switch (action) {
6092 case HDA_FIXUP_ACT_PRE_PROBE:
Kailang Yangcd217a62013-08-22 10:15:24 +02006093 spec->gen.hp_automute_hook = alc283_hp_automute_hook;
6094 break;
6095 case HDA_FIXUP_ACT_INIT:
6096 /* MIC2-VREF control */
6097 /* Set to manual mode */
Takashi Iwai98b24882014-08-18 13:47:50 +02006098 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
Kailang Yangcd217a62013-08-22 10:15:24 +02006099 break;
6100 }
6101}
6102
Takashi Iwai7bba2152013-09-06 15:45:38 +02006103/* mute tablet speaker pin (0x14) via dock plugging in addition */
6104static void asus_tx300_automute(struct hda_codec *codec)
6105{
6106 struct alc_spec *spec = codec->spec;
6107 snd_hda_gen_update_outputs(codec);
6108 if (snd_hda_jack_detect(codec, 0x1b))
6109 spec->gen.mute_bits |= (1ULL << 0x14);
6110}
6111
6112static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6113 const struct hda_fixup *fix, int action)
6114{
6115 struct alc_spec *spec = codec->spec;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006116 static const struct hda_pintbl dock_pins[] = {
6117 { 0x1b, 0x21114000 }, /* dock speaker pin */
6118 {}
6119 };
Takashi Iwai7bba2152013-09-06 15:45:38 +02006120
6121 switch (action) {
6122 case HDA_FIXUP_ACT_PRE_PROBE:
Takashi Iwai1c76aa52018-06-21 16:37:54 +02006123 spec->init_amp = ALC_INIT_DEFAULT;
Takashi Iwaiae065f12018-06-19 23:00:03 +02006124 /* TX300 needs to set up GPIO2 for the speaker amp */
6125 alc_setup_gpio(codec, 0x04);
Takashi Iwai7bba2152013-09-06 15:45:38 +02006126 snd_hda_apply_pincfgs(codec, dock_pins);
6127 spec->gen.auto_mute_via_amp = 1;
6128 spec->gen.automute_hook = asus_tx300_automute;
6129 snd_hda_jack_detect_enable_callback(codec, 0x1b,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006130 snd_hda_gen_hp_automute);
6131 break;
Takashi Iwai5579cd62018-06-19 22:22:41 +02006132 case HDA_FIXUP_ACT_PROBE:
6133 spec->init_amp = ALC_INIT_DEFAULT;
6134 break;
Takashi Iwai7bba2152013-09-06 15:45:38 +02006135 case HDA_FIXUP_ACT_BUILD:
6136 /* this is a bit tricky; give more sane names for the main
6137 * (tablet) speaker and the dock speaker, respectively
6138 */
Takashi Iwai56798e62017-04-11 08:10:52 +02006139 rename_ctl(codec, "Speaker Playback Switch",
6140 "Dock Speaker Playback Switch");
6141 rename_ctl(codec, "Bass Speaker Playback Switch",
6142 "Speaker Playback Switch");
Takashi Iwai7bba2152013-09-06 15:45:38 +02006143 break;
6144 }
6145}
6146
David Henningsson338cae52013-10-07 10:39:59 +02006147static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6148 const struct hda_fixup *fix, int action)
6149{
David Henningsson0f4881d2013-12-20 16:08:13 +01006150 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6151 /* DAC node 0x03 is giving mono output. We therefore want to
6152 make sure 0x14 (front speaker) and 0x15 (headphones) use the
6153 stereo DAC, while leaving 0x17 (bass speaker) for node 0x03. */
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006154 static const hda_nid_t conn1[] = { 0x0c };
6155 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6156 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
David Henningsson0f4881d2013-12-20 16:08:13 +01006157 }
David Henningsson338cae52013-10-07 10:39:59 +02006158}
6159
Hui Wangdd9aa332016-08-01 10:20:32 +08006160static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6161 const struct hda_fixup *fix, int action)
6162{
6163 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6164 /* The speaker is routed to the Node 0x06 by a mistake, as a result
6165 we can't adjust the speaker's volume since this node does not has
6166 Amp-out capability. we change the speaker's route to:
6167 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 (
6168 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust
6169 speaker's volume now. */
6170
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006171 static const hda_nid_t conn1[] = { 0x0c };
6172 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
Hui Wangdd9aa332016-08-01 10:20:32 +08006173 }
6174}
6175
Takashi Iwaie312a862018-03-06 12:14:17 +01006176/* disable DAC3 (0x06) selection on NID 0x17 as it has no volume amp control */
6177static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6178 const struct hda_fixup *fix, int action)
6179{
6180 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006181 static const hda_nid_t conn[] = { 0x02, 0x03 };
6182 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Takashi Iwaie312a862018-03-06 12:14:17 +01006183 }
6184}
6185
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006186/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
6187static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6188 const struct hda_fixup *fix, int action)
6189{
6190 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006191 static const hda_nid_t conn[] = { 0x02 };
6192 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006193 }
6194}
6195
Keith Packard98973f22015-07-15 12:14:39 -07006196/* Hook to update amp GPIO4 for automute */
6197static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6198 struct hda_jack_callback *jack)
6199{
6200 struct alc_spec *spec = codec->spec;
6201
6202 snd_hda_gen_hp_automute(codec, jack);
6203 /* mute_led_polarity is set to 0, so we pass inverted value here */
Kai-Heng Fengdbd13172020-04-30 16:32:51 +08006204 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6205 !spec->gen.hp_jack_present);
Keith Packard98973f22015-07-15 12:14:39 -07006206}
6207
6208/* Manage GPIOs for HP EliteBook Folio 9480m.
6209 *
6210 * GPIO4 is the headphone amplifier power control
6211 * GPIO3 is the audio output mute indicator LED
6212 */
6213
6214static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6215 const struct hda_fixup *fix,
6216 int action)
6217{
6218 struct alc_spec *spec = codec->spec;
Keith Packard98973f22015-07-15 12:14:39 -07006219
Takashi Iwai01e4a272018-06-19 22:47:30 +02006220 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
Keith Packard98973f22015-07-15 12:14:39 -07006221 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai01e4a272018-06-19 22:47:30 +02006222 /* amp at GPIO4; toggled via alc280_hp_gpio4_automute_hook() */
6223 spec->gpio_mask |= 0x10;
6224 spec->gpio_dir |= 0x10;
Keith Packard98973f22015-07-15 12:14:39 -07006225 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook;
Keith Packard98973f22015-07-15 12:14:39 -07006226 }
6227}
6228
Takashi Iwaiae065f12018-06-19 23:00:03 +02006229static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6230 const struct hda_fixup *fix,
6231 int action)
6232{
6233 struct alc_spec *spec = codec->spec;
6234
6235 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6236 spec->gpio_mask |= 0x04;
6237 spec->gpio_dir |= 0x04;
6238 /* set data bit low */
6239 }
6240}
6241
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006242/* Quirk for Thinkpad X1 7th and 8th Gen
6243 * The following fixed routing needed
6244 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6245 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6246 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6247 */
6248static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6249 const struct hda_fixup *fix, int action)
6250{
6251 static const hda_nid_t conn[] = { 0x02, 0x03 }; /* exclude 0x06 */
6252 static const hda_nid_t preferred_pairs[] = {
6253 0x14, 0x02, 0x17, 0x03, 0x21, 0x03, 0
6254 };
6255 struct alc_spec *spec = codec->spec;
6256
6257 switch (action) {
6258 case HDA_FIXUP_ACT_PRE_PROBE:
6259 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6260 spec->gen.preferred_dacs = preferred_pairs;
6261 break;
6262 case HDA_FIXUP_ACT_BUILD:
6263 /* The generic parser creates somewhat unintuitive volume ctls
6264 * with the fixed routing above, and the shared DAC2 may be
6265 * confusing for PA.
6266 * Rename those to unique names so that PA doesn't touch them
6267 * and use only Master volume.
6268 */
6269 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6270 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6271 break;
6272 }
6273}
6274
Kailang Yangca169cc2017-04-25 16:17:40 +08006275static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6276 const struct hda_fixup *fix,
6277 int action)
6278{
6279 alc_fixup_dual_codecs(codec, fix, action);
6280 switch (action) {
6281 case HDA_FIXUP_ACT_PRE_PROBE:
6282 /* override card longname to provide a unique UCM profile */
6283 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6284 break;
6285 case HDA_FIXUP_ACT_BUILD:
6286 /* rename Capture controls depending on the codec */
6287 rename_ctl(codec, "Capture Volume",
6288 codec->addr == 0 ?
6289 "Rear-Panel Capture Volume" :
6290 "Front-Panel Capture Volume");
6291 rename_ctl(codec, "Capture Switch",
6292 codec->addr == 0 ?
6293 "Rear-Panel Capture Switch" :
6294 "Front-Panel Capture Switch");
6295 break;
6296 }
6297}
6298
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006299static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6300 const struct hda_fixup *fix, int action)
6301{
6302 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6303 return;
6304
6305 codec->power_save_node = 1;
6306}
6307
Kailang Yang92266652017-12-14 15:28:58 +08006308/* Forcibly assign NID 0x03 to HP/LO while NID 0x02 to SPK for EQ */
6309static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6310 const struct hda_fixup *fix, int action)
6311{
6312 struct alc_spec *spec = codec->spec;
Michał Mirosławcaf3c042020-01-03 10:23:48 +01006313 static const hda_nid_t preferred_pairs[] = {
Kailang Yang92266652017-12-14 15:28:58 +08006314 0x21, 0x03, 0x1b, 0x03, 0x16, 0x02,
6315 0
6316 };
6317
6318 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6319 return;
6320
6321 spec->gen.preferred_dacs = preferred_pairs;
Kailang Yang0700d3d2019-04-26 16:13:54 +08006322 spec->gen.auto_mute_via_amp = 1;
6323 codec->power_save_node = 0;
Kailang Yang92266652017-12-14 15:28:58 +08006324}
6325
Takashi Iwaic84bfed2020-11-27 15:11:04 +01006326/* avoid DAC 0x06 for bass speaker 0x17; it has no volume control */
6327static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6328 const struct hda_fixup *fix, int action)
6329{
6330 static const hda_nid_t preferred_pairs[] = {
6331 0x14, 0x02, 0x17, 0x02, 0x21, 0x03, 0
6332 };
6333 struct alc_spec *spec = codec->spec;
6334
6335 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
6336 spec->gen.preferred_dacs = preferred_pairs;
6337 spec->gen.obey_preferred_dacs = 1;
6338 }
6339}
6340
Hui Wangc4cfcf62018-11-26 14:17:16 +08006341/* The DAC of NID 0x3 will introduce click/pop noise on headphones, so invalidate it */
6342static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6343 const struct hda_fixup *fix, int action)
6344{
6345 if (action != HDA_FIXUP_ACT_PRE_PROBE)
6346 return;
6347
6348 snd_hda_override_wcaps(codec, 0x03, 0);
6349}
6350
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006351static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6352{
6353 switch (codec->core.vendor_id) {
6354 case 0x10ec0274:
6355 case 0x10ec0294:
6356 case 0x10ec0225:
6357 case 0x10ec0295:
6358 case 0x10ec0299:
6359 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6360 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6361 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02006362 case 0x10ec0230:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006363 case 0x10ec0235:
6364 case 0x10ec0236:
6365 case 0x10ec0255:
6366 case 0x10ec0256:
6367 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6368 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6369 break;
6370 }
6371}
6372
Kailang Yang8983eb62019-04-03 15:31:49 +08006373static void alc295_fixup_chromebook(struct hda_codec *codec,
6374 const struct hda_fixup *fix, int action)
6375{
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006376 struct alc_spec *spec = codec->spec;
6377
Kailang Yang8983eb62019-04-03 15:31:49 +08006378 switch (action) {
Kailang Yangd3ba58b2019-05-06 15:09:42 +08006379 case HDA_FIXUP_ACT_PRE_PROBE:
6380 spec->ultra_low_power = true;
6381 break;
Kailang Yang8983eb62019-04-03 15:31:49 +08006382 case HDA_FIXUP_ACT_INIT:
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006383 alc_combo_jack_hp_jd_restart(codec);
Kailang Yang8983eb62019-04-03 15:31:49 +08006384 break;
6385 }
6386}
6387
Kailang Yangd1dd4212019-01-09 17:05:24 +08006388static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6389 const struct hda_fixup *fix, int action)
6390{
6391 if (action == HDA_FIXUP_ACT_PRE_PROBE)
6392 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6393}
6394
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006395
6396static void alc294_gx502_toggle_output(struct hda_codec *codec,
6397 struct hda_jack_callback *cb)
6398{
6399 /* The Windows driver sets the codec up in a very different way where
6400 * it appears to leave 0x10 = 0x8a20 set. For Linux we need to toggle it
6401 */
6402 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6403 alc_write_coef_idx(codec, 0x10, 0x8a20);
6404 else
6405 alc_write_coef_idx(codec, 0x10, 0x0a20);
6406}
6407
6408static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6409 const struct hda_fixup *fix, int action)
6410{
6411 /* Pin 0x21: headphones/headset mic */
6412 if (!is_jack_detectable(codec, 0x21))
6413 return;
6414
6415 switch (action) {
6416 case HDA_FIXUP_ACT_PRE_PROBE:
6417 snd_hda_jack_detect_enable_callback(codec, 0x21,
6418 alc294_gx502_toggle_output);
6419 break;
6420 case HDA_FIXUP_ACT_INIT:
6421 /* Make sure to start in a correct state, i.e. if
6422 * headphones have been plugged in before powering up the system
6423 */
6424 alc294_gx502_toggle_output(codec, NULL);
6425 break;
6426 }
6427}
6428
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006429static void alc294_gu502_toggle_output(struct hda_codec *codec,
6430 struct hda_jack_callback *cb)
6431{
6432 /* Windows sets 0x10 to 0x8420 for Node 0x20 which is
6433 * responsible from changes between speakers and headphones
6434 */
6435 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6436 alc_write_coef_idx(codec, 0x10, 0x8420);
6437 else
6438 alc_write_coef_idx(codec, 0x10, 0x0a20);
6439}
6440
6441static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6442 const struct hda_fixup *fix, int action)
6443{
6444 if (!is_jack_detectable(codec, 0x21))
6445 return;
6446
6447 switch (action) {
6448 case HDA_FIXUP_ACT_PRE_PROBE:
6449 snd_hda_jack_detect_enable_callback(codec, 0x21,
6450 alc294_gu502_toggle_output);
6451 break;
6452 case HDA_FIXUP_ACT_INIT:
6453 alc294_gu502_toggle_output(codec, NULL);
6454 break;
6455 }
6456}
6457
Kailang Yang56496252020-07-29 15:09:27 +08006458static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6459 const struct hda_fixup *fix, int action)
6460{
6461 if (action != HDA_FIXUP_ACT_INIT)
6462 return;
6463
6464 msleep(100);
6465 alc_write_coef_idx(codec, 0x65, 0x0);
6466}
6467
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006468static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6469 const struct hda_fixup *fix, int action)
6470{
6471 switch (action) {
6472 case HDA_FIXUP_ACT_INIT:
6473 alc_combo_jack_hp_jd_restart(codec);
6474 break;
6475 }
6476}
6477
Kailang Yang92666d42020-11-19 17:04:21 +08006478static void alc_fixup_no_int_mic(struct hda_codec *codec,
6479 const struct hda_fixup *fix, int action)
6480{
6481 struct alc_spec *spec = codec->spec;
6482
6483 switch (action) {
6484 case HDA_FIXUP_ACT_PRE_PROBE:
6485 /* Mic RING SLEEVE swap for combo jack */
6486 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6487 spec->no_internal_mic_pin = true;
6488 break;
6489 case HDA_FIXUP_ACT_INIT:
6490 alc_combo_jack_hp_jd_restart(codec);
6491 break;
6492 }
6493}
6494
Davide Baldod94befb2021-10-15 09:21:22 +02006495/* GPIO1 = amplifier on/off
6496 * GPIO3 = mic mute LED
6497 */
6498static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6499 const struct hda_fixup *fix, int action)
6500{
6501 static const hda_nid_t conn[] = { 0x02 };
6502
6503 struct alc_spec *spec = codec->spec;
6504 static const struct hda_pintbl pincfgs[] = {
6505 { 0x14, 0x90170110 }, /* front/high speakers */
6506 { 0x17, 0x90170130 }, /* back/bass speakers */
6507 { }
6508 };
6509
6510 //enable micmute led
6511 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6512
6513 switch (action) {
6514 case HDA_FIXUP_ACT_PRE_PROBE:
6515 spec->micmute_led_polarity = 1;
6516 /* needed for amp of back speakers */
6517 spec->gpio_mask |= 0x01;
6518 spec->gpio_dir |= 0x01;
6519 snd_hda_apply_pincfgs(codec, pincfgs);
6520 /* share DAC to have unified volume control */
6521 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6522 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6523 break;
6524 case HDA_FIXUP_ACT_INIT:
6525 /* need to toggle GPIO to enable the amp of back speakers */
6526 alc_update_gpio_data(codec, 0x01, true);
6527 msleep(100);
6528 alc_update_gpio_data(codec, 0x01, false);
6529 break;
6530 }
6531}
6532
Elia Devito434591b2021-06-19 22:41:04 +02006533static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6534 const struct hda_fixup *fix, int action)
6535{
6536 static const hda_nid_t conn[] = { 0x02 };
6537 static const struct hda_pintbl pincfgs[] = {
6538 { 0x14, 0x90170110 }, /* rear speaker */
6539 { }
6540 };
6541
6542 switch (action) {
6543 case HDA_FIXUP_ACT_PRE_PROBE:
6544 snd_hda_apply_pincfgs(codec, pincfgs);
6545 /* force front speaker to DAC1 */
6546 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6547 break;
6548 }
6549}
6550
Takashi Iwaib317b032014-01-08 11:44:21 +01006551/* for hda_fixup_thinkpad_acpi() */
6552#include "thinkpad_helper.c"
David Henningssonb67ae3f2013-11-05 13:11:37 +01006553
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02006554static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6555 const struct hda_fixup *fix, int action)
6556{
6557 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6558 hda_fixup_thinkpad_acpi(codec, fix, action);
6559}
6560
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006561/* Fixup for Lenovo Legion 15IMHg05 speaker output on headset removal. */
6562static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6563 const struct hda_fixup *fix,
6564 int action)
6565{
6566 struct alc_spec *spec = codec->spec;
6567
6568 switch (action) {
6569 case HDA_FIXUP_ACT_PRE_PROBE:
6570 spec->gen.suppress_auto_mute = 1;
6571 break;
6572 }
6573}
6574
Lucas Tanured3dca022021-12-17 11:57:07 +00006575static int comp_match_dev_name(struct device *dev, void *data)
6576{
6577 return strcmp(dev_name(dev), data) == 0;
6578}
6579
6580static int find_comp_by_dev_name(struct alc_spec *spec, const char *name)
6581{
6582 int i;
6583
6584 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6585 if (strcmp(spec->comps[i].name, name) == 0)
6586 return i;
6587 }
6588
6589 return -ENODEV;
6590}
6591
6592static int comp_bind(struct device *dev)
6593{
6594 struct hda_codec *cdc = dev_to_hda_codec(dev);
6595 struct alc_spec *spec = cdc->spec;
6596
6597 return component_bind_all(dev, spec->comps);
6598}
6599
6600static void comp_unbind(struct device *dev)
6601{
6602 struct hda_codec *cdc = dev_to_hda_codec(dev);
6603 struct alc_spec *spec = cdc->spec;
6604
6605 component_unbind_all(dev, spec->comps);
6606}
6607
6608static const struct component_master_ops comp_master_ops = {
6609 .bind = comp_bind,
6610 .unbind = comp_unbind,
6611};
6612
6613static void comp_generic_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6614 struct snd_pcm_substream *sub, int action)
6615{
6616 struct alc_spec *spec = cdc->spec;
6617 int i;
6618
6619 for (i = 0; i < HDA_MAX_COMPONENTS; i++) {
6620 if (spec->comps[i].dev)
6621 spec->comps[i].playback_hook(spec->comps[i].dev, action);
6622 }
6623}
6624
Stefan Bindingae7abe32021-12-17 11:57:08 +00006625static void cs35l41_generic_fixup(struct hda_codec *cdc, int action, const char *bus,
6626 const char *hid, int count)
6627{
6628 struct device *dev = hda_codec_dev(cdc);
6629 struct alc_spec *spec = cdc->spec;
6630 char *name;
6631 int ret, i;
6632
6633 switch (action) {
6634 case HDA_FIXUP_ACT_PRE_PROBE:
6635 for (i = 0; i < count; i++) {
6636 name = devm_kasprintf(dev, GFP_KERNEL,
6637 "%s-%s:00-cs35l41-hda.%d", bus, hid, i);
6638 if (!name)
6639 return;
6640 component_match_add(dev, &spec->match, comp_match_dev_name, name);
6641 }
6642 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6643 if (ret)
6644 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6645 else
6646 spec->gen.pcm_playback_hook = comp_generic_playback_hook;
6647 break;
6648 }
6649}
6650
6651static void cs35l41_fixup_i2c_two(struct hda_codec *cdc, const struct hda_fixup *fix, int action)
6652{
6653 cs35l41_generic_fixup(cdc, action, "i2c", "CSC3551", 2);
6654}
6655
Lucas Tanured3dca022021-12-17 11:57:07 +00006656static void alc287_legion_16achg6_playback_hook(struct hda_pcm_stream *hinfo, struct hda_codec *cdc,
6657 struct snd_pcm_substream *sub, int action)
6658{
6659 struct alc_spec *spec = cdc->spec;
6660 unsigned int rx_slot;
6661 int i;
6662
6663 switch (action) {
6664 case HDA_GEN_PCM_ACT_PREPARE:
6665 rx_slot = 0;
6666 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.0");
6667 if (i >= 0)
6668 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6669
6670 rx_slot = 1;
6671 i = find_comp_by_dev_name(spec, "i2c-CLSA0100:00-cs35l41-hda.1");
6672 if (i >= 0)
6673 spec->comps[i].set_channel_map(spec->comps[i].dev, 0, NULL, 1, &rx_slot);
6674 break;
6675 }
6676
6677 comp_generic_playback_hook(hinfo, cdc, sub, action);
6678}
6679
6680static void alc287_fixup_legion_16achg6_speakers(struct hda_codec *cdc, const struct hda_fixup *fix,
6681 int action)
6682{
6683 struct device *dev = hda_codec_dev(cdc);
6684 struct alc_spec *spec = cdc->spec;
6685 int ret;
6686
6687 switch (action) {
6688 case HDA_FIXUP_ACT_PRE_PROBE:
6689 component_match_add(dev, &spec->match, comp_match_dev_name,
6690 "i2c-CLSA0100:00-cs35l41-hda.0");
6691 component_match_add(dev, &spec->match, comp_match_dev_name,
6692 "i2c-CLSA0100:00-cs35l41-hda.1");
6693 ret = component_master_add_with_match(dev, &comp_master_ops, spec->match);
6694 if (ret)
6695 codec_err(cdc, "Fail to register component aggregator %d\n", ret);
6696 else
6697 spec->gen.pcm_playback_hook = alc287_legion_16achg6_playback_hook;
6698 break;
6699 }
6700}
6701
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006702/* for alc295_fixup_hp_top_speakers */
6703#include "hp_x360_helper.c"
6704
Takashi Iwai26928ca2021-04-16 10:12:11 +02006705/* for alc285_fixup_ideapad_s740_coef() */
6706#include "ideapad_s740_helper.c"
6707
Werner Sembach619764c2021-12-02 17:50:10 +01006708static const struct coef_fw alc256_fixup_set_coef_defaults_coefs[] = {
6709 WRITE_COEF(0x10, 0x0020), WRITE_COEF(0x24, 0x0000),
6710 WRITE_COEF(0x26, 0x0000), WRITE_COEF(0x29, 0x3000),
6711 WRITE_COEF(0x37, 0xfe05), WRITE_COEF(0x45, 0x5089),
6712 {}
6713};
6714
6715static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6716 const struct hda_fixup *fix,
6717 int action)
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006718{
6719 /*
Werner Sembach619764c2021-12-02 17:50:10 +01006720 * A certain other OS sets these coeffs to different values. On at least
6721 * one TongFang barebone these settings might survive even a cold
6722 * reboot. So to restore a clean slate the values are explicitly reset
6723 * to default here. Without this, the external microphone is always in a
6724 * plugged-in state, while the internal microphone is always in an
6725 * unplugged state, breaking the ability to use the internal microphone.
6726 */
6727 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006728}
6729
Werner Sembach174a7fb2021-11-12 12:07:04 +01006730static const struct coef_fw alc233_fixup_no_audio_jack_coefs[] = {
6731 WRITE_COEF(0x1a, 0x9003), WRITE_COEF(0x1b, 0x0e2b), WRITE_COEF(0x37, 0xfe06),
6732 WRITE_COEF(0x38, 0x4981), WRITE_COEF(0x45, 0xd489), WRITE_COEF(0x46, 0x0074),
6733 WRITE_COEF(0x49, 0x0149),
6734 {}
6735};
6736
6737static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6738 const struct hda_fixup *fix,
6739 int action)
6740{
6741 /*
6742 * The audio jack input and output is not detected on the ASRock NUC Box
6743 * 1100 series when cold booting without this fix. Warm rebooting from a
6744 * certain other OS makes the audio functional, as COEF settings are
6745 * preserved in this case. This fix sets these altered COEF values as
6746 * the default.
6747 */
6748 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6749}
6750
Werner Sembachedca7cc2021-12-15 20:16:46 +01006751static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6752 const struct hda_fixup *fix,
6753 int action)
6754{
6755 /*
6756 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6757 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6758 * needs an additional quirk for sound working after suspend and resume.
6759 */
6760 if (codec->core.vendor_id == 0x10ec0256) {
6761 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6762 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6763 } else {
6764 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6765 }
6766}
6767
Takashi Iwai1d045db2011-07-07 18:23:21 +02006768enum {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006769 ALC269_FIXUP_GPIO2,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006770 ALC269_FIXUP_SONY_VAIO,
6771 ALC275_FIXUP_SONY_VAIO_GPIO2,
6772 ALC269_FIXUP_DELL_M101Z,
6773 ALC269_FIXUP_SKU_IGNORE,
6774 ALC269_FIXUP_ASUS_G73JW,
6775 ALC269_FIXUP_LENOVO_EAPD,
6776 ALC275_FIXUP_SONY_HWEQ,
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02006777 ALC275_FIXUP_SONY_DISABLE_AAMIX,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006778 ALC271_FIXUP_DMIC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02006779 ALC269_FIXUP_PCM_44K,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02006780 ALC269_FIXUP_STEREO_DMIC,
David Henningsson7c478f02013-10-11 10:18:46 +02006781 ALC269_FIXUP_HEADSET_MIC,
Takashi Iwai24519912011-08-16 15:08:49 +02006782 ALC269_FIXUP_QUANTA_MUTE,
6783 ALC269_FIXUP_LIFEBOOK,
David Henningsson2041d562014-06-13 11:15:44 +02006784 ALC269_FIXUP_LIFEBOOK_EXTMIC,
Takashi Iwaicc7016a2015-04-08 20:47:55 +02006785 ALC269_FIXUP_LIFEBOOK_HP_PIN,
Takashi Iwai4df3fd12015-06-29 08:38:02 +02006786 ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT,
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01006787 ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC,
Takashi Iwaia4297b52011-08-23 18:40:12 +02006788 ALC269_FIXUP_AMIC,
6789 ALC269_FIXUP_DMIC,
6790 ALC269VB_FIXUP_AMIC,
6791 ALC269VB_FIXUP_DMIC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006792 ALC269_FIXUP_HP_MUTE_LED,
David Henningssond06ac142013-02-18 11:41:55 +01006793 ALC269_FIXUP_HP_MUTE_LED_MIC1,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01006794 ALC269_FIXUP_HP_MUTE_LED_MIC2,
Tom Briden7f783bd2017-03-25 10:12:01 +00006795 ALC269_FIXUP_HP_MUTE_LED_MIC3,
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01006796 ALC269_FIXUP_HP_GPIO_LED,
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08006797 ALC269_FIXUP_HP_GPIO_MIC1_LED,
6798 ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningsson693b6132012-06-22 19:12:10 +02006799 ALC269_FIXUP_INV_DMIC,
David Henningsson108cc102012-07-20 10:37:25 +02006800 ALC269_FIXUP_LENOVO_DOCK,
Takashi Iwaib590b382020-05-14 18:05:33 +02006801 ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST,
Takashi Iwai9b745ab2014-03-07 08:37:19 +01006802 ALC269_FIXUP_NO_SHUTUP,
David Henningsson88cfcf82013-10-11 10:18:45 +02006803 ALC286_FIXUP_SONY_MIC_NO_PRESENCE,
David Henningsson108cc102012-07-20 10:37:25 +02006804 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
David Henningsson73bdd592013-04-15 15:44:14 +02006805 ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
6806 ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningsson338cae52013-10-07 10:39:59 +02006807 ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
Kailang Yangfcc6c872017-06-29 15:21:27 +08006808 ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +02006809 ALC269_FIXUP_HEADSET_MODE,
6810 ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
Takashi Iwai78197172015-06-27 10:21:13 +02006811 ALC269_FIXUP_ASPIRE_HEADSET_MIC,
David Henningssond240d1d2013-04-15 12:50:02 +02006812 ALC269_FIXUP_ASUS_X101_FUNC,
6813 ALC269_FIXUP_ASUS_X101_VERB,
6814 ALC269_FIXUP_ASUS_X101,
Dylan Reid08a978d2012-11-18 22:56:40 -08006815 ALC271_FIXUP_AMIC_MIC2,
6816 ALC271_FIXUP_HP_GATE_MIC_JACK,
Oleksij Rempelb1e89722013-12-04 20:50:53 +01006817 ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572,
Dylan Reid42397002013-04-05 14:58:22 -07006818 ALC269_FIXUP_ACER_AC700,
David Henningsson3e0d6112013-04-22 14:30:14 +02006819 ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
Oleksij Rempel2cede302013-11-27 17:12:03 +01006820 ALC269VB_FIXUP_ASUS_ZENBOOK,
Takashi Iwai23870832013-11-29 14:13:12 +01006821 ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
David Henningsson8e35cd42013-11-06 11:20:01 +01006822 ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
Anisse Astier02b504d2013-06-03 11:53:10 +02006823 ALC269VB_FIXUP_ORDISSIMO_EVE2,
Kailang Yangcd217a62013-08-22 10:15:24 +02006824 ALC283_FIXUP_CHROME_BOOK,
Kailang Yang0202e992013-12-02 15:20:15 +08006825 ALC283_FIXUP_SENSE_COMBO_JACK,
Takashi Iwai7bba2152013-09-06 15:45:38 +02006826 ALC282_FIXUP_ASUS_TX300,
Kailang Yang1bb3e062013-09-27 13:10:25 +02006827 ALC283_FIXUP_INT_MIC,
David Henningsson338cae52013-10-07 10:39:59 +02006828 ALC290_FIXUP_MONO_SPEAKERS,
David Henningsson0f4881d2013-12-20 16:08:13 +01006829 ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
6830 ALC290_FIXUP_SUBWOOFER,
6831 ALC290_FIXUP_SUBWOOFER_HSJACK,
David Henningssonb67ae3f2013-11-05 13:11:37 +01006832 ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson56f27012016-01-11 09:33:14 +01006833 ALC269_FIXUP_DMIC_THINKPAD_ACPI,
Chris Chiu5824ce82017-02-28 14:17:11 -06006834 ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
Chris Chiu615966a2017-02-28 14:17:12 -06006835 ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006836 ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yang31278992014-03-03 15:27:22 +08006837 ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Kailang Yang9a22a8f52013-11-08 15:54:49 +08006838 ALC255_FIXUP_HEADSET_MODE,
Kailang Yang31278992014-03-03 15:27:22 +08006839 ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC,
Kailang Yanga22aa262014-04-23 17:34:28 +08006840 ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwai1c37c222014-05-06 17:34:42 +02006841 ALC292_FIXUP_TPT440_DOCK,
Takashi Iwai9a811232015-12-09 15:17:43 +01006842 ALC292_FIXUP_TPT440,
Anisse Astierabaa22742016-08-24 09:14:13 +02006843 ALC283_FIXUP_HEADSET_MIC,
Takashi Iwaib3802782018-11-26 17:47:46 +01006844 ALC255_FIXUP_MIC_MUTE_LED,
Takashi Iwai1a22e772014-08-27 08:19:05 +02006845 ALC282_FIXUP_ASPIRE_V5_PINS,
Takashi Iwaic8426b22021-04-07 11:57:30 +02006846 ALC269VB_FIXUP_ASPIRE_E1_COEF,
David Henningsson7a5255f2014-10-30 08:26:01 +01006847 ALC280_FIXUP_HP_GPIO4,
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08006848 ALC286_FIXUP_HP_GPIO_LED,
David Henningsson33f4acd2015-01-07 15:50:13 +01006849 ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY,
TienFu Chenb4b33f92015-01-20 15:06:21 +01006850 ALC280_FIXUP_HP_DOCK_PINS,
Jaroslav Kysela04d54662017-03-09 13:29:13 +01006851 ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED,
Keith Packard98973f22015-07-15 12:14:39 -07006852 ALC280_FIXUP_HP_9480M,
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01006853 ALC245_FIXUP_HP_X360_AMP,
Davide Baldod94befb2021-10-15 09:21:22 +02006854 ALC285_FIXUP_HP_SPECTRE_X360_EB1,
Kailang Yange1e62b92015-04-08 16:01:22 +08006855 ALC288_FIXUP_DELL_HEADSET_MODE,
6856 ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang831bfdf92015-06-26 12:35:17 +08006857 ALC288_FIXUP_DELL_XPS_13,
6858 ALC288_FIXUP_DISABLE_AAMIX,
Takashi Iwai5fab5822020-01-05 09:11:19 +01006859 ALC292_FIXUP_DELL_E7X_AAMIX,
Takashi Iwai8b99aba2015-06-15 11:59:32 +02006860 ALC292_FIXUP_DELL_E7X,
6861 ALC292_FIXUP_DISABLE_AAMIX,
David Henningssonc04017e2015-12-15 14:44:03 +01006862 ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK,
James McDonnell54324222019-09-16 14:53:38 +00006863 ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
Kailang Yang977e6272015-05-18 15:31:20 +08006864 ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang2f726ae2017-03-31 10:31:40 +08006865 ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Kailang Yang6ed11312015-10-26 15:37:39 +08006866 ALC275_FIXUP_DELL_XPS,
Hui Wang23adc192015-12-08 12:27:18 +08006867 ALC293_FIXUP_LENOVO_SPK_NOISE,
Kailang3694cb22015-12-28 11:35:24 +08006868 ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08006869 ALC255_FIXUP_DELL_SPK_NOISE,
Kailang Yangd1dd4212019-01-09 17:05:24 +08006870 ALC225_FIXUP_DISABLE_MIC_VREF,
David Henningsson2ae95572016-02-25 09:37:05 +01006871 ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Takashi Iwaie312a862018-03-06 12:14:17 +01006872 ALC295_FIXUP_DISABLE_DAC3,
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01006873 ALC285_FIXUP_SPEAKER2_TO_DAC1,
Takashi Iwaif8839822016-02-25 14:31:59 +01006874 ALC280_FIXUP_HP_HEADSET_MIC,
Hui Wange549d192016-04-01 11:00:15 +08006875 ALC221_FIXUP_HP_FRONT_MIC,
Sven Eckelmannc636b952016-04-11 16:55:26 +02006876 ALC292_FIXUP_TPT460,
Hui Wangdd9aa332016-08-01 10:20:32 +08006877 ALC298_FIXUP_SPK_VOLUME,
Kailang Yangf86de9b2020-10-23 14:46:47 +08006878 ALC298_FIXUP_LENOVO_SPK_VOLUME,
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08006879 ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER,
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01006880 ALC269_FIXUP_ATIV_BOOK_8,
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08006881 ALC221_FIXUP_HP_MIC_NO_PRESENCE,
Chris Chiuc1732ed2017-02-28 14:17:13 -06006882 ALC256_FIXUP_ASUS_HEADSET_MODE,
6883 ALC256_FIXUP_ASUS_MIC,
Chris Chiueeed4cd2017-02-28 14:17:15 -06006884 ALC256_FIXUP_ASUS_AIO_GPIO2,
Chris Chiu216d7ae2017-02-28 14:17:14 -06006885 ALC233_FIXUP_ASUS_MIC_NO_PRESENCE,
6886 ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE,
Kailang Yangca169cc2017-04-25 16:17:40 +08006887 ALC233_FIXUP_LENOVO_MULTI_CODECS,
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08006888 ALC233_FIXUP_ACER_HEADSET_MIC,
Hui Wangf33f79f2017-07-07 12:08:29 +08006889 ALC294_FIXUP_LENOVO_MIC_LOCATION,
Kailang Yang5f364132017-07-25 16:28:16 +08006890 ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08006891 ALC225_FIXUP_S3_POP_NOISE,
PeiSen Houb84e8432017-09-01 15:11:56 +08006892 ALC700_FIXUP_INTEL_REFERENCE,
Kailang Yang92266652017-12-14 15:28:58 +08006893 ALC274_FIXUP_DELL_BIND_DACS,
6894 ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
Takashi Iwai399c01a2020-05-26 08:24:06 +02006895 ALC298_FIXUP_TPT470_DOCK_FIX,
Kailang Yang61fcf8e2018-02-02 15:26:46 +08006896 ALC298_FIXUP_TPT470_DOCK,
Kailang Yangae104a22018-02-05 16:07:20 +08006897 ALC255_FIXUP_DUMMY_LINEOUT_VERB,
Kailang Yangf0ba9d62018-03-16 11:46:08 +08006898 ALC255_FIXUP_DELL_HEADSET_MIC,
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04006899 ALC256_FIXUP_HUAWEI_MACH_WX9_PINS,
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02006900 ALC298_FIXUP_HUAWEI_MBX_STEREO,
Tom Bridenbbf8ff62018-05-29 17:34:20 +01006901 ALC295_FIXUP_HP_X360,
Kailang Yang8a328ac2018-08-21 16:54:41 +08006902 ALC221_FIXUP_HP_HEADSET_MIC,
Hui Wangc4cfcf62018-11-26 14:17:16 +08006903 ALC285_FIXUP_LENOVO_HEADPHONE_NOISE,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05006904 ALC295_FIXUP_HP_AUTO_MUTE,
Chris Chiu33aaebd2018-12-05 14:48:53 +08006905 ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
Chris Chiud8ae4582018-12-07 17:17:11 +08006906 ALC294_FIXUP_ASUS_MIC,
Jian-Hong Pan4e051102018-12-07 17:17:12 +08006907 ALC294_FIXUP_ASUS_HEADSET_MIC,
6908 ALC294_FIXUP_ASUS_SPK,
Jeremy Soller89e3a562019-01-30 16:12:31 -07006909 ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Hui Wangc8c6ee62019-02-14 11:41:33 +08006910 ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08006911 ALC255_FIXUP_ACER_HEADSET_MIC,
Kailang Yang10f5b1b2019-02-21 16:10:22 +08006912 ALC295_FIXUP_CHROME_BOOK,
Kailang Yang8983eb62019-04-03 15:31:49 +08006913 ALC225_FIXUP_HEADSET_JACK,
Kailang Yang136824e2019-03-14 16:22:45 +08006914 ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE,
6915 ALC225_FIXUP_WYSE_AUTO_MUTE,
6916 ALC225_FIXUP_WYSE_DISABLE_MIC_VREF,
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08006917 ALC286_FIXUP_ACER_AIO_HEADSET_MIC,
Daniel Drake8c8967a2019-10-17 16:15:01 +08006918 ALC256_FIXUP_ASUS_HEADSET_MIC,
Jian-Hong Pane1037352019-03-22 11:37:18 +08006919 ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01006920 ALC299_FIXUP_PREDATOR_SPK,
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02006921 ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE,
Kailang Yange79c2262019-12-19 14:12:15 +08006922 ALC289_FIXUP_DELL_SPK2,
6923 ALC289_FIXUP_DUAL_SPK,
Chris Chiu48e01502019-12-30 11:11:18 +08006924 ALC294_FIXUP_SPK2_TO_DAC1,
6925 ALC294_FIXUP_ASUS_DUAL_SPK,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02006926 ALC285_FIXUP_THINKPAD_X1_GEN7,
Kailang Yang76f7dec2020-02-10 16:30:26 +08006927 ALC285_FIXUP_THINKPAD_HEADSET_JACK,
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08006928 ALC294_FIXUP_ASUS_HPE,
Takashi Iwai1b94e592020-05-12 09:32:03 +02006929 ALC294_FIXUP_ASUS_COEF_1B,
Luke D Jonesc3cdf182020-09-07 20:19:59 +12006930 ALC294_FIXUP_ASUS_GX502_HP,
6931 ALC294_FIXUP_ASUS_GX502_PINS,
6932 ALC294_FIXUP_ASUS_GX502_VERBS,
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05006933 ALC294_FIXUP_ASUS_GU502_HP,
6934 ALC294_FIXUP_ASUS_GU502_PINS,
6935 ALC294_FIXUP_ASUS_GU502_VERBS,
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08006936 ALC285_FIXUP_HP_GPIO_LED,
Kailang Yang431e76c2020-04-07 14:40:20 +08006937 ALC285_FIXUP_HP_MUTE_LED,
Jeremy Szue7d66cf2021-03-16 15:46:24 +08006938 ALC236_FIXUP_HP_GPIO_LED,
Kailang Yang24164f42020-04-07 14:52:42 +08006939 ALC236_FIXUP_HP_MUTE_LED,
Jonas Witschel75b62ab2021-04-16 12:58:54 +02006940 ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
Mike Pozulp14425f12020-05-09 20:28:37 -07006941 ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET,
Chris Chiu9e433422020-05-12 14:15:24 +08006942 ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08006943 ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS,
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08006944 ALC269VC_FIXUP_ACER_HEADSET_MIC,
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08006945 ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE,
Armas Spann293a92c2020-07-24 16:08:37 +02006946 ALC289_FIXUP_ASUS_GA401,
Armas Spann4b43d052020-07-24 16:06:16 +02006947 ALC289_FIXUP_ASUS_GA502,
Jian-Hong Panf50a1212020-07-13 14:04:22 +08006948 ALC256_FIXUP_ACER_MIC_NO_PRESENCE,
Kailang Yang56496252020-07-29 15:09:27 +08006949 ALC285_FIXUP_HP_GPIO_AMP_INIT,
Huacai Chenf1ec5be2020-08-02 17:26:40 +08006950 ALC269_FIXUP_CZC_B20,
6951 ALC269_FIXUP_CZC_TMI,
6952 ALC269_FIXUP_CZC_L101,
6953 ALC269_FIXUP_LEMOTE_A1802,
6954 ALC269_FIXUP_LEMOTE_A190X,
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08006955 ALC256_FIXUP_INTEL_NUC8_RUGGED,
Phil Calvind1ee66c2021-04-15 18:01:29 -04006956 ALC233_FIXUP_INTEL_NUC8_DMIC,
6957 ALC233_FIXUP_INTEL_NUC8_BOOST,
Werner Sembach73e71612021-03-02 19:04:14 +01006958 ALC256_FIXUP_INTEL_NUC10,
Hui Wangfc19d552020-09-09 10:00:41 +08006959 ALC255_FIXUP_XIAOMI_HEADSET_MIC,
Hui Wang13468bf2020-09-28 16:01:17 +08006960 ALC274_FIXUP_HP_MIC,
Kailang Yang8a8de09c2020-10-27 16:46:38 +08006961 ALC274_FIXUP_HP_HEADSET_MIC,
Takashi Iwai622464c2021-05-04 11:18:02 +02006962 ALC274_FIXUP_HP_ENVY_GPIO,
Kailang Yangef9ce662020-11-03 15:40:35 +08006963 ALC256_FIXUP_ASUS_HPE,
Kailang Yang446b8182020-11-02 15:00:12 +08006964 ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Kailang Yanga0ccbc52020-11-06 15:20:38 +08006965 ALC287_FIXUP_HP_GPIO_LED,
Kailang Yang9e885772020-11-03 15:30:51 +08006966 ALC256_FIXUP_HP_HEADSET_MIC,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01006967 ALC245_FIXUP_HP_GPIO_LED,
Kailang Yang92666d42020-11-19 17:04:21 +08006968 ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
Chris Chiu34cdf402020-12-16 20:52:00 +08006969 ALC282_FIXUP_ACER_DISABLE_LINEOUT,
Chris Chiu495dc762021-01-14 16:27:28 +08006970 ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST,
Chris Chiud0e18562021-02-26 09:04:40 +08006971 ALC256_FIXUP_ACER_HEADSET_MIC,
Takashi Iwai26928ca2021-04-16 10:12:11 +02006972 ALC285_FIXUP_IDEAPAD_S740_COEF,
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08006973 ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02006974 ALC295_FIXUP_ASUS_DACS,
Takashi Iwai5d84b532021-05-04 14:18:32 +02006975 ALC295_FIXUP_HP_OMEN,
Elia Devitof2be77f2021-05-11 14:46:49 +02006976 ALC285_FIXUP_HP_SPECTRE_X360,
Hui Wang9ebaef02021-05-22 12:26:45 +08006977 ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP,
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03006978 ALC623_FIXUP_LENOVO_THINKSTATION_P340,
Hui Wang57c9e212021-06-08 10:46:00 +08006979 ALC255_FIXUP_ACER_HEADPHONE_AND_MIC,
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08006980 ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST,
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07006981 ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS,
6982 ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
6983 ALC287_FIXUP_YOGA7_14ITL_SPEAKERS,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02006984 ALC287_FIXUP_13S_GEN2_SPEAKERS,
Werner Sembach619764c2021-12-02 17:50:10 +01006985 ALC256_FIXUP_SET_COEF_DEFAULTS,
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06006986 ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE,
Werner Sembach174a7fb2021-11-12 12:07:04 +01006987 ALC233_FIXUP_NO_AUDIO_JACK,
Werner Sembachedca7cc2021-12-15 20:16:46 +01006988 ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME,
Baole Fang8f4c9042022-01-05 22:08:54 +08006989 ALC285_FIXUP_LEGION_Y9000X_SPEAKERS,
6990 ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
Lucas Tanured3dca022021-12-17 11:57:07 +00006991 ALC287_FIXUP_LEGION_16ACHG6,
Stefan Bindingae7abe32021-12-17 11:57:08 +00006992 ALC287_FIXUP_CS35L41_I2C_2,
Alexander Sergeyev91502a92022-01-14 19:50:50 +03006993 ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED,
Takashi Iwai1d045db2011-07-07 18:23:21 +02006994};
6995
Takashi Iwai1727a772013-01-10 09:52:52 +01006996static const struct hda_fixup alc269_fixups[] = {
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08006997 [ALC269_FIXUP_GPIO2] = {
6998 .type = HDA_FIXUP_FUNC,
6999 .v.func = alc_fixup_gpio2,
7000 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007001 [ALC269_FIXUP_SONY_VAIO] = {
Takashi Iwaifd108212013-01-10 10:18:14 +01007002 .type = HDA_FIXUP_PINCTLS,
7003 .v.pins = (const struct hda_pintbl[]) {
7004 {0x19, PIN_VREFGRD},
Takashi Iwai1d045db2011-07-07 18:23:21 +02007005 {}
7006 }
7007 },
7008 [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007009 .type = HDA_FIXUP_FUNC,
7010 .v.func = alc275_fixup_gpio4_off,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007011 .chained = true,
7012 .chain_id = ALC269_FIXUP_SONY_VAIO
7013 },
7014 [ALC269_FIXUP_DELL_M101Z] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007015 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007016 .v.verbs = (const struct hda_verb[]) {
7017 /* Enables internal speaker */
7018 {0x20, AC_VERB_SET_COEF_INDEX, 13},
7019 {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
7020 {}
7021 }
7022 },
7023 [ALC269_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007024 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +02007025 .v.func = alc_fixup_sku_ignore,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007026 },
7027 [ALC269_FIXUP_ASUS_G73JW] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007028 .type = HDA_FIXUP_PINS,
7029 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02007030 { 0x17, 0x99130111 }, /* subwoofer */
7031 { }
7032 }
7033 },
7034 [ALC269_FIXUP_LENOVO_EAPD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007035 .type = HDA_FIXUP_VERBS,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007036 .v.verbs = (const struct hda_verb[]) {
7037 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
7038 {}
7039 }
7040 },
7041 [ALC275_FIXUP_SONY_HWEQ] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007042 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007043 .v.func = alc269_fixup_hweq,
7044 .chained = true,
7045 .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
7046 },
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02007047 [ALC275_FIXUP_SONY_DISABLE_AAMIX] = {
7048 .type = HDA_FIXUP_FUNC,
7049 .v.func = alc_fixup_disable_aamix,
7050 .chained = true,
7051 .chain_id = ALC269_FIXUP_SONY_VAIO
7052 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02007053 [ALC271_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007054 .type = HDA_FIXUP_FUNC,
Takashi Iwai1d045db2011-07-07 18:23:21 +02007055 .v.func = alc271_fixup_dmic,
7056 },
Takashi Iwai017f2a12011-07-09 14:42:25 +02007057 [ALC269_FIXUP_PCM_44K] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007058 .type = HDA_FIXUP_FUNC,
Takashi Iwai017f2a12011-07-09 14:42:25 +02007059 .v.func = alc269_fixup_pcm_44k,
David Henningsson012e7eb2012-08-08 08:43:37 +02007060 .chained = true,
7061 .chain_id = ALC269_FIXUP_QUANTA_MUTE
Takashi Iwai017f2a12011-07-09 14:42:25 +02007062 },
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007063 [ALC269_FIXUP_STEREO_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007064 .type = HDA_FIXUP_FUNC,
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02007065 .v.func = alc269_fixup_stereo_dmic,
7066 },
David Henningsson7c478f02013-10-11 10:18:46 +02007067 [ALC269_FIXUP_HEADSET_MIC] = {
7068 .type = HDA_FIXUP_FUNC,
7069 .v.func = alc269_fixup_headset_mic,
7070 },
Takashi Iwai24519912011-08-16 15:08:49 +02007071 [ALC269_FIXUP_QUANTA_MUTE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007072 .type = HDA_FIXUP_FUNC,
Takashi Iwai24519912011-08-16 15:08:49 +02007073 .v.func = alc269_fixup_quanta_mute,
7074 },
7075 [ALC269_FIXUP_LIFEBOOK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007076 .type = HDA_FIXUP_PINS,
7077 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai24519912011-08-16 15:08:49 +02007078 { 0x1a, 0x2101103f }, /* dock line-out */
7079 { 0x1b, 0x23a11040 }, /* dock mic-in */
7080 { }
7081 },
7082 .chained = true,
7083 .chain_id = ALC269_FIXUP_QUANTA_MUTE
7084 },
David Henningsson2041d562014-06-13 11:15:44 +02007085 [ALC269_FIXUP_LIFEBOOK_EXTMIC] = {
7086 .type = HDA_FIXUP_PINS,
7087 .v.pins = (const struct hda_pintbl[]) {
7088 { 0x19, 0x01a1903c }, /* headset mic, with jack detect */
7089 { }
7090 },
7091 },
Takashi Iwaicc7016a2015-04-08 20:47:55 +02007092 [ALC269_FIXUP_LIFEBOOK_HP_PIN] = {
7093 .type = HDA_FIXUP_PINS,
7094 .v.pins = (const struct hda_pintbl[]) {
7095 { 0x21, 0x0221102f }, /* HP out */
7096 { }
7097 },
7098 },
Takashi Iwai4df3fd12015-06-29 08:38:02 +02007099 [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = {
7100 .type = HDA_FIXUP_FUNC,
7101 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
7102 },
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01007103 [ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC] = {
7104 .type = HDA_FIXUP_FUNC,
7105 .v.func = alc269_fixup_pincfg_U7x7_headset_mic,
7106 },
Takashi Iwaia4297b52011-08-23 18:40:12 +02007107 [ALC269_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007108 .type = HDA_FIXUP_PINS,
7109 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007110 { 0x14, 0x99130110 }, /* speaker */
7111 { 0x15, 0x0121401f }, /* HP out */
7112 { 0x18, 0x01a19c20 }, /* mic */
7113 { 0x19, 0x99a3092f }, /* int-mic */
7114 { }
7115 },
7116 },
7117 [ALC269_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007118 .type = HDA_FIXUP_PINS,
7119 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007120 { 0x12, 0x99a3092f }, /* int-mic */
7121 { 0x14, 0x99130110 }, /* speaker */
7122 { 0x15, 0x0121401f }, /* HP out */
7123 { 0x18, 0x01a19c20 }, /* mic */
7124 { }
7125 },
7126 },
7127 [ALC269VB_FIXUP_AMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007128 .type = HDA_FIXUP_PINS,
7129 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007130 { 0x14, 0x99130110 }, /* speaker */
7131 { 0x18, 0x01a19c20 }, /* mic */
7132 { 0x19, 0x99a3092f }, /* int-mic */
7133 { 0x21, 0x0121401f }, /* HP out */
7134 { }
7135 },
7136 },
David Henningsson2267ea92012-01-03 08:45:56 +01007137 [ALC269VB_FIXUP_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007138 .type = HDA_FIXUP_PINS,
7139 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaia4297b52011-08-23 18:40:12 +02007140 { 0x12, 0x99a3092f }, /* int-mic */
7141 { 0x14, 0x99130110 }, /* speaker */
7142 { 0x18, 0x01a19c20 }, /* mic */
7143 { 0x21, 0x0121401f }, /* HP out */
7144 { }
7145 },
7146 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007147 [ALC269_FIXUP_HP_MUTE_LED] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007148 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007149 .v.func = alc269_fixup_hp_mute_led,
David Henningsson6d3cd5d2013-01-07 12:03:47 +01007150 },
David Henningssond06ac142013-02-18 11:41:55 +01007151 [ALC269_FIXUP_HP_MUTE_LED_MIC1] = {
7152 .type = HDA_FIXUP_FUNC,
7153 .v.func = alc269_fixup_hp_mute_led_mic1,
7154 },
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007155 [ALC269_FIXUP_HP_MUTE_LED_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007156 .type = HDA_FIXUP_FUNC,
Takashi Iwai08fb0d02013-01-10 17:33:58 +01007157 .v.func = alc269_fixup_hp_mute_led_mic2,
Takashi Iwai420b0fe2012-03-12 12:35:27 +01007158 },
Tom Briden7f783bd2017-03-25 10:12:01 +00007159 [ALC269_FIXUP_HP_MUTE_LED_MIC3] = {
7160 .type = HDA_FIXUP_FUNC,
7161 .v.func = alc269_fixup_hp_mute_led_mic3,
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007162 .chained = true,
7163 .chain_id = ALC295_FIXUP_HP_AUTO_MUTE
Tom Briden7f783bd2017-03-25 10:12:01 +00007164 },
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01007165 [ALC269_FIXUP_HP_GPIO_LED] = {
7166 .type = HDA_FIXUP_FUNC,
7167 .v.func = alc269_fixup_hp_gpio_led,
7168 },
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08007169 [ALC269_FIXUP_HP_GPIO_MIC1_LED] = {
7170 .type = HDA_FIXUP_FUNC,
7171 .v.func = alc269_fixup_hp_gpio_mic1_led,
7172 },
7173 [ALC269_FIXUP_HP_LINE1_MIC1_LED] = {
7174 .type = HDA_FIXUP_FUNC,
7175 .v.func = alc269_fixup_hp_line1_mic1_led,
7176 },
David Henningsson693b6132012-06-22 19:12:10 +02007177 [ALC269_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007178 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +02007179 .v.func = alc_fixup_inv_dmic,
David Henningsson693b6132012-06-22 19:12:10 +02007180 },
Takashi Iwai9b745ab2014-03-07 08:37:19 +01007181 [ALC269_FIXUP_NO_SHUTUP] = {
7182 .type = HDA_FIXUP_FUNC,
7183 .v.func = alc_fixup_no_shutup,
7184 },
David Henningsson108cc102012-07-20 10:37:25 +02007185 [ALC269_FIXUP_LENOVO_DOCK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007186 .type = HDA_FIXUP_PINS,
7187 .v.pins = (const struct hda_pintbl[]) {
David Henningsson108cc102012-07-20 10:37:25 +02007188 { 0x19, 0x23a11040 }, /* dock mic */
7189 { 0x1b, 0x2121103f }, /* dock headphone */
7190 { }
7191 },
7192 .chained = true,
7193 .chain_id = ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT
7194 },
Takashi Iwaib590b382020-05-14 18:05:33 +02007195 [ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST] = {
7196 .type = HDA_FIXUP_FUNC,
7197 .v.func = alc269_fixup_limit_int_mic_boost,
7198 .chained = true,
7199 .chain_id = ALC269_FIXUP_LENOVO_DOCK,
7200 },
David Henningsson108cc102012-07-20 10:37:25 +02007201 [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007202 .type = HDA_FIXUP_FUNC,
David Henningsson108cc102012-07-20 10:37:25 +02007203 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
David Henningsson52129002013-11-19 10:25:53 +01007204 .chained = true,
7205 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson108cc102012-07-20 10:37:25 +02007206 },
David Henningsson73bdd592013-04-15 15:44:14 +02007207 [ALC269_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7208 .type = HDA_FIXUP_PINS,
7209 .v.pins = (const struct hda_pintbl[]) {
7210 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7211 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7212 { }
7213 },
7214 .chained = true,
7215 .chain_id = ALC269_FIXUP_HEADSET_MODE
7216 },
7217 [ALC269_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7218 .type = HDA_FIXUP_PINS,
7219 .v.pins = (const struct hda_pintbl[]) {
7220 { 0x16, 0x21014020 }, /* dock line out */
7221 { 0x19, 0x21a19030 }, /* dock mic */
7222 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7223 { }
7224 },
7225 .chained = true,
7226 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7227 },
David Henningsson338cae52013-10-07 10:39:59 +02007228 [ALC269_FIXUP_DELL3_MIC_NO_PRESENCE] = {
7229 .type = HDA_FIXUP_PINS,
7230 .v.pins = (const struct hda_pintbl[]) {
7231 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7232 { }
7233 },
7234 .chained = true,
7235 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7236 },
Kailang Yangfcc6c872017-06-29 15:21:27 +08007237 [ALC269_FIXUP_DELL4_MIC_NO_PRESENCE] = {
7238 .type = HDA_FIXUP_PINS,
7239 .v.pins = (const struct hda_pintbl[]) {
7240 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7241 { 0x1b, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7242 { }
7243 },
7244 .chained = true,
7245 .chain_id = ALC269_FIXUP_HEADSET_MODE
7246 },
David Henningsson73bdd592013-04-15 15:44:14 +02007247 [ALC269_FIXUP_HEADSET_MODE] = {
7248 .type = HDA_FIXUP_FUNC,
7249 .v.func = alc_fixup_headset_mode,
Hui Wang6676f302014-11-18 17:57:41 +08007250 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007251 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
David Henningsson73bdd592013-04-15 15:44:14 +02007252 },
7253 [ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7254 .type = HDA_FIXUP_FUNC,
7255 .v.func = alc_fixup_headset_mode_no_hp_mic,
7256 },
Takashi Iwai78197172015-06-27 10:21:13 +02007257 [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = {
7258 .type = HDA_FIXUP_PINS,
7259 .v.pins = (const struct hda_pintbl[]) {
7260 { 0x19, 0x01a1913c }, /* headset mic w/o jack detect */
7261 { }
7262 },
7263 .chained = true,
7264 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7265 },
David Henningsson88cfcf82013-10-11 10:18:45 +02007266 [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = {
7267 .type = HDA_FIXUP_PINS,
7268 .v.pins = (const struct hda_pintbl[]) {
7269 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7270 { }
7271 },
David Henningssonfbc78ad2013-10-11 13:46:04 +02007272 .chained = true,
7273 .chain_id = ALC269_FIXUP_HEADSET_MIC
David Henningsson88cfcf82013-10-11 10:18:45 +02007274 },
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04007275 [ALC256_FIXUP_HUAWEI_MACH_WX9_PINS] = {
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007276 .type = HDA_FIXUP_PINS,
7277 .v.pins = (const struct hda_pintbl[]) {
7278 {0x12, 0x90a60130},
7279 {0x13, 0x40000000},
7280 {0x14, 0x90170110},
7281 {0x18, 0x411111f0},
7282 {0x19, 0x04a11040},
7283 {0x1a, 0x411111f0},
7284 {0x1b, 0x90170112},
7285 {0x1d, 0x40759a05},
7286 {0x1e, 0x411111f0},
7287 {0x21, 0x04211020},
7288 { }
7289 },
Ayman Bagabase2744fd2018-12-12 18:07:59 -05007290 .chained = true,
7291 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Ayman Bagabas8ac51bb2018-12-12 18:07:57 -05007292 },
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02007293 [ALC298_FIXUP_HUAWEI_MBX_STEREO] = {
7294 .type = HDA_FIXUP_FUNC,
7295 .v.func = alc298_fixup_huawei_mbx_stereo,
7296 .chained = true,
7297 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
7298 },
David Henningssond240d1d2013-04-15 12:50:02 +02007299 [ALC269_FIXUP_ASUS_X101_FUNC] = {
7300 .type = HDA_FIXUP_FUNC,
7301 .v.func = alc269_fixup_x101_headset_mic,
7302 },
7303 [ALC269_FIXUP_ASUS_X101_VERB] = {
7304 .type = HDA_FIXUP_VERBS,
7305 .v.verbs = (const struct hda_verb[]) {
7306 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0},
7307 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
7308 {0x20, AC_VERB_SET_PROC_COEF, 0x0310},
7309 { }
7310 },
7311 .chained = true,
7312 .chain_id = ALC269_FIXUP_ASUS_X101_FUNC
7313 },
7314 [ALC269_FIXUP_ASUS_X101] = {
7315 .type = HDA_FIXUP_PINS,
7316 .v.pins = (const struct hda_pintbl[]) {
7317 { 0x18, 0x04a1182c }, /* Headset mic */
7318 { }
7319 },
7320 .chained = true,
7321 .chain_id = ALC269_FIXUP_ASUS_X101_VERB
7322 },
Dylan Reid08a978d2012-11-18 22:56:40 -08007323 [ALC271_FIXUP_AMIC_MIC2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007324 .type = HDA_FIXUP_PINS,
7325 .v.pins = (const struct hda_pintbl[]) {
Dylan Reid08a978d2012-11-18 22:56:40 -08007326 { 0x14, 0x99130110 }, /* speaker */
7327 { 0x19, 0x01a19c20 }, /* mic */
7328 { 0x1b, 0x99a7012f }, /* int-mic */
7329 { 0x21, 0x0121401f }, /* HP out */
7330 { }
7331 },
7332 },
7333 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
Takashi Iwai1727a772013-01-10 09:52:52 +01007334 .type = HDA_FIXUP_FUNC,
Dylan Reid08a978d2012-11-18 22:56:40 -08007335 .v.func = alc271_hp_gate_mic_jack,
7336 .chained = true,
7337 .chain_id = ALC271_FIXUP_AMIC_MIC2,
7338 },
Oleksij Rempelb1e89722013-12-04 20:50:53 +01007339 [ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572] = {
7340 .type = HDA_FIXUP_FUNC,
7341 .v.func = alc269_fixup_limit_int_mic_boost,
7342 .chained = true,
7343 .chain_id = ALC271_FIXUP_HP_GATE_MIC_JACK,
7344 },
Dylan Reid42397002013-04-05 14:58:22 -07007345 [ALC269_FIXUP_ACER_AC700] = {
7346 .type = HDA_FIXUP_PINS,
7347 .v.pins = (const struct hda_pintbl[]) {
7348 { 0x12, 0x99a3092f }, /* int-mic */
7349 { 0x14, 0x99130110 }, /* speaker */
7350 { 0x18, 0x03a11c20 }, /* mic */
7351 { 0x1e, 0x0346101e }, /* SPDIF1 */
7352 { 0x21, 0x0321101f }, /* HP out */
7353 { }
7354 },
7355 .chained = true,
7356 .chain_id = ALC271_FIXUP_DMIC,
7357 },
David Henningsson3e0d6112013-04-22 14:30:14 +02007358 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
7359 .type = HDA_FIXUP_FUNC,
7360 .v.func = alc269_fixup_limit_int_mic_boost,
David Henningsson27937692013-11-18 11:51:47 +01007361 .chained = true,
7362 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
David Henningsson3e0d6112013-04-22 14:30:14 +02007363 },
Oleksij Rempel2cede302013-11-27 17:12:03 +01007364 [ALC269VB_FIXUP_ASUS_ZENBOOK] = {
7365 .type = HDA_FIXUP_FUNC,
7366 .v.func = alc269_fixup_limit_int_mic_boost,
7367 .chained = true,
7368 .chain_id = ALC269VB_FIXUP_DMIC,
7369 },
Takashi Iwai23870832013-11-29 14:13:12 +01007370 [ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
7371 .type = HDA_FIXUP_VERBS,
7372 .v.verbs = (const struct hda_verb[]) {
7373 /* class-D output amp +5dB */
7374 { 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
7375 { 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
7376 {}
7377 },
7378 .chained = true,
7379 .chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
7380 },
David Henningsson8e35cd42013-11-06 11:20:01 +01007381 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
7382 .type = HDA_FIXUP_FUNC,
7383 .v.func = alc269_fixup_limit_int_mic_boost,
7384 .chained = true,
7385 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC1,
7386 },
Anisse Astier02b504d2013-06-03 11:53:10 +02007387 [ALC269VB_FIXUP_ORDISSIMO_EVE2] = {
7388 .type = HDA_FIXUP_PINS,
7389 .v.pins = (const struct hda_pintbl[]) {
7390 { 0x12, 0x99a3092f }, /* int-mic */
7391 { 0x18, 0x03a11d20 }, /* mic */
7392 { 0x19, 0x411111f0 }, /* Unused bogus pin */
7393 { }
7394 },
7395 },
Kailang Yangcd217a62013-08-22 10:15:24 +02007396 [ALC283_FIXUP_CHROME_BOOK] = {
7397 .type = HDA_FIXUP_FUNC,
7398 .v.func = alc283_fixup_chromebook,
7399 },
Kailang Yang0202e992013-12-02 15:20:15 +08007400 [ALC283_FIXUP_SENSE_COMBO_JACK] = {
7401 .type = HDA_FIXUP_FUNC,
7402 .v.func = alc283_fixup_sense_combo_jack,
7403 .chained = true,
7404 .chain_id = ALC283_FIXUP_CHROME_BOOK,
7405 },
Takashi Iwai7bba2152013-09-06 15:45:38 +02007406 [ALC282_FIXUP_ASUS_TX300] = {
7407 .type = HDA_FIXUP_FUNC,
7408 .v.func = alc282_fixup_asus_tx300,
7409 },
Kailang Yang1bb3e062013-09-27 13:10:25 +02007410 [ALC283_FIXUP_INT_MIC] = {
7411 .type = HDA_FIXUP_VERBS,
7412 .v.verbs = (const struct hda_verb[]) {
7413 {0x20, AC_VERB_SET_COEF_INDEX, 0x1a},
7414 {0x20, AC_VERB_SET_PROC_COEF, 0x0011},
7415 { }
7416 },
7417 .chained = true,
7418 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7419 },
David Henningsson0f4881d2013-12-20 16:08:13 +01007420 [ALC290_FIXUP_SUBWOOFER_HSJACK] = {
7421 .type = HDA_FIXUP_PINS,
7422 .v.pins = (const struct hda_pintbl[]) {
7423 { 0x17, 0x90170112 }, /* subwoofer */
7424 { }
7425 },
7426 .chained = true,
7427 .chain_id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK,
7428 },
7429 [ALC290_FIXUP_SUBWOOFER] = {
7430 .type = HDA_FIXUP_PINS,
7431 .v.pins = (const struct hda_pintbl[]) {
7432 { 0x17, 0x90170112 }, /* subwoofer */
7433 { }
7434 },
7435 .chained = true,
7436 .chain_id = ALC290_FIXUP_MONO_SPEAKERS,
7437 },
David Henningsson338cae52013-10-07 10:39:59 +02007438 [ALC290_FIXUP_MONO_SPEAKERS] = {
7439 .type = HDA_FIXUP_FUNC,
7440 .v.func = alc290_fixup_mono_speakers,
David Henningsson0f4881d2013-12-20 16:08:13 +01007441 },
7442 [ALC290_FIXUP_MONO_SPEAKERS_HSJACK] = {
7443 .type = HDA_FIXUP_FUNC,
7444 .v.func = alc290_fixup_mono_speakers,
David Henningsson338cae52013-10-07 10:39:59 +02007445 .chained = true,
7446 .chain_id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
7447 },
David Henningssonb67ae3f2013-11-05 13:11:37 +01007448 [ALC269_FIXUP_THINKPAD_ACPI] = {
7449 .type = HDA_FIXUP_FUNC,
Takashi Iwaid5a6cab2018-06-13 12:43:10 +02007450 .v.func = alc_fixup_thinkpad_acpi,
Takashi Iwai09da1112016-09-08 12:15:02 +02007451 .chained = true,
7452 .chain_id = ALC269_FIXUP_SKU_IGNORE,
David Henningssonb67ae3f2013-11-05 13:11:37 +01007453 },
David Henningsson56f27012016-01-11 09:33:14 +01007454 [ALC269_FIXUP_DMIC_THINKPAD_ACPI] = {
7455 .type = HDA_FIXUP_FUNC,
7456 .v.func = alc_fixup_inv_dmic,
7457 .chained = true,
7458 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
7459 },
Chris Chiu5824ce82017-02-28 14:17:11 -06007460 [ALC255_FIXUP_ACER_MIC_NO_PRESENCE] = {
Hui Wang17d30462019-06-14 16:44:12 +08007461 .type = HDA_FIXUP_PINS,
7462 .v.pins = (const struct hda_pintbl[]) {
7463 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7464 { }
Chris Chiu5824ce82017-02-28 14:17:11 -06007465 },
7466 .chained = true,
Hui Wang17d30462019-06-14 16:44:12 +08007467 .chain_id = ALC255_FIXUP_HEADSET_MODE
Chris Chiu5824ce82017-02-28 14:17:11 -06007468 },
Chris Chiu615966a2017-02-28 14:17:12 -06007469 [ALC255_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7470 .type = HDA_FIXUP_PINS,
7471 .v.pins = (const struct hda_pintbl[]) {
7472 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7473 { }
7474 },
7475 .chained = true,
7476 .chain_id = ALC255_FIXUP_HEADSET_MODE
7477 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007478 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7479 .type = HDA_FIXUP_PINS,
7480 .v.pins = (const struct hda_pintbl[]) {
7481 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7482 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7483 { }
7484 },
7485 .chained = true,
7486 .chain_id = ALC255_FIXUP_HEADSET_MODE
7487 },
Kailang Yang31278992014-03-03 15:27:22 +08007488 [ALC255_FIXUP_DELL2_MIC_NO_PRESENCE] = {
7489 .type = HDA_FIXUP_PINS,
7490 .v.pins = (const struct hda_pintbl[]) {
7491 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7492 { }
7493 },
7494 .chained = true,
7495 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
7496 },
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007497 [ALC255_FIXUP_HEADSET_MODE] = {
7498 .type = HDA_FIXUP_FUNC,
7499 .v.func = alc_fixup_headset_mode_alc255,
Hui Wang4a83d422014-11-18 17:57:40 +08007500 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007501 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yang9a22a8f52013-11-08 15:54:49 +08007502 },
Kailang Yang31278992014-03-03 15:27:22 +08007503 [ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC] = {
7504 .type = HDA_FIXUP_FUNC,
7505 .v.func = alc_fixup_headset_mode_alc255_no_hp_mic,
7506 },
Kailang Yanga22aa262014-04-23 17:34:28 +08007507 [ALC293_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7508 .type = HDA_FIXUP_PINS,
7509 .v.pins = (const struct hda_pintbl[]) {
7510 { 0x18, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7511 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7512 { }
7513 },
7514 .chained = true,
7515 .chain_id = ALC269_FIXUP_HEADSET_MODE
7516 },
Takashi Iwai1c37c222014-05-06 17:34:42 +02007517 [ALC292_FIXUP_TPT440_DOCK] = {
David Henningssonec56af62015-06-24 10:46:33 +02007518 .type = HDA_FIXUP_FUNC,
Takashi Iwai7f57d802015-09-24 17:36:51 +02007519 .v.func = alc_fixup_tpt440_dock,
Takashi Iwai1c37c222014-05-06 17:34:42 +02007520 .chained = true,
7521 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
7522 },
Takashi Iwai9a811232015-12-09 15:17:43 +01007523 [ALC292_FIXUP_TPT440] = {
7524 .type = HDA_FIXUP_FUNC,
Takashi Iwai157f0b72015-12-10 23:30:43 +01007525 .v.func = alc_fixup_disable_aamix,
Takashi Iwai9a811232015-12-09 15:17:43 +01007526 .chained = true,
7527 .chain_id = ALC292_FIXUP_TPT440_DOCK,
7528 },
Anisse Astierabaa22742016-08-24 09:14:13 +02007529 [ALC283_FIXUP_HEADSET_MIC] = {
Daniel Drake9dc12862014-07-22 10:58:29 +01007530 .type = HDA_FIXUP_PINS,
7531 .v.pins = (const struct hda_pintbl[]) {
7532 { 0x19, 0x04a110f0 },
7533 { },
7534 },
7535 },
Takashi Iwaib3802782018-11-26 17:47:46 +01007536 [ALC255_FIXUP_MIC_MUTE_LED] = {
Hui Wang00ef9942014-07-31 11:52:38 +08007537 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007538 .v.func = alc_fixup_micmute_led,
Hui Wang00ef9942014-07-31 11:52:38 +08007539 },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007540 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
7541 .type = HDA_FIXUP_PINS,
7542 .v.pins = (const struct hda_pintbl[]) {
7543 { 0x12, 0x90a60130 },
7544 { 0x14, 0x90170110 },
7545 { 0x17, 0x40000008 },
7546 { 0x18, 0x411111f0 },
Mateusz Sylwestrzak04206942015-07-19 17:38:56 +02007547 { 0x19, 0x01a1913c },
Takashi Iwai1a22e772014-08-27 08:19:05 +02007548 { 0x1a, 0x411111f0 },
7549 { 0x1b, 0x411111f0 },
7550 { 0x1d, 0x40f89b2d },
7551 { 0x1e, 0x411111f0 },
7552 { 0x21, 0x0321101f },
7553 { },
7554 },
7555 },
Takashi Iwaic8426b22021-04-07 11:57:30 +02007556 [ALC269VB_FIXUP_ASPIRE_E1_COEF] = {
7557 .type = HDA_FIXUP_FUNC,
7558 .v.func = alc269vb_fixup_aspire_e1_coef,
7559 },
David Henningsson7a5255f2014-10-30 08:26:01 +01007560 [ALC280_FIXUP_HP_GPIO4] = {
7561 .type = HDA_FIXUP_FUNC,
7562 .v.func = alc280_fixup_hp_gpio4,
7563 },
Kailang Yangeaa8e5e2014-11-21 15:49:11 +08007564 [ALC286_FIXUP_HP_GPIO_LED] = {
7565 .type = HDA_FIXUP_FUNC,
7566 .v.func = alc286_fixup_hp_gpio_led,
7567 },
David Henningsson33f4acd2015-01-07 15:50:13 +01007568 [ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY] = {
7569 .type = HDA_FIXUP_FUNC,
7570 .v.func = alc280_fixup_hp_gpio2_mic_hotkey,
7571 },
TienFu Chenb4b33f92015-01-20 15:06:21 +01007572 [ALC280_FIXUP_HP_DOCK_PINS] = {
7573 .type = HDA_FIXUP_PINS,
7574 .v.pins = (const struct hda_pintbl[]) {
7575 { 0x1b, 0x21011020 }, /* line-out */
7576 { 0x1a, 0x01a1903c }, /* headset mic */
7577 { 0x18, 0x2181103f }, /* line-in */
7578 { },
7579 },
7580 .chained = true,
7581 .chain_id = ALC280_FIXUP_HP_GPIO4
7582 },
Jaroslav Kysela04d54662017-03-09 13:29:13 +01007583 [ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED] = {
7584 .type = HDA_FIXUP_PINS,
7585 .v.pins = (const struct hda_pintbl[]) {
7586 { 0x1b, 0x21011020 }, /* line-out */
7587 { 0x18, 0x2181103f }, /* line-in */
7588 { },
7589 },
7590 .chained = true,
7591 .chain_id = ALC269_FIXUP_HP_GPIO_MIC1_LED
7592 },
Keith Packard98973f22015-07-15 12:14:39 -07007593 [ALC280_FIXUP_HP_9480M] = {
7594 .type = HDA_FIXUP_FUNC,
7595 .v.func = alc280_fixup_hp_9480m,
7596 },
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007597 [ALC245_FIXUP_HP_X360_AMP] = {
7598 .type = HDA_FIXUP_FUNC,
7599 .v.func = alc245_fixup_hp_x360_amp,
Johnathon Clark5fc462c2021-10-20 14:12:51 +01007600 .chained = true,
7601 .chain_id = ALC245_FIXUP_HP_GPIO_LED
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01007602 },
Kailang Yange1e62b92015-04-08 16:01:22 +08007603 [ALC288_FIXUP_DELL_HEADSET_MODE] = {
7604 .type = HDA_FIXUP_FUNC,
7605 .v.func = alc_fixup_headset_mode_dell_alc288,
7606 .chained = true,
Takashi Iwaib3802782018-11-26 17:47:46 +01007607 .chain_id = ALC255_FIXUP_MIC_MUTE_LED
Kailang Yange1e62b92015-04-08 16:01:22 +08007608 },
7609 [ALC288_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7610 .type = HDA_FIXUP_PINS,
7611 .v.pins = (const struct hda_pintbl[]) {
7612 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7613 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7614 { }
7615 },
7616 .chained = true,
7617 .chain_id = ALC288_FIXUP_DELL_HEADSET_MODE
7618 },
Hui Wang831bfdf92015-06-26 12:35:17 +08007619 [ALC288_FIXUP_DISABLE_AAMIX] = {
7620 .type = HDA_FIXUP_FUNC,
7621 .v.func = alc_fixup_disable_aamix,
7622 .chained = true,
Takashi Iwaid44a6862018-06-19 23:04:03 +02007623 .chain_id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE
Hui Wang831bfdf92015-06-26 12:35:17 +08007624 },
7625 [ALC288_FIXUP_DELL_XPS_13] = {
7626 .type = HDA_FIXUP_FUNC,
7627 .v.func = alc_fixup_dell_xps13,
7628 .chained = true,
7629 .chain_id = ALC288_FIXUP_DISABLE_AAMIX
7630 },
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007631 [ALC292_FIXUP_DISABLE_AAMIX] = {
7632 .type = HDA_FIXUP_FUNC,
7633 .v.func = alc_fixup_disable_aamix,
Hui Wang831bfdf92015-06-26 12:35:17 +08007634 .chained = true,
7635 .chain_id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007636 },
David Henningssonc04017e2015-12-15 14:44:03 +01007637 [ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK] = {
7638 .type = HDA_FIXUP_FUNC,
7639 .v.func = alc_fixup_disable_aamix,
7640 .chained = true,
7641 .chain_id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE
7642 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007643 [ALC292_FIXUP_DELL_E7X_AAMIX] = {
Takashi Iwai8b99aba2015-06-15 11:59:32 +02007644 .type = HDA_FIXUP_FUNC,
7645 .v.func = alc_fixup_dell_xps13,
7646 .chained = true,
7647 .chain_id = ALC292_FIXUP_DISABLE_AAMIX
7648 },
Takashi Iwai5fab5822020-01-05 09:11:19 +01007649 [ALC292_FIXUP_DELL_E7X] = {
7650 .type = HDA_FIXUP_FUNC,
Takashi Iwai8a503552020-06-18 13:08:32 +02007651 .v.func = alc_fixup_micmute_led,
Takashi Iwai5fab5822020-01-05 09:11:19 +01007652 /* micmute fixup must be applied at last */
7653 .chained_before = true,
7654 .chain_id = ALC292_FIXUP_DELL_E7X_AAMIX,
7655 },
James McDonnell54324222019-09-16 14:53:38 +00007656 [ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE] = {
7657 .type = HDA_FIXUP_PINS,
7658 .v.pins = (const struct hda_pintbl[]) {
7659 { 0x18, 0x01a1913c }, /* headset mic w/o jack detect */
7660 { }
7661 },
7662 .chained_before = true,
7663 .chain_id = ALC269_FIXUP_HEADSET_MODE,
7664 },
Kailang Yang977e6272015-05-18 15:31:20 +08007665 [ALC298_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7666 .type = HDA_FIXUP_PINS,
7667 .v.pins = (const struct hda_pintbl[]) {
7668 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7669 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7670 { }
7671 },
7672 .chained = true,
7673 .chain_id = ALC269_FIXUP_HEADSET_MODE
7674 },
Hui Wang2f726ae2017-03-31 10:31:40 +08007675 [ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE] = {
7676 .type = HDA_FIXUP_PINS,
7677 .v.pins = (const struct hda_pintbl[]) {
7678 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7679 { }
7680 },
7681 .chained = true,
7682 .chain_id = ALC269_FIXUP_HEADSET_MODE
7683 },
Kailang Yang6ed11312015-10-26 15:37:39 +08007684 [ALC275_FIXUP_DELL_XPS] = {
7685 .type = HDA_FIXUP_VERBS,
7686 .v.verbs = (const struct hda_verb[]) {
7687 /* Enables internal speaker */
7688 {0x20, AC_VERB_SET_COEF_INDEX, 0x1f},
7689 {0x20, AC_VERB_SET_PROC_COEF, 0x00c0},
7690 {0x20, AC_VERB_SET_COEF_INDEX, 0x30},
7691 {0x20, AC_VERB_SET_PROC_COEF, 0x00b1},
7692 {}
7693 }
7694 },
Hui Wang23adc192015-12-08 12:27:18 +08007695 [ALC293_FIXUP_LENOVO_SPK_NOISE] = {
7696 .type = HDA_FIXUP_FUNC,
7697 .v.func = alc_fixup_disable_aamix,
7698 .chained = true,
7699 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
7700 },
Kailang3694cb22015-12-28 11:35:24 +08007701 [ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY] = {
7702 .type = HDA_FIXUP_FUNC,
7703 .v.func = alc233_fixup_lenovo_line2_mic_hotkey,
7704 },
Phil Calvind1ee66c2021-04-15 18:01:29 -04007705 [ALC233_FIXUP_INTEL_NUC8_DMIC] = {
7706 .type = HDA_FIXUP_FUNC,
7707 .v.func = alc_fixup_inv_dmic,
7708 .chained = true,
7709 .chain_id = ALC233_FIXUP_INTEL_NUC8_BOOST,
7710 },
7711 [ALC233_FIXUP_INTEL_NUC8_BOOST] = {
7712 .type = HDA_FIXUP_FUNC,
7713 .v.func = alc269_fixup_limit_int_mic_boost
7714 },
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08007715 [ALC255_FIXUP_DELL_SPK_NOISE] = {
7716 .type = HDA_FIXUP_FUNC,
7717 .v.func = alc_fixup_disable_aamix,
7718 .chained = true,
7719 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7720 },
Kailang Yangd1dd4212019-01-09 17:05:24 +08007721 [ALC225_FIXUP_DISABLE_MIC_VREF] = {
7722 .type = HDA_FIXUP_FUNC,
7723 .v.func = alc_fixup_disable_mic_vref,
7724 .chained = true,
7725 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7726 },
David Henningsson2ae95572016-02-25 09:37:05 +01007727 [ALC225_FIXUP_DELL1_MIC_NO_PRESENCE] = {
7728 .type = HDA_FIXUP_VERBS,
7729 .v.verbs = (const struct hda_verb[]) {
7730 /* Disable pass-through path for FRONT 14h */
7731 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
7732 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
7733 {}
7734 },
7735 .chained = true,
Kailang Yangd1dd4212019-01-09 17:05:24 +08007736 .chain_id = ALC225_FIXUP_DISABLE_MIC_VREF
David Henningsson2ae95572016-02-25 09:37:05 +01007737 },
Takashi Iwaif8839822016-02-25 14:31:59 +01007738 [ALC280_FIXUP_HP_HEADSET_MIC] = {
7739 .type = HDA_FIXUP_FUNC,
7740 .v.func = alc_fixup_disable_aamix,
7741 .chained = true,
7742 .chain_id = ALC269_FIXUP_HEADSET_MIC,
7743 },
Hui Wange549d192016-04-01 11:00:15 +08007744 [ALC221_FIXUP_HP_FRONT_MIC] = {
7745 .type = HDA_FIXUP_PINS,
7746 .v.pins = (const struct hda_pintbl[]) {
7747 { 0x19, 0x02a19020 }, /* Front Mic */
7748 { }
7749 },
7750 },
Sven Eckelmannc636b952016-04-11 16:55:26 +02007751 [ALC292_FIXUP_TPT460] = {
7752 .type = HDA_FIXUP_FUNC,
7753 .v.func = alc_fixup_tpt440_dock,
7754 .chained = true,
7755 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE,
7756 },
Hui Wangdd9aa332016-08-01 10:20:32 +08007757 [ALC298_FIXUP_SPK_VOLUME] = {
7758 .type = HDA_FIXUP_FUNC,
7759 .v.func = alc298_fixup_speaker_volume,
Hui Wang59ec4b52016-08-04 15:28:04 +08007760 .chained = true,
Hui Wang2f726ae2017-03-31 10:31:40 +08007761 .chain_id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE,
Hui Wangdd9aa332016-08-01 10:20:32 +08007762 },
Kailang Yangf86de9b2020-10-23 14:46:47 +08007763 [ALC298_FIXUP_LENOVO_SPK_VOLUME] = {
7764 .type = HDA_FIXUP_FUNC,
7765 .v.func = alc298_fixup_speaker_volume,
7766 },
Takashi Iwaie312a862018-03-06 12:14:17 +01007767 [ALC295_FIXUP_DISABLE_DAC3] = {
7768 .type = HDA_FIXUP_FUNC,
7769 .v.func = alc295_fixup_disable_dac3,
7770 },
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007771 [ALC285_FIXUP_SPEAKER2_TO_DAC1] = {
7772 .type = HDA_FIXUP_FUNC,
7773 .v.func = alc285_fixup_speaker2_to_dac1,
Hui Wangc37c0ab2020-02-19 13:23:06 +08007774 .chained = true,
7775 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01007776 },
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08007777 [ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER] = {
7778 .type = HDA_FIXUP_PINS,
7779 .v.pins = (const struct hda_pintbl[]) {
7780 { 0x1b, 0x90170151 },
7781 { }
7782 },
7783 .chained = true,
7784 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7785 },
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01007786 [ALC269_FIXUP_ATIV_BOOK_8] = {
7787 .type = HDA_FIXUP_FUNC,
7788 .v.func = alc_fixup_auto_mute_via_amp,
7789 .chained = true,
7790 .chain_id = ALC269_FIXUP_NO_SHUTUP
7791 },
Kailang Yang9eb5d0e2017-01-17 15:40:25 +08007792 [ALC221_FIXUP_HP_MIC_NO_PRESENCE] = {
7793 .type = HDA_FIXUP_PINS,
7794 .v.pins = (const struct hda_pintbl[]) {
7795 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7796 { 0x1a, 0x01a1913d }, /* use as headphone mic, without its own jack detect */
7797 { }
7798 },
7799 .chained = true,
7800 .chain_id = ALC269_FIXUP_HEADSET_MODE
7801 },
Chris Chiuc1732ed2017-02-28 14:17:13 -06007802 [ALC256_FIXUP_ASUS_HEADSET_MODE] = {
7803 .type = HDA_FIXUP_FUNC,
7804 .v.func = alc_fixup_headset_mode,
7805 },
7806 [ALC256_FIXUP_ASUS_MIC] = {
7807 .type = HDA_FIXUP_PINS,
7808 .v.pins = (const struct hda_pintbl[]) {
7809 { 0x13, 0x90a60160 }, /* use as internal mic */
7810 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7811 { }
7812 },
7813 .chained = true,
7814 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
7815 },
Chris Chiueeed4cd2017-02-28 14:17:15 -06007816 [ALC256_FIXUP_ASUS_AIO_GPIO2] = {
Takashi Iwaiae065f12018-06-19 23:00:03 +02007817 .type = HDA_FIXUP_FUNC,
7818 /* Set up GPIO2 for the speaker amp */
7819 .v.func = alc_fixup_gpio4,
Chris Chiueeed4cd2017-02-28 14:17:15 -06007820 },
Chris Chiu216d7ae2017-02-28 14:17:14 -06007821 [ALC233_FIXUP_ASUS_MIC_NO_PRESENCE] = {
7822 .type = HDA_FIXUP_PINS,
7823 .v.pins = (const struct hda_pintbl[]) {
7824 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7825 { }
7826 },
7827 .chained = true,
7828 .chain_id = ALC269_FIXUP_HEADSET_MIC
7829 },
7830 [ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE] = {
7831 .type = HDA_FIXUP_VERBS,
7832 .v.verbs = (const struct hda_verb[]) {
7833 /* Enables internal speaker */
7834 {0x20, AC_VERB_SET_COEF_INDEX, 0x40},
7835 {0x20, AC_VERB_SET_PROC_COEF, 0x8800},
7836 {}
7837 },
7838 .chained = true,
7839 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7840 },
Kailang Yangca169cc2017-04-25 16:17:40 +08007841 [ALC233_FIXUP_LENOVO_MULTI_CODECS] = {
7842 .type = HDA_FIXUP_FUNC,
7843 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
Kai-Heng Fengf73bbf62020-09-14 15:02:29 +08007844 .chained = true,
7845 .chain_id = ALC269_FIXUP_GPIO2
Kailang Yangca169cc2017-04-25 16:17:40 +08007846 },
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08007847 [ALC233_FIXUP_ACER_HEADSET_MIC] = {
7848 .type = HDA_FIXUP_VERBS,
7849 .v.verbs = (const struct hda_verb[]) {
7850 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
7851 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
7852 { }
7853 },
7854 .chained = true,
7855 .chain_id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE
7856 },
Hui Wangf33f79f2017-07-07 12:08:29 +08007857 [ALC294_FIXUP_LENOVO_MIC_LOCATION] = {
7858 .type = HDA_FIXUP_PINS,
7859 .v.pins = (const struct hda_pintbl[]) {
7860 /* Change the mic location from front to right, otherwise there are
7861 two front mics with the same name, pulseaudio can't handle them.
7862 This is just a temporary workaround, after applying this fixup,
7863 there will be one "Front Mic" and one "Mic" in this machine.
7864 */
7865 { 0x1a, 0x04a19040 },
7866 { }
7867 },
7868 },
Kailang Yang5f364132017-07-25 16:28:16 +08007869 [ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE] = {
7870 .type = HDA_FIXUP_PINS,
7871 .v.pins = (const struct hda_pintbl[]) {
7872 { 0x16, 0x0101102f }, /* Rear Headset HP */
7873 { 0x19, 0x02a1913c }, /* use as Front headset mic, without its own jack detect */
7874 { 0x1a, 0x01a19030 }, /* Rear Headset MIC */
7875 { 0x1b, 0x02011020 },
7876 { }
7877 },
7878 .chained = true,
Kai-Heng Feng52e4e362020-05-03 23:24:47 +08007879 .chain_id = ALC225_FIXUP_S3_POP_NOISE
7880 },
7881 [ALC225_FIXUP_S3_POP_NOISE] = {
7882 .type = HDA_FIXUP_FUNC,
7883 .v.func = alc225_fixup_s3_pop_noise,
7884 .chained = true,
Kailang Yang5f364132017-07-25 16:28:16 +08007885 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
7886 },
PeiSen Houb84e8432017-09-01 15:11:56 +08007887 [ALC700_FIXUP_INTEL_REFERENCE] = {
7888 .type = HDA_FIXUP_VERBS,
7889 .v.verbs = (const struct hda_verb[]) {
7890 /* Enables internal speaker */
7891 {0x20, AC_VERB_SET_COEF_INDEX, 0x45},
7892 {0x20, AC_VERB_SET_PROC_COEF, 0x5289},
7893 {0x20, AC_VERB_SET_COEF_INDEX, 0x4A},
7894 {0x20, AC_VERB_SET_PROC_COEF, 0x001b},
7895 {0x58, AC_VERB_SET_COEF_INDEX, 0x00},
7896 {0x58, AC_VERB_SET_PROC_COEF, 0x3888},
7897 {0x20, AC_VERB_SET_COEF_INDEX, 0x6f},
7898 {0x20, AC_VERB_SET_PROC_COEF, 0x2c0b},
7899 {}
7900 }
7901 },
Kailang Yang92266652017-12-14 15:28:58 +08007902 [ALC274_FIXUP_DELL_BIND_DACS] = {
7903 .type = HDA_FIXUP_FUNC,
7904 .v.func = alc274_fixup_bind_dacs,
7905 .chained = true,
7906 .chain_id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE
7907 },
7908 [ALC274_FIXUP_DELL_AIO_LINEOUT_VERB] = {
7909 .type = HDA_FIXUP_PINS,
7910 .v.pins = (const struct hda_pintbl[]) {
7911 { 0x1b, 0x0401102f },
7912 { }
7913 },
7914 .chained = true,
7915 .chain_id = ALC274_FIXUP_DELL_BIND_DACS
7916 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007917 [ALC298_FIXUP_TPT470_DOCK_FIX] = {
Kailang Yang61fcf8e2018-02-02 15:26:46 +08007918 .type = HDA_FIXUP_FUNC,
7919 .v.func = alc_fixup_tpt470_dock,
7920 .chained = true,
7921 .chain_id = ALC293_FIXUP_LENOVO_SPK_NOISE
7922 },
Takashi Iwai399c01a2020-05-26 08:24:06 +02007923 [ALC298_FIXUP_TPT470_DOCK] = {
7924 .type = HDA_FIXUP_FUNC,
7925 .v.func = alc_fixup_tpt470_dacs,
7926 .chained = true,
7927 .chain_id = ALC298_FIXUP_TPT470_DOCK_FIX
7928 },
Kailang Yangae104a22018-02-05 16:07:20 +08007929 [ALC255_FIXUP_DUMMY_LINEOUT_VERB] = {
7930 .type = HDA_FIXUP_PINS,
7931 .v.pins = (const struct hda_pintbl[]) {
7932 { 0x14, 0x0201101f },
7933 { }
7934 },
7935 .chained = true,
7936 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
7937 },
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007938 [ALC255_FIXUP_DELL_HEADSET_MIC] = {
7939 .type = HDA_FIXUP_PINS,
7940 .v.pins = (const struct hda_pintbl[]) {
7941 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7942 { }
7943 },
Hui Wang3ce0d5a2018-04-19 13:29:04 +08007944 .chained = true,
7945 .chain_id = ALC269_FIXUP_HEADSET_MIC
Kailang Yangf0ba9d62018-03-16 11:46:08 +08007946 },
Tom Bridenbbf8ff62018-05-29 17:34:20 +01007947 [ALC295_FIXUP_HP_X360] = {
7948 .type = HDA_FIXUP_FUNC,
7949 .v.func = alc295_fixup_hp_top_speakers,
7950 .chained = true,
7951 .chain_id = ALC269_FIXUP_HP_MUTE_LED_MIC3
Kailang Yang8a328ac2018-08-21 16:54:41 +08007952 },
7953 [ALC221_FIXUP_HP_HEADSET_MIC] = {
7954 .type = HDA_FIXUP_PINS,
7955 .v.pins = (const struct hda_pintbl[]) {
7956 { 0x19, 0x0181313f},
7957 { }
7958 },
7959 .chained = true,
7960 .chain_id = ALC269_FIXUP_HEADSET_MIC
7961 },
Hui Wangc4cfcf62018-11-26 14:17:16 +08007962 [ALC285_FIXUP_LENOVO_HEADPHONE_NOISE] = {
7963 .type = HDA_FIXUP_FUNC,
7964 .v.func = alc285_fixup_invalidate_dacs,
Hui Wang6ba189c2018-12-09 09:16:43 +08007965 .chained = true,
7966 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
Hui Wangc4cfcf62018-11-26 14:17:16 +08007967 },
Girija Kumar Kasinadhunie8ed64b2018-11-26 13:40:46 -05007968 [ALC295_FIXUP_HP_AUTO_MUTE] = {
7969 .type = HDA_FIXUP_FUNC,
7970 .v.func = alc_fixup_auto_mute_via_amp,
7971 },
Chris Chiu33aaebd2018-12-05 14:48:53 +08007972 [ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE] = {
7973 .type = HDA_FIXUP_PINS,
7974 .v.pins = (const struct hda_pintbl[]) {
7975 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
7976 { }
7977 },
7978 .chained = true,
7979 .chain_id = ALC269_FIXUP_HEADSET_MIC
7980 },
Chris Chiud8ae4582018-12-07 17:17:11 +08007981 [ALC294_FIXUP_ASUS_MIC] = {
7982 .type = HDA_FIXUP_PINS,
7983 .v.pins = (const struct hda_pintbl[]) {
7984 { 0x13, 0x90a60160 }, /* use as internal mic */
7985 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
7986 { }
7987 },
7988 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007989 .chain_id = ALC269_FIXUP_HEADSET_MIC
Chris Chiud8ae4582018-12-07 17:17:11 +08007990 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007991 [ALC294_FIXUP_ASUS_HEADSET_MIC] = {
7992 .type = HDA_FIXUP_PINS,
7993 .v.pins = (const struct hda_pintbl[]) {
Jian-Hong Pan82b01142018-12-27 16:46:31 +08007994 { 0x19, 0x01a1103c }, /* use as headset mic */
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007995 { }
7996 },
7997 .chained = true,
Kailang Yangef9ddb92020-07-10 15:31:11 +08007998 .chain_id = ALC269_FIXUP_HEADSET_MIC
Jian-Hong Pan4e051102018-12-07 17:17:12 +08007999 },
8000 [ALC294_FIXUP_ASUS_SPK] = {
8001 .type = HDA_FIXUP_VERBS,
8002 .v.verbs = (const struct hda_verb[]) {
8003 /* Set EAPD high */
8004 { 0x20, AC_VERB_SET_COEF_INDEX, 0x40 },
8005 { 0x20, AC_VERB_SET_PROC_COEF, 0x8800 },
Kailang Yang473fbe132020-07-16 14:42:33 +08008006 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8007 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
Jian-Hong Pan4e051102018-12-07 17:17:12 +08008008 { }
8009 },
8010 .chained = true,
8011 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8012 },
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01008013 [ALC295_FIXUP_CHROME_BOOK] = {
Kailang Yange8547472018-11-28 15:32:45 +08008014 .type = HDA_FIXUP_FUNC,
Jaroslav Kyselac8a9afa2019-03-14 09:21:08 +01008015 .v.func = alc295_fixup_chromebook,
Kailang Yang8983eb62019-04-03 15:31:49 +08008016 .chained = true,
8017 .chain_id = ALC225_FIXUP_HEADSET_JACK
8018 },
8019 [ALC225_FIXUP_HEADSET_JACK] = {
8020 .type = HDA_FIXUP_FUNC,
8021 .v.func = alc_fixup_headset_jack,
Kailang Yange8547472018-11-28 15:32:45 +08008022 },
Jeremy Soller89e3a562019-01-30 16:12:31 -07008023 [ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8024 .type = HDA_FIXUP_PINS,
8025 .v.pins = (const struct hda_pintbl[]) {
8026 { 0x1a, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8027 { }
8028 },
8029 .chained = true,
8030 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8031 },
Hui Wangc8c6ee62019-02-14 11:41:33 +08008032 [ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE] = {
8033 .type = HDA_FIXUP_VERBS,
8034 .v.verbs = (const struct hda_verb[]) {
8035 /* Disable PCBEEP-IN passthrough */
8036 { 0x20, AC_VERB_SET_COEF_INDEX, 0x36 },
8037 { 0x20, AC_VERB_SET_PROC_COEF, 0x57d7 },
8038 { }
8039 },
8040 .chained = true,
8041 .chain_id = ALC285_FIXUP_LENOVO_HEADPHONE_NOISE
8042 },
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008043 [ALC255_FIXUP_ACER_HEADSET_MIC] = {
8044 .type = HDA_FIXUP_PINS,
8045 .v.pins = (const struct hda_pintbl[]) {
8046 { 0x19, 0x03a11130 },
8047 { 0x1a, 0x90a60140 }, /* use as internal mic */
8048 { }
8049 },
8050 .chained = true,
8051 .chain_id = ALC255_FIXUP_HEADSET_MODE_NO_HP_MIC
8052 },
Kailang Yang136824e2019-03-14 16:22:45 +08008053 [ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE] = {
8054 .type = HDA_FIXUP_PINS,
8055 .v.pins = (const struct hda_pintbl[]) {
8056 { 0x16, 0x01011020 }, /* Rear Line out */
8057 { 0x19, 0x01a1913c }, /* use as Front headset mic, without its own jack detect */
8058 { }
8059 },
8060 .chained = true,
8061 .chain_id = ALC225_FIXUP_WYSE_AUTO_MUTE
8062 },
8063 [ALC225_FIXUP_WYSE_AUTO_MUTE] = {
8064 .type = HDA_FIXUP_FUNC,
8065 .v.func = alc_fixup_auto_mute_via_amp,
8066 .chained = true,
8067 .chain_id = ALC225_FIXUP_WYSE_DISABLE_MIC_VREF
8068 },
8069 [ALC225_FIXUP_WYSE_DISABLE_MIC_VREF] = {
8070 .type = HDA_FIXUP_FUNC,
8071 .v.func = alc_fixup_disable_mic_vref,
8072 .chained = true,
8073 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8074 },
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008075 [ALC286_FIXUP_ACER_AIO_HEADSET_MIC] = {
8076 .type = HDA_FIXUP_VERBS,
8077 .v.verbs = (const struct hda_verb[]) {
8078 { 0x20, AC_VERB_SET_COEF_INDEX, 0x4f },
8079 { 0x20, AC_VERB_SET_PROC_COEF, 0x5029 },
8080 { }
8081 },
8082 .chained = true,
8083 .chain_id = ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE
8084 },
Daniel Drake8c8967a2019-10-17 16:15:01 +08008085 [ALC256_FIXUP_ASUS_HEADSET_MIC] = {
8086 .type = HDA_FIXUP_PINS,
8087 .v.pins = (const struct hda_pintbl[]) {
8088 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8089 { }
8090 },
8091 .chained = true,
8092 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8093 },
Jian-Hong Pane1037352019-03-22 11:37:18 +08008094 [ALC256_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8095 .type = HDA_FIXUP_PINS,
8096 .v.pins = (const struct hda_pintbl[]) {
8097 { 0x19, 0x04a11120 }, /* use as headset mic, without its own jack detect */
8098 { }
8099 },
8100 .chained = true,
8101 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8102 },
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008103 [ALC299_FIXUP_PREDATOR_SPK] = {
8104 .type = HDA_FIXUP_PINS,
8105 .v.pins = (const struct hda_pintbl[]) {
8106 { 0x21, 0x90170150 }, /* use as headset mic, without its own jack detect */
8107 { }
8108 }
8109 },
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02008110 [ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE] = {
8111 .type = HDA_FIXUP_PINS,
8112 .v.pins = (const struct hda_pintbl[]) {
8113 { 0x19, 0x04a11040 },
8114 { 0x21, 0x04211020 },
8115 { }
8116 },
8117 .chained = true,
8118 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8119 },
Kailang Yange79c2262019-12-19 14:12:15 +08008120 [ALC289_FIXUP_DELL_SPK2] = {
8121 .type = HDA_FIXUP_PINS,
8122 .v.pins = (const struct hda_pintbl[]) {
8123 { 0x17, 0x90170130 }, /* bass spk */
8124 { }
8125 },
8126 .chained = true,
8127 .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
8128 },
8129 [ALC289_FIXUP_DUAL_SPK] = {
8130 .type = HDA_FIXUP_FUNC,
8131 .v.func = alc285_fixup_speaker2_to_dac1,
8132 .chained = true,
8133 .chain_id = ALC289_FIXUP_DELL_SPK2
8134 },
Chris Chiu48e01502019-12-30 11:11:18 +08008135 [ALC294_FIXUP_SPK2_TO_DAC1] = {
8136 .type = HDA_FIXUP_FUNC,
8137 .v.func = alc285_fixup_speaker2_to_dac1,
8138 .chained = true,
8139 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8140 },
8141 [ALC294_FIXUP_ASUS_DUAL_SPK] = {
Jian-Hong Pan436e2552019-11-25 17:34:06 +08008142 .type = HDA_FIXUP_FUNC,
8143 /* The GPIO must be pulled to initialize the AMP */
8144 .v.func = alc_fixup_gpio4,
8145 .chained = true,
Chris Chiu48e01502019-12-30 11:11:18 +08008146 .chain_id = ALC294_FIXUP_SPK2_TO_DAC1
Jian-Hong Pan436e2552019-11-25 17:34:06 +08008147 },
Takashi Iwai6a6660d2020-09-03 10:33:00 +02008148 [ALC285_FIXUP_THINKPAD_X1_GEN7] = {
8149 .type = HDA_FIXUP_FUNC,
8150 .v.func = alc285_fixup_thinkpad_x1_gen7,
8151 .chained = true,
8152 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8153 },
Kailang Yang76f7dec2020-02-10 16:30:26 +08008154 [ALC285_FIXUP_THINKPAD_HEADSET_JACK] = {
8155 .type = HDA_FIXUP_FUNC,
8156 .v.func = alc_fixup_headset_jack,
8157 .chained = true,
Takashi Iwai6a6660d2020-09-03 10:33:00 +02008158 .chain_id = ALC285_FIXUP_THINKPAD_X1_GEN7
Kailang Yang76f7dec2020-02-10 16:30:26 +08008159 },
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08008160 [ALC294_FIXUP_ASUS_HPE] = {
8161 .type = HDA_FIXUP_VERBS,
8162 .v.verbs = (const struct hda_verb[]) {
8163 /* Set EAPD high */
8164 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8165 { 0x20, AC_VERB_SET_PROC_COEF, 0x7774 },
8166 { }
8167 },
8168 .chained = true,
8169 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8170 },
Luke D Jonesc3cdf182020-09-07 20:19:59 +12008171 [ALC294_FIXUP_ASUS_GX502_PINS] = {
8172 .type = HDA_FIXUP_PINS,
8173 .v.pins = (const struct hda_pintbl[]) {
8174 { 0x19, 0x03a11050 }, /* front HP mic */
8175 { 0x1a, 0x01a11830 }, /* rear external mic */
8176 { 0x21, 0x03211020 }, /* front HP out */
8177 { }
8178 },
8179 .chained = true,
8180 .chain_id = ALC294_FIXUP_ASUS_GX502_VERBS
8181 },
8182 [ALC294_FIXUP_ASUS_GX502_VERBS] = {
8183 .type = HDA_FIXUP_VERBS,
8184 .v.verbs = (const struct hda_verb[]) {
8185 /* set 0x15 to HP-OUT ctrl */
8186 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8187 /* unmute the 0x15 amp */
8188 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8189 { }
8190 },
8191 .chained = true,
8192 .chain_id = ALC294_FIXUP_ASUS_GX502_HP
8193 },
8194 [ALC294_FIXUP_ASUS_GX502_HP] = {
8195 .type = HDA_FIXUP_FUNC,
8196 .v.func = alc294_fixup_gx502_hp,
8197 },
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05008198 [ALC294_FIXUP_ASUS_GU502_PINS] = {
8199 .type = HDA_FIXUP_PINS,
8200 .v.pins = (const struct hda_pintbl[]) {
8201 { 0x19, 0x01a11050 }, /* rear HP mic */
8202 { 0x1a, 0x01a11830 }, /* rear external mic */
8203 { 0x21, 0x012110f0 }, /* rear HP out */
8204 { }
8205 },
8206 .chained = true,
8207 .chain_id = ALC294_FIXUP_ASUS_GU502_VERBS
8208 },
8209 [ALC294_FIXUP_ASUS_GU502_VERBS] = {
8210 .type = HDA_FIXUP_VERBS,
8211 .v.verbs = (const struct hda_verb[]) {
8212 /* set 0x15 to HP-OUT ctrl */
8213 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 },
8214 /* unmute the 0x15 amp */
8215 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000 },
8216 /* set 0x1b to HP-OUT */
8217 { 0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 },
8218 { }
8219 },
8220 .chained = true,
8221 .chain_id = ALC294_FIXUP_ASUS_GU502_HP
8222 },
8223 [ALC294_FIXUP_ASUS_GU502_HP] = {
8224 .type = HDA_FIXUP_FUNC,
8225 .v.func = alc294_fixup_gu502_hp,
8226 },
Takashi Iwai1b94e592020-05-12 09:32:03 +02008227 [ALC294_FIXUP_ASUS_COEF_1B] = {
8228 .type = HDA_FIXUP_VERBS,
8229 .v.verbs = (const struct hda_verb[]) {
8230 /* Set bit 10 to correct noisy output after reboot from
8231 * Windows 10 (due to pop noise reduction?)
8232 */
8233 { 0x20, AC_VERB_SET_COEF_INDEX, 0x1b },
8234 { 0x20, AC_VERB_SET_PROC_COEF, 0x4e4b },
8235 { }
8236 },
Takashi Iwaif8fbcdf2021-06-20 08:59:52 +02008237 .chained = true,
8238 .chain_id = ALC289_FIXUP_ASUS_GA401,
Takashi Iwai1b94e592020-05-12 09:32:03 +02008239 },
Kai-Heng Fengf5a88b02020-03-27 12:46:25 +08008240 [ALC285_FIXUP_HP_GPIO_LED] = {
8241 .type = HDA_FIXUP_FUNC,
8242 .v.func = alc285_fixup_hp_gpio_led,
8243 },
Kailang Yang431e76c2020-04-07 14:40:20 +08008244 [ALC285_FIXUP_HP_MUTE_LED] = {
8245 .type = HDA_FIXUP_FUNC,
8246 .v.func = alc285_fixup_hp_mute_led,
8247 },
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008248 [ALC236_FIXUP_HP_GPIO_LED] = {
8249 .type = HDA_FIXUP_FUNC,
8250 .v.func = alc236_fixup_hp_gpio_led,
8251 },
Kailang Yang24164f42020-04-07 14:52:42 +08008252 [ALC236_FIXUP_HP_MUTE_LED] = {
8253 .type = HDA_FIXUP_FUNC,
8254 .v.func = alc236_fixup_hp_mute_led,
8255 },
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008256 [ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF] = {
8257 .type = HDA_FIXUP_FUNC,
8258 .v.func = alc236_fixup_hp_mute_led_micmute_vref,
8259 },
Mike Pozulp14425f12020-05-09 20:28:37 -07008260 [ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET] = {
8261 .type = HDA_FIXUP_VERBS,
8262 .v.verbs = (const struct hda_verb[]) {
8263 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc5 },
8264 { }
8265 },
8266 },
Chris Chiu9e433422020-05-12 14:15:24 +08008267 [ALC295_FIXUP_ASUS_MIC_NO_PRESENCE] = {
8268 .type = HDA_FIXUP_PINS,
8269 .v.pins = (const struct hda_pintbl[]) {
8270 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8271 { }
8272 },
8273 .chained = true,
8274 .chain_id = ALC269_FIXUP_HEADSET_MODE
8275 },
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008276 [ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS] = {
8277 .type = HDA_FIXUP_PINS,
8278 .v.pins = (const struct hda_pintbl[]) {
8279 { 0x14, 0x90100120 }, /* use as internal speaker */
8280 { 0x18, 0x02a111f0 }, /* use as headset mic, without its own jack detect */
8281 { 0x1a, 0x01011020 }, /* use as line out */
8282 { },
8283 },
8284 .chained = true,
8285 .chain_id = ALC269_FIXUP_HEADSET_MIC
8286 },
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008287 [ALC269VC_FIXUP_ACER_HEADSET_MIC] = {
8288 .type = HDA_FIXUP_PINS,
8289 .v.pins = (const struct hda_pintbl[]) {
8290 { 0x18, 0x02a11030 }, /* use as headset mic */
8291 { }
8292 },
8293 .chained = true,
8294 .chain_id = ALC269_FIXUP_HEADSET_MIC
8295 },
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008296 [ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE] = {
8297 .type = HDA_FIXUP_PINS,
8298 .v.pins = (const struct hda_pintbl[]) {
8299 { 0x18, 0x01a11130 }, /* use as headset mic, without its own jack detect */
8300 { }
8301 },
8302 .chained = true,
8303 .chain_id = ALC269_FIXUP_HEADSET_MIC
8304 },
Armas Spann293a92c2020-07-24 16:08:37 +02008305 [ALC289_FIXUP_ASUS_GA401] = {
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008306 .type = HDA_FIXUP_FUNC,
8307 .v.func = alc289_fixup_asus_ga401,
8308 .chained = true,
8309 .chain_id = ALC289_FIXUP_ASUS_GA502,
Armas Spannff536642020-07-11 13:05:57 +02008310 },
Armas Spann4b43d052020-07-24 16:06:16 +02008311 [ALC289_FIXUP_ASUS_GA502] = {
8312 .type = HDA_FIXUP_PINS,
8313 .v.pins = (const struct hda_pintbl[]) {
8314 { 0x19, 0x03a11020 }, /* headset mic with jack detect */
8315 { }
8316 },
8317 },
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008318 [ALC256_FIXUP_ACER_MIC_NO_PRESENCE] = {
8319 .type = HDA_FIXUP_PINS,
8320 .v.pins = (const struct hda_pintbl[]) {
8321 { 0x19, 0x02a11120 }, /* use as headset mic, without its own jack detect */
8322 { }
8323 },
8324 .chained = true,
8325 .chain_id = ALC256_FIXUP_ASUS_HEADSET_MODE
8326 },
Kailang Yang56496252020-07-29 15:09:27 +08008327 [ALC285_FIXUP_HP_GPIO_AMP_INIT] = {
8328 .type = HDA_FIXUP_FUNC,
8329 .v.func = alc285_fixup_hp_gpio_amp_init,
8330 .chained = true,
8331 .chain_id = ALC285_FIXUP_HP_GPIO_LED
8332 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +08008333 [ALC269_FIXUP_CZC_B20] = {
8334 .type = HDA_FIXUP_PINS,
8335 .v.pins = (const struct hda_pintbl[]) {
8336 { 0x12, 0x411111f0 },
8337 { 0x14, 0x90170110 }, /* speaker */
8338 { 0x15, 0x032f1020 }, /* HP out */
8339 { 0x17, 0x411111f0 },
8340 { 0x18, 0x03ab1040 }, /* mic */
8341 { 0x19, 0xb7a7013f },
8342 { 0x1a, 0x0181305f },
8343 { 0x1b, 0x411111f0 },
8344 { 0x1d, 0x411111f0 },
8345 { 0x1e, 0x411111f0 },
8346 { }
8347 },
8348 .chain_id = ALC269_FIXUP_DMIC,
8349 },
8350 [ALC269_FIXUP_CZC_TMI] = {
8351 .type = HDA_FIXUP_PINS,
8352 .v.pins = (const struct hda_pintbl[]) {
8353 { 0x12, 0x4000c000 },
8354 { 0x14, 0x90170110 }, /* speaker */
8355 { 0x15, 0x0421401f }, /* HP out */
8356 { 0x17, 0x411111f0 },
8357 { 0x18, 0x04a19020 }, /* mic */
8358 { 0x19, 0x411111f0 },
8359 { 0x1a, 0x411111f0 },
8360 { 0x1b, 0x411111f0 },
8361 { 0x1d, 0x40448505 },
8362 { 0x1e, 0x411111f0 },
8363 { 0x20, 0x8000ffff },
8364 { }
8365 },
8366 .chain_id = ALC269_FIXUP_DMIC,
8367 },
8368 [ALC269_FIXUP_CZC_L101] = {
8369 .type = HDA_FIXUP_PINS,
8370 .v.pins = (const struct hda_pintbl[]) {
8371 { 0x12, 0x40000000 },
8372 { 0x14, 0x01014010 }, /* speaker */
8373 { 0x15, 0x411111f0 }, /* HP out */
8374 { 0x16, 0x411111f0 },
8375 { 0x18, 0x01a19020 }, /* mic */
8376 { 0x19, 0x02a19021 },
8377 { 0x1a, 0x0181302f },
8378 { 0x1b, 0x0221401f },
8379 { 0x1c, 0x411111f0 },
8380 { 0x1d, 0x4044c601 },
8381 { 0x1e, 0x411111f0 },
8382 { }
8383 },
8384 .chain_id = ALC269_FIXUP_DMIC,
8385 },
8386 [ALC269_FIXUP_LEMOTE_A1802] = {
8387 .type = HDA_FIXUP_PINS,
8388 .v.pins = (const struct hda_pintbl[]) {
8389 { 0x12, 0x40000000 },
8390 { 0x14, 0x90170110 }, /* speaker */
8391 { 0x17, 0x411111f0 },
8392 { 0x18, 0x03a19040 }, /* mic1 */
8393 { 0x19, 0x90a70130 }, /* mic2 */
8394 { 0x1a, 0x411111f0 },
8395 { 0x1b, 0x411111f0 },
8396 { 0x1d, 0x40489d2d },
8397 { 0x1e, 0x411111f0 },
8398 { 0x20, 0x0003ffff },
8399 { 0x21, 0x03214020 },
8400 { }
8401 },
8402 .chain_id = ALC269_FIXUP_DMIC,
8403 },
8404 [ALC269_FIXUP_LEMOTE_A190X] = {
8405 .type = HDA_FIXUP_PINS,
8406 .v.pins = (const struct hda_pintbl[]) {
8407 { 0x14, 0x99130110 }, /* speaker */
8408 { 0x15, 0x0121401f }, /* HP out */
8409 { 0x18, 0x01a19c20 }, /* rear mic */
8410 { 0x19, 0x99a3092f }, /* front mic */
8411 { 0x1b, 0x0201401f }, /* front lineout */
8412 { }
8413 },
8414 .chain_id = ALC269_FIXUP_DMIC,
8415 },
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08008416 [ALC256_FIXUP_INTEL_NUC8_RUGGED] = {
8417 .type = HDA_FIXUP_PINS,
8418 .v.pins = (const struct hda_pintbl[]) {
8419 { 0x1b, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8420 { }
8421 },
8422 .chained = true,
8423 .chain_id = ALC269_FIXUP_HEADSET_MODE
8424 },
Werner Sembach73e71612021-03-02 19:04:14 +01008425 [ALC256_FIXUP_INTEL_NUC10] = {
8426 .type = HDA_FIXUP_PINS,
8427 .v.pins = (const struct hda_pintbl[]) {
8428 { 0x19, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8429 { }
8430 },
8431 .chained = true,
8432 .chain_id = ALC269_FIXUP_HEADSET_MODE
8433 },
Hui Wangfc19d552020-09-09 10:00:41 +08008434 [ALC255_FIXUP_XIAOMI_HEADSET_MIC] = {
8435 .type = HDA_FIXUP_VERBS,
8436 .v.verbs = (const struct hda_verb[]) {
8437 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8438 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8439 { }
8440 },
8441 .chained = true,
Takashi Iwaic84bfed2020-11-27 15:11:04 +01008442 .chain_id = ALC289_FIXUP_ASUS_GA502
Hui Wangfc19d552020-09-09 10:00:41 +08008443 },
Hui Wang13468bf2020-09-28 16:01:17 +08008444 [ALC274_FIXUP_HP_MIC] = {
8445 .type = HDA_FIXUP_VERBS,
8446 .v.verbs = (const struct hda_verb[]) {
8447 { 0x20, AC_VERB_SET_COEF_INDEX, 0x45 },
8448 { 0x20, AC_VERB_SET_PROC_COEF, 0x5089 },
8449 { }
8450 },
8451 },
Kailang Yang8a8de09c2020-10-27 16:46:38 +08008452 [ALC274_FIXUP_HP_HEADSET_MIC] = {
8453 .type = HDA_FIXUP_FUNC,
8454 .v.func = alc274_fixup_hp_headset_mic,
8455 .chained = true,
8456 .chain_id = ALC274_FIXUP_HP_MIC
8457 },
Takashi Iwai622464c2021-05-04 11:18:02 +02008458 [ALC274_FIXUP_HP_ENVY_GPIO] = {
8459 .type = HDA_FIXUP_FUNC,
8460 .v.func = alc274_fixup_hp_envy_gpio,
8461 },
Kailang Yangef9ce662020-11-03 15:40:35 +08008462 [ALC256_FIXUP_ASUS_HPE] = {
8463 .type = HDA_FIXUP_VERBS,
8464 .v.verbs = (const struct hda_verb[]) {
8465 /* Set EAPD high */
8466 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0f },
8467 { 0x20, AC_VERB_SET_PROC_COEF, 0x7778 },
8468 { }
8469 },
8470 .chained = true,
8471 .chain_id = ALC294_FIXUP_ASUS_HEADSET_MIC
8472 },
Kailang Yang446b8182020-11-02 15:00:12 +08008473 [ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK] = {
8474 .type = HDA_FIXUP_FUNC,
8475 .v.func = alc_fixup_headset_jack,
8476 .chained = true,
8477 .chain_id = ALC269_FIXUP_THINKPAD_ACPI
8478 },
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008479 [ALC287_FIXUP_HP_GPIO_LED] = {
8480 .type = HDA_FIXUP_FUNC,
8481 .v.func = alc287_fixup_hp_gpio_led,
8482 },
Kailang Yang9e885772020-11-03 15:30:51 +08008483 [ALC256_FIXUP_HP_HEADSET_MIC] = {
8484 .type = HDA_FIXUP_FUNC,
8485 .v.func = alc274_fixup_hp_headset_mic,
8486 },
Kailang Yang92666d42020-11-19 17:04:21 +08008487 [ALC236_FIXUP_DELL_AIO_HEADSET_MIC] = {
8488 .type = HDA_FIXUP_FUNC,
8489 .v.func = alc_fixup_no_int_mic,
8490 .chained = true,
8491 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
8492 },
Chris Chiu34cdf402020-12-16 20:52:00 +08008493 [ALC282_FIXUP_ACER_DISABLE_LINEOUT] = {
8494 .type = HDA_FIXUP_PINS,
8495 .v.pins = (const struct hda_pintbl[]) {
8496 { 0x1b, 0x411111f0 },
8497 { 0x18, 0x01a1913c }, /* use as headset mic, without its own jack detect */
8498 { },
8499 },
8500 .chained = true,
8501 .chain_id = ALC269_FIXUP_HEADSET_MODE
8502 },
Chris Chiu495dc762021-01-14 16:27:28 +08008503 [ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST] = {
8504 .type = HDA_FIXUP_FUNC,
8505 .v.func = alc269_fixup_limit_int_mic_boost,
8506 .chained = true,
8507 .chain_id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
8508 },
Chris Chiud0e18562021-02-26 09:04:40 +08008509 [ALC256_FIXUP_ACER_HEADSET_MIC] = {
8510 .type = HDA_FIXUP_PINS,
8511 .v.pins = (const struct hda_pintbl[]) {
8512 { 0x19, 0x02a1113c }, /* use as headset mic, without its own jack detect */
8513 { 0x1a, 0x90a1092f }, /* use as internal mic */
8514 { }
8515 },
8516 .chained = true,
8517 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8518 },
Takashi Iwai26928ca2021-04-16 10:12:11 +02008519 [ALC285_FIXUP_IDEAPAD_S740_COEF] = {
8520 .type = HDA_FIXUP_FUNC,
8521 .v.func = alc285_fixup_ideapad_s740_coef,
8522 .chained = true,
8523 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8524 },
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008525 [ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8526 .type = HDA_FIXUP_FUNC,
8527 .v.func = alc269_fixup_limit_int_mic_boost,
8528 .chained = true,
8529 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8530 },
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008531 [ALC295_FIXUP_ASUS_DACS] = {
8532 .type = HDA_FIXUP_FUNC,
8533 .v.func = alc295_fixup_asus_dacs,
8534 },
Takashi Iwai5d84b532021-05-04 14:18:32 +02008535 [ALC295_FIXUP_HP_OMEN] = {
8536 .type = HDA_FIXUP_PINS,
8537 .v.pins = (const struct hda_pintbl[]) {
8538 { 0x12, 0xb7a60130 },
8539 { 0x13, 0x40000000 },
8540 { 0x14, 0x411111f0 },
8541 { 0x16, 0x411111f0 },
8542 { 0x17, 0x90170110 },
8543 { 0x18, 0x411111f0 },
8544 { 0x19, 0x02a11030 },
8545 { 0x1a, 0x411111f0 },
8546 { 0x1b, 0x04a19030 },
8547 { 0x1d, 0x40600001 },
8548 { 0x1e, 0x411111f0 },
8549 { 0x21, 0x03211020 },
8550 {}
8551 },
8552 .chained = true,
8553 .chain_id = ALC269_FIXUP_HP_LINE1_MIC1_LED,
8554 },
Elia Devitof2be77f2021-05-11 14:46:49 +02008555 [ALC285_FIXUP_HP_SPECTRE_X360] = {
Elia Devito434591b2021-06-19 22:41:04 +02008556 .type = HDA_FIXUP_FUNC,
8557 .v.func = alc285_fixup_hp_spectre_x360,
Elia Devitof2be77f2021-05-11 14:46:49 +02008558 },
Davide Baldod94befb2021-10-15 09:21:22 +02008559 [ALC285_FIXUP_HP_SPECTRE_X360_EB1] = {
8560 .type = HDA_FIXUP_FUNC,
8561 .v.func = alc285_fixup_hp_spectre_x360_eb1
8562 },
Hui Wang9ebaef02021-05-22 12:26:45 +08008563 [ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP] = {
8564 .type = HDA_FIXUP_FUNC,
8565 .v.func = alc285_fixup_ideapad_s740_coef,
8566 .chained = true,
8567 .chain_id = ALC285_FIXUP_THINKPAD_HEADSET_JACK,
8568 },
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03008569 [ALC623_FIXUP_LENOVO_THINKSTATION_P340] = {
8570 .type = HDA_FIXUP_FUNC,
8571 .v.func = alc_fixup_no_shutup,
8572 .chained = true,
8573 .chain_id = ALC283_FIXUP_HEADSET_MIC,
8574 },
Hui Wang57c9e212021-06-08 10:46:00 +08008575 [ALC255_FIXUP_ACER_HEADPHONE_AND_MIC] = {
8576 .type = HDA_FIXUP_PINS,
8577 .v.pins = (const struct hda_pintbl[]) {
8578 { 0x21, 0x03211030 }, /* Change the Headphone location to Left */
8579 { }
8580 },
8581 .chained = true,
8582 .chain_id = ALC255_FIXUP_XIAOMI_HEADSET_MIC
8583 },
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008584 [ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST] = {
8585 .type = HDA_FIXUP_FUNC,
8586 .v.func = alc269_fixup_limit_int_mic_boost,
8587 .chained = true,
8588 .chain_id = ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF,
8589 },
Baole Fang8f4c9042022-01-05 22:08:54 +08008590 [ALC285_FIXUP_LEGION_Y9000X_SPEAKERS] = {
8591 .type = HDA_FIXUP_FUNC,
8592 .v.func = alc285_fixup_ideapad_s740_coef,
8593 .chained = true,
8594 .chain_id = ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE,
8595 },
8596 [ALC285_FIXUP_LEGION_Y9000X_AUTOMUTE] = {
8597 .type = HDA_FIXUP_FUNC,
8598 .v.func = alc287_fixup_legion_15imhg05_speakers,
8599 .chained = true,
8600 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
8601 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008602 [ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS] = {
8603 .type = HDA_FIXUP_VERBS,
8604 //.v.verbs = legion_15imhg05_coefs,
8605 .v.verbs = (const struct hda_verb[]) {
8606 // set left speaker Legion 7i.
8607 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8608 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8609
8610 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8611 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8612 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8613 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8614 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8615
8616 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8617 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8618 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8619 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8620 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8621
8622 // set right speaker Legion 7i.
8623 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8624 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8625
8626 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8627 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8628 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8629 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8630 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8631
8632 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8633 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8634 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8635 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8636 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8637 {}
8638 },
8639 .chained = true,
8640 .chain_id = ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE,
8641 },
8642 [ALC287_FIXUP_LEGION_15IMHG05_AUTOMUTE] = {
8643 .type = HDA_FIXUP_FUNC,
8644 .v.func = alc287_fixup_legion_15imhg05_speakers,
8645 .chained = true,
8646 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8647 },
8648 [ALC287_FIXUP_YOGA7_14ITL_SPEAKERS] = {
8649 .type = HDA_FIXUP_VERBS,
8650 .v.verbs = (const struct hda_verb[]) {
8651 // set left speaker Yoga 7i.
8652 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8653 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
8654
8655 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8656 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8657 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8658 { 0x20, AC_VERB_SET_PROC_COEF, 0x1a },
8659 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8660
8661 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8662 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8663 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8664 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8665 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8666
8667 // set right speaker Yoga 7i.
8668 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8669 { 0x20, AC_VERB_SET_PROC_COEF, 0x46 },
8670
8671 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8672 { 0x20, AC_VERB_SET_PROC_COEF, 0xc },
8673 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8674 { 0x20, AC_VERB_SET_PROC_COEF, 0x2a },
8675 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8676
8677 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8678 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8679 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8680 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8681 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8682 {}
8683 },
8684 .chained = true,
8685 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8686 },
8687 [ALC287_FIXUP_13S_GEN2_SPEAKERS] = {
8688 .type = HDA_FIXUP_VERBS,
8689 .v.verbs = (const struct hda_verb[]) {
8690 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8691 { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
Cameron Berkenpas023a0622021-10-10 15:54:11 -07008692 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07008693 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8694 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8695 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8696 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8697 { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
8698 { 0x20, AC_VERB_SET_PROC_COEF, 0x42 },
8699 { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
8700 { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
8701 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8702 { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
8703 { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
8704 {}
8705 },
8706 .chained = true,
8707 .chain_id = ALC269_FIXUP_HEADSET_MODE,
8708 },
Werner Sembach619764c2021-12-02 17:50:10 +01008709 [ALC256_FIXUP_SET_COEF_DEFAULTS] = {
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008710 .type = HDA_FIXUP_FUNC,
Werner Sembach619764c2021-12-02 17:50:10 +01008711 .v.func = alc256_fixup_set_coef_defaults,
Werner Sembachdd6dd6e32021-10-06 15:04:15 +02008712 },
Johnathon Clark5fc462c2021-10-20 14:12:51 +01008713 [ALC245_FIXUP_HP_GPIO_LED] = {
8714 .type = HDA_FIXUP_FUNC,
8715 .v.func = alc245_fixup_hp_gpio_led,
8716 },
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06008717 [ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE] = {
8718 .type = HDA_FIXUP_PINS,
8719 .v.pins = (const struct hda_pintbl[]) {
8720 { 0x19, 0x03a11120 }, /* use as headset mic, without its own jack detect */
8721 { }
8722 },
8723 .chained = true,
8724 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC,
8725 },
Werner Sembach174a7fb2021-11-12 12:07:04 +01008726 [ALC233_FIXUP_NO_AUDIO_JACK] = {
8727 .type = HDA_FIXUP_FUNC,
8728 .v.func = alc233_fixup_no_audio_jack,
8729 },
Werner Sembachedca7cc2021-12-15 20:16:46 +01008730 [ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME] = {
8731 .type = HDA_FIXUP_FUNC,
8732 .v.func = alc256_fixup_mic_no_presence_and_resume,
8733 .chained = true,
8734 .chain_id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC
8735 },
Lucas Tanured3dca022021-12-17 11:57:07 +00008736 [ALC287_FIXUP_LEGION_16ACHG6] = {
8737 .type = HDA_FIXUP_FUNC,
8738 .v.func = alc287_fixup_legion_16achg6_speakers,
8739 },
Stefan Bindingae7abe32021-12-17 11:57:08 +00008740 [ALC287_FIXUP_CS35L41_I2C_2] = {
8741 .type = HDA_FIXUP_FUNC,
8742 .v.func = cs35l41_fixup_i2c_two,
8743 },
Alexander Sergeyev91502a92022-01-14 19:50:50 +03008744 [ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED] = {
8745 .type = HDA_FIXUP_VERBS,
8746 .v.verbs = (const struct hda_verb[]) {
8747 { 0x20, AC_VERB_SET_COEF_INDEX, 0x19 },
8748 { 0x20, AC_VERB_SET_PROC_COEF, 0x8e11 },
8749 { }
8750 },
8751 .chained = true,
8752 .chain_id = ALC285_FIXUP_HP_MUTE_LED,
8753 },
Takashi Iwai1d045db2011-07-07 18:23:21 +02008754};
8755
8756static const struct snd_pci_quirk alc269_fixup_tbl[] = {
Marius Knausta6b92b62014-03-03 01:48:58 +01008757 SND_PCI_QUIRK(0x1025, 0x0283, "Acer TravelMate 8371", ALC269_FIXUP_INV_DMIC),
David Henningsson693b6132012-06-22 19:12:10 +02008758 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
8759 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008760 SND_PCI_QUIRK(0x1025, 0x047c, "Acer AC700", ALC269_FIXUP_ACER_AC700),
Takashi Iwai78197172015-06-27 10:21:13 +02008761 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008762 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
8763 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
Simon South02322ac2016-03-02 23:10:44 -05008764 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Oleksij Rempelb1e89722013-12-04 20:50:53 +01008765 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
Takashi Iwai1a22e772014-08-27 08:19:05 +02008766 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
Takashi Iwai433f8942021-04-28 13:26:56 +02008767 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
Takashi Iwaic8426b22021-04-07 11:57:30 +02008768 SND_PCI_QUIRK(0x1025, 0x0840, "Acer Aspire E1", ALC269VB_FIXUP_ASPIRE_E1_COEF),
Chris Chiu13be30f2020-12-22 23:04:59 +08008769 SND_PCI_QUIRK(0x1025, 0x101c, "Acer Veriton N2510G", ALC269_FIXUP_LIFEBOOK),
Chris Chiu705b65f2018-12-05 14:48:54 +08008770 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
Jian-Hong Pan6e15d122020-07-06 15:18:27 +08008771 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
Takashi Iwaib9c2fa52015-11-19 16:39:50 +01008772 SND_PCI_QUIRK(0x1025, 0x106d, "Acer Cloudbook 14", ALC283_FIXUP_CHROME_BOOK),
Chris Chiu495dc762021-01-14 16:27:28 +08008773 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
Chris Chiuc7531e32019-03-21 17:17:31 +08008774 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8775 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiu13be30f2020-12-22 23:04:59 +08008776 SND_PCI_QUIRK(0x1025, 0x1166, "Acer Veriton N4640G", ALC269_FIXUP_LIFEBOOK),
8777 SND_PCI_QUIRK(0x1025, 0x1167, "Acer Veriton N6640G", ALC269_FIXUP_LIFEBOOK),
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01008778 SND_PCI_QUIRK(0x1025, 0x1246, "Acer Predator Helios 500", ALC299_FIXUP_PREDATOR_SPK),
Jian-Hong Pan8eae7e92020-07-06 15:18:25 +08008779 SND_PCI_QUIRK(0x1025, 0x1247, "Acer vCopperbox", ALC269VC_FIXUP_ACER_VCOPPERBOX_PINS),
Jian-Hong Pan781c90c2020-07-06 15:18:29 +08008780 SND_PCI_QUIRK(0x1025, 0x1248, "Acer Veriton N4660G", ALC269VC_FIXUP_ACER_MIC_NO_PRESENCE),
Chris Chiud0e18562021-02-26 09:04:40 +08008781 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pan667a8f72019-03-15 17:51:09 +08008782 SND_PCI_QUIRK(0x1025, 0x128f, "Acer Veriton Z6860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8783 SND_PCI_QUIRK(0x1025, 0x1290, "Acer Veriton Z4860G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8784 SND_PCI_QUIRK(0x1025, 0x1291, "Acer Veriton Z4660G", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Chris Chiud0e18562021-02-26 09:04:40 +08008785 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
Nikos Liolios35171fb2021-07-27 06:05:10 +03008786 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Pan2733cce2019-03-21 16:39:04 +08008787 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
Jian-Hong Panea5c7eb2019-04-01 11:25:05 +08008788 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
Jian-Hong Pancbc05fd2019-03-13 17:33:24 +08008789 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
Jaroslav Kysela2a5bb692021-11-04 16:57:26 +01008790 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Alexander Monakov0d4867a2021-07-21 20:01:41 +03008791 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
Jian-Hong Panf50a1212020-07-13 14:04:22 +08008792 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
Hui Wang57c9e212021-06-08 10:46:00 +08008793 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
David Henningssonaaedfb42013-08-16 14:09:02 +02008794 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
Kailang Yang6ed11312015-10-26 15:37:39 +08008795 SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Takashi Iwai86f799b2015-11-14 17:46:31 +01008796 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell Latitude E6440", ALC292_FIXUP_DELL_E7X),
Takashi Iwaicf521032016-01-15 12:59:25 +01008797 SND_PCI_QUIRK(0x1028, 0x05be, "Dell Latitude E6540", ALC292_FIXUP_DELL_E7X),
Takashi Iwai8b99aba2015-06-15 11:59:32 +02008798 SND_PCI_QUIRK(0x1028, 0x05ca, "Dell Latitude E7240", ALC292_FIXUP_DELL_E7X),
8799 SND_PCI_QUIRK(0x1028, 0x05cb, "Dell Latitude E7440", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008800 SND_PCI_QUIRK(0x1028, 0x05da, "Dell Vostro 5460", ALC290_FIXUP_SUBWOOFER),
David Henningsson73bdd592013-04-15 15:44:14 +02008801 SND_PCI_QUIRK(0x1028, 0x05f4, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8802 SND_PCI_QUIRK(0x1028, 0x05f5, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
8803 SND_PCI_QUIRK(0x1028, 0x05f6, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningsson0f4881d2013-12-20 16:08:13 +01008804 SND_PCI_QUIRK(0x1028, 0x0615, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
8805 SND_PCI_QUIRK(0x1028, 0x0616, "Dell Vostro 5470", ALC290_FIXUP_SUBWOOFER_HSJACK),
Takashi Iwai98070572016-01-12 21:06:39 +01008806 SND_PCI_QUIRK(0x1028, 0x062c, "Dell Latitude E5550", ALC292_FIXUP_DELL_E7X),
Takashi Iwai42755542015-06-29 10:56:53 +02008807 SND_PCI_QUIRK(0x1028, 0x062e, "Dell Latitude E7450", ALC292_FIXUP_DELL_E7X),
David Henningsson0f4881d2013-12-20 16:08:13 +01008808 SND_PCI_QUIRK(0x1028, 0x0638, "Dell Inspiron 5439", ALC290_FIXUP_MONO_SPEAKERS_HSJACK),
Kailang Yanga22aa262014-04-23 17:34:28 +08008809 SND_PCI_QUIRK(0x1028, 0x064a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8810 SND_PCI_QUIRK(0x1028, 0x064b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang831bfdf92015-06-26 12:35:17 +08008811 SND_PCI_QUIRK(0x1028, 0x0665, "Dell XPS 13", ALC288_FIXUP_DELL_XPS_13),
Bastien Noceraafecb142016-04-18 11:10:42 +02008812 SND_PCI_QUIRK(0x1028, 0x0669, "Dell Optiplex 9020m", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai3a05d122015-07-29 09:04:52 +02008813 SND_PCI_QUIRK(0x1028, 0x069a, "Dell Vostro 5480", ALC290_FIXUP_SUBWOOFER_HSJACK),
Kailang Yang8b724152014-12-17 17:08:59 +08008814 SND_PCI_QUIRK(0x1028, 0x06c7, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangb7343042014-12-02 14:50:45 +08008815 SND_PCI_QUIRK(0x1028, 0x06d9, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8816 SND_PCI_QUIRK(0x1028, 0x06da, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
David Henningssonc04017e2015-12-15 14:44:03 +01008817 SND_PCI_QUIRK(0x1028, 0x06db, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8818 SND_PCI_QUIRK(0x1028, 0x06dd, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8819 SND_PCI_QUIRK(0x1028, 0x06de, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8820 SND_PCI_QUIRK(0x1028, 0x06df, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
8821 SND_PCI_QUIRK(0x1028, 0x06e0, "Dell", ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK),
Kai-Heng Fengfd06c772016-08-30 15:36:34 +08008822 SND_PCI_QUIRK(0x1028, 0x0706, "Dell Inspiron 7559", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Kai-Heng Feng3b43b712016-02-25 15:19:38 +08008823 SND_PCI_QUIRK(0x1028, 0x0725, "Dell Inspiron 3162", ALC255_FIXUP_DELL_SPK_NOISE),
Takashi Iwaic0ca5ec2019-02-20 16:15:45 +01008824 SND_PCI_QUIRK(0x1028, 0x0738, "Dell Precision 5820", ALC269_FIXUP_NO_SHUTUP),
Kai-Heng Feng709ae622018-10-04 11:39:42 +08008825 SND_PCI_QUIRK(0x1028, 0x075c, "Dell XPS 27 7760", ALC298_FIXUP_SPK_VOLUME),
Hui Wangdd9aa332016-08-01 10:20:32 +08008826 SND_PCI_QUIRK(0x1028, 0x075d, "Dell AIO", ALC298_FIXUP_SPK_VOLUME),
Takashi Iwai493de342017-02-28 17:27:57 +01008827 SND_PCI_QUIRK(0x1028, 0x0798, "Dell Inspiron 17 7000 Gaming", ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008828 SND_PCI_QUIRK(0x1028, 0x07b0, "Dell Precision 7520", ALC295_FIXUP_DISABLE_DAC3),
Kailang Yang5f364132017-07-25 16:28:16 +08008829 SND_PCI_QUIRK(0x1028, 0x080c, "Dell WYSE", ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE),
Kailang Yang40e2c4e2018-02-02 15:13:09 +08008830 SND_PCI_QUIRK(0x1028, 0x084b, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
8831 SND_PCI_QUIRK(0x1028, 0x084e, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yangf0ba9d62018-03-16 11:46:08 +08008832 SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
8833 SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
Kailang Yangae104a22018-02-05 16:07:20 +08008834 SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
Kailang Yang136824e2019-03-14 16:22:45 +08008835 SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
Kailang Yangda484d02019-03-14 15:50:59 +08008836 SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
Kailang Yangc2a7c55a2019-01-03 15:53:39 +08008837 SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
Kailang Yange79c2262019-12-19 14:12:15 +08008838 SND_PCI_QUIRK(0x1028, 0x097d, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Takashi Iwaiaa143ad2021-04-28 13:26:57 +02008839 SND_PCI_QUIRK(0x1028, 0x097e, "Dell Precision", ALC289_FIXUP_DUAL_SPK),
Kailang Yang78def222020-02-20 15:21:54 +08008840 SND_PCI_QUIRK(0x1028, 0x098d, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
8841 SND_PCI_QUIRK(0x1028, 0x09bf, "Dell Precision", ALC233_FIXUP_ASUS_MIC_NO_PRESENCE),
Kailang Yang92666d42020-11-19 17:04:21 +08008842 SND_PCI_QUIRK(0x1028, 0x0a2e, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
8843 SND_PCI_QUIRK(0x1028, 0x0a30, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC),
Kailang Yangc1e89522020-12-23 15:34:57 +08008844 SND_PCI_QUIRK(0x1028, 0x0a58, "Dell", ALC255_FIXUP_DELL_HEADSET_MIC),
Kristin Pagetda946922021-08-14 15:46:05 -07008845 SND_PCI_QUIRK(0x1028, 0x0a61, "Dell XPS 15 9510", ALC289_FIXUP_DUAL_SPK),
John Liueb676622021-09-30 13:53:16 +02008846 SND_PCI_QUIRK(0x1028, 0x0a62, "Dell Precision 5560", ALC289_FIXUP_DUAL_SPK),
Chris Chiu2b987fe2021-10-01 14:28:56 +08008847 SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
8848 SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
Kailang Yanga22aa262014-04-23 17:34:28 +08008849 SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
8850 SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
Takashi Iwai08fb0d02013-01-10 17:33:58 +01008851 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01008852 SND_PCI_QUIRK(0x103c, 0x18e6, "HP", ALC269_FIXUP_HP_GPIO_LED),
David Henningsson8e35cd42013-11-06 11:20:01 +01008853 SND_PCI_QUIRK(0x103c, 0x218b, "HP", ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED),
Hui Wang7976eb42015-02-13 11:14:41 +08008854 SND_PCI_QUIRK(0x103c, 0x21f9, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008855 SND_PCI_QUIRK(0x103c, 0x2210, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yang8a02b162014-06-13 17:16:31 +08008856 SND_PCI_QUIRK(0x103c, 0x2214, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008857 SND_PCI_QUIRK(0x103c, 0x221b, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8858 SND_PCI_QUIRK(0x103c, 0x221c, "HP EliteBook 755 G2", ALC280_FIXUP_HP_HEADSET_MIC),
8859 SND_PCI_QUIRK(0x103c, 0x2221, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8860 SND_PCI_QUIRK(0x103c, 0x2225, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008861 SND_PCI_QUIRK(0x103c, 0x2236, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8862 SND_PCI_QUIRK(0x103c, 0x2237, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8863 SND_PCI_QUIRK(0x103c, 0x2238, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
8864 SND_PCI_QUIRK(0x103c, 0x2239, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008865 SND_PCI_QUIRK(0x103c, 0x224b, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008866 SND_PCI_QUIRK(0x103c, 0x2253, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8867 SND_PCI_QUIRK(0x103c, 0x2254, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8868 SND_PCI_QUIRK(0x103c, 0x2255, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8869 SND_PCI_QUIRK(0x103c, 0x2256, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8870 SND_PCI_QUIRK(0x103c, 0x2257, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008871 SND_PCI_QUIRK(0x103c, 0x2259, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Jaroslav Kysela04d54662017-03-09 13:29:13 +01008872 SND_PCI_QUIRK(0x103c, 0x225a, "HP", ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008873 SND_PCI_QUIRK(0x103c, 0x225f, "HP", ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY),
Kailang Yangc60666b2014-02-21 16:23:35 +08008874 SND_PCI_QUIRK(0x103c, 0x2260, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008875 SND_PCI_QUIRK(0x103c, 0x2263, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8876 SND_PCI_QUIRK(0x103c, 0x2264, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8877 SND_PCI_QUIRK(0x103c, 0x2265, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008878 SND_PCI_QUIRK(0x103c, 0x2268, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8879 SND_PCI_QUIRK(0x103c, 0x226a, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8880 SND_PCI_QUIRK(0x103c, 0x226b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8881 SND_PCI_QUIRK(0x103c, 0x226e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8882 SND_PCI_QUIRK(0x103c, 0x2271, "HP", ALC286_FIXUP_HP_GPIO_LED),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008883 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008884 SND_PCI_QUIRK(0x103c, 0x2272, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008885 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Takashi Iwai45461e32021-04-28 13:26:55 +02008886 SND_PCI_QUIRK(0x103c, 0x2273, "HP", ALC280_FIXUP_HP_DOCK_PINS),
Kailang Yang9c5dc3b2014-06-19 16:11:36 +08008887 SND_PCI_QUIRK(0x103c, 0x2278, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yangc60666b2014-02-21 16:23:35 +08008888 SND_PCI_QUIRK(0x103c, 0x227f, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008889 SND_PCI_QUIRK(0x103c, 0x2282, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008890 SND_PCI_QUIRK(0x103c, 0x228b, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008891 SND_PCI_QUIRK(0x103c, 0x228e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008892 SND_PCI_QUIRK(0x103c, 0x229e, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8893 SND_PCI_QUIRK(0x103c, 0x22b2, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8894 SND_PCI_QUIRK(0x103c, 0x22b7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8895 SND_PCI_QUIRK(0x103c, 0x22bf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8896 SND_PCI_QUIRK(0x103c, 0x22c4, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008897 SND_PCI_QUIRK(0x103c, 0x22c5, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Kailang Yangc60666b2014-02-21 16:23:35 +08008898 SND_PCI_QUIRK(0x103c, 0x22c7, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8899 SND_PCI_QUIRK(0x103c, 0x22c8, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Takashi Iwai45461e32021-04-28 13:26:55 +02008900 SND_PCI_QUIRK(0x103c, 0x22cf, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8901 SND_PCI_QUIRK(0x103c, 0x22db, "HP", ALC280_FIXUP_HP_9480M),
8902 SND_PCI_QUIRK(0x103c, 0x22dc, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
8903 SND_PCI_QUIRK(0x103c, 0x22fb, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED),
Kailang Yang8a02b162014-06-13 17:16:31 +08008904 SND_PCI_QUIRK(0x103c, 0x2334, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8905 SND_PCI_QUIRK(0x103c, 0x2335, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8906 SND_PCI_QUIRK(0x103c, 0x2336, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
8907 SND_PCI_QUIRK(0x103c, 0x2337, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008908 SND_PCI_QUIRK(0x103c, 0x802e, "HP Z240 SFF", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8909 SND_PCI_QUIRK(0x103c, 0x802f, "HP Z240", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Kailang Yang1c9d9df2021-04-20 14:17:34 +08008910 SND_PCI_QUIRK(0x103c, 0x8077, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
8911 SND_PCI_QUIRK(0x103c, 0x8158, "HP", ALC256_FIXUP_HP_HEADSET_MIC),
Takashi Iwai563785e2018-11-12 09:43:12 +01008912 SND_PCI_QUIRK(0x103c, 0x820d, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Hui Wange549d192016-04-01 11:00:15 +08008913 SND_PCI_QUIRK(0x103c, 0x8256, "HP", ALC221_FIXUP_HP_FRONT_MIC),
Tom Bridenbbf8ff62018-05-29 17:34:20 +01008914 SND_PCI_QUIRK(0x103c, 0x827e, "HP x360", ALC295_FIXUP_HP_X360),
Takashi Iwaiaeedad22020-11-28 10:00:15 +01008915 SND_PCI_QUIRK(0x103c, 0x827f, "HP x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Jaroslav Kysela167897f2019-03-13 13:40:15 +01008916 SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
8917 SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
Alexandru Gagniuc56e40eb2018-08-04 11:44:44 -05008918 SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Carlos M901be142021-05-31 22:20:26 +02008919 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai190d0382019-08-13 17:39:56 +02008920 SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Takashi Iwai5d84b532021-05-04 14:18:32 +02008921 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
Sam Bazleyd33cd422019-09-01 03:31:30 +01008922 SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
Elia Devitof2be77f2021-05-11 14:46:49 +02008923 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
Bradley Scottd296a742021-12-13 10:49:39 -05008924 SND_PCI_QUIRK(0x103c, 0x860f, "HP ZBook 15 G6", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai0ac05b22021-06-23 14:20:22 +02008925 SND_PCI_QUIRK(0x103c, 0x861f, "HP Elite Dragonfly G1", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008926 SND_PCI_QUIRK(0x103c, 0x869d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Takashi Iwai622464c2021-05-04 11:18:02 +02008927 SND_PCI_QUIRK(0x103c, 0x86c7, "HP Envy AiO 32", ALC274_FIXUP_HP_ENVY_GPIO),
Jeremy Szu15d295b2021-06-05 16:25:36 +08008928 SND_PCI_QUIRK(0x103c, 0x8716, "HP Elite Dragonfly G2 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu61d3e872021-06-05 16:25:37 +08008929 SND_PCI_QUIRK(0x103c, 0x8720, "HP EliteBook x360 1040 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Kai-Heng Fenga5980982020-12-30 20:56:35 +08008930 SND_PCI_QUIRK(0x103c, 0x8724, "HP EliteBook 850 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengc0584932021-11-10 22:40:32 +08008931 SND_PCI_QUIRK(0x103c, 0x8728, "HP EliteBook 840 G7", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Fengb2c22912020-06-17 18:29:02 +08008932 SND_PCI_QUIRK(0x103c, 0x8729, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jonas Witschel75b62ab2021-04-16 12:58:54 +02008933 SND_PCI_QUIRK(0x103c, 0x8730, "HP ProBook 445 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Takashi Iwai05ec7162021-11-18 08:16:36 +01008934 SND_PCI_QUIRK(0x103c, 0x8735, "HP ProBook 435 G7", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Kailang Yang56496252020-07-29 15:09:27 +08008935 SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Qiu Wenbo08befca2020-10-02 20:44:54 +08008936 SND_PCI_QUIRK(0x103c, 0x8760, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang431e76c2020-04-07 14:40:20 +08008937 SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
Kailang Yang24164f42020-04-07 14:52:42 +08008938 SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
Jeremy Szu91bc1562021-01-06 21:05:46 +08008939 SND_PCI_QUIRK(0x103c, 0x8780, "HP ZBook Fury 17 G7 Mobile Workstation",
8940 ALC285_FIXUP_HP_GPIO_AMP_INIT),
8941 SND_PCI_QUIRK(0x103c, 0x8783, "HP ZBook Fury 15 G7 Mobile Workstation",
8942 ALC285_FIXUP_HP_GPIO_AMP_INIT),
Takashi Iwai375f8422021-10-28 09:09:11 +02008943 SND_PCI_QUIRK(0x103c, 0x8788, "HP OMEN 15", ALC285_FIXUP_HP_MUTE_LED),
Manuel Jiménez48422952020-12-29 15:38:56 +01008944 SND_PCI_QUIRK(0x103c, 0x87c8, "HP", ALC287_FIXUP_HP_GPIO_LED),
Jeremy Szue7d66cf2021-03-16 15:46:24 +08008945 SND_PCI_QUIRK(0x103c, 0x87e5, "HP ProBook 440 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chi2b70b262021-07-01 17:14:13 +08008946 SND_PCI_QUIRK(0x103c, 0x87e7, "HP ProBook 450 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Andy Chifb3acdb2021-07-01 17:14:15 +08008947 SND_PCI_QUIRK(0x103c, 0x87f1, "HP ProBook 630 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szu417eadf2021-03-30 19:44:27 +08008948 SND_PCI_QUIRK(0x103c, 0x87f2, "HP ProBook 640 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Kailang Yanga0ccbc52020-11-06 15:20:38 +08008949 SND_PCI_QUIRK(0x103c, 0x87f4, "HP", ALC287_FIXUP_HP_GPIO_LED),
8950 SND_PCI_QUIRK(0x103c, 0x87f5, "HP", ALC287_FIXUP_HP_GPIO_LED),
Johnathon Clark93ab3ea2021-08-23 17:21:10 +01008951 SND_PCI_QUIRK(0x103c, 0x87f6, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01008952 SND_PCI_QUIRK(0x103c, 0x87f7, "HP Spectre x360 14", ALC245_FIXUP_HP_X360_AMP),
Jeremy Szud07149a2021-08-10 18:08:45 +08008953 SND_PCI_QUIRK(0x103c, 0x8805, "HP ProBook 650 G8 Notebook PC", ALC236_FIXUP_HP_GPIO_LED),
Jeremy Szudfc2e8a2021-06-25 21:34:13 +08008954 SND_PCI_QUIRK(0x103c, 0x880d, "HP EliteBook 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Davide Baldod94befb2021-10-15 09:21:22 +02008955 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8956 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
Jeremy Szu53b861b2021-03-16 17:42:35 +08008957 SND_PCI_QUIRK(0x103c, 0x8846, "HP EliteBook 850 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuc3d2c882021-06-18 01:14:20 +08008958 SND_PCI_QUIRK(0x103c, 0x8847, "HP EliteBook x360 830 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szudfb06402021-06-05 16:25:38 +08008959 SND_PCI_QUIRK(0x103c, 0x884b, "HP EliteBook 840 Aero G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuca688332021-03-16 14:54:50 +08008960 SND_PCI_QUIRK(0x103c, 0x884c, "HP EliteBook 840 G8 Notebook PC", ALC285_FIXUP_HP_GPIO_LED),
Kai-Heng Feng8903376d2021-08-18 22:41:18 +08008961 SND_PCI_QUIRK(0x103c, 0x8862, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
8962 SND_PCI_QUIRK(0x103c, 0x8863, "HP ProBook 445 G8 Notebook PC", ALC236_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Jeremy Szu50dbfae2021-05-20 01:03:56 +08008963 SND_PCI_QUIRK(0x103c, 0x886d, "HP ZBook Fury 17.3 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szue650c1a2021-05-20 01:03:55 +08008964 SND_PCI_QUIRK(0x103c, 0x8870, "HP ZBook Fury 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szubbe183e2021-05-20 01:03:54 +08008965 SND_PCI_QUIRK(0x103c, 0x8873, "HP ZBook Studio 15.6 Inch G8 Mobile Workstation PC", ALC285_FIXUP_HP_GPIO_AMP_INIT),
Jeremy Szu600dd2a2021-06-08 19:47:48 +08008966 SND_PCI_QUIRK(0x103c, 0x888d, "HP ZBook Power 15.6 inch G8 Mobile Workstation PC", ALC236_FIXUP_HP_GPIO_LED),
Alexander Sergeyev91502a92022-01-14 19:50:50 +03008967 SND_PCI_QUIRK(0x103c, 0x8895, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_SPEAKERS_MICMUTE_LED),
Jeremy Szu0e68c4b2021-05-20 01:03:53 +08008968 SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
Kai-Heng Fengbd15b152021-04-20 19:55:29 +08008969 SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
Frank Schäfer42334fb2021-07-03 15:54:16 +02008970 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
Kai-Heng Feng08977fe2021-12-24 11:50:13 +08008971 SND_PCI_QUIRK(0x103c, 0x89c3, "HP", ALC285_FIXUP_HP_GPIO_LED),
Jeremy Szuf7ac5702021-12-15 00:41:54 +08008972 SND_PCI_QUIRK(0x103c, 0x89ca, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008973 SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai7bba2152013-09-06 15:45:38 +02008974 SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
David Henningsson3e0d6112013-04-22 14:30:14 +02008975 SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Wandrille RONCE9cf65332018-12-19 14:52:44 +01008976 SND_PCI_QUIRK(0x1043, 0x10a1, "ASUS UX391UA", ALC294_FIXUP_ASUS_SPK),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008977 SND_PCI_QUIRK(0x1043, 0x10c0, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008978 SND_PCI_QUIRK(0x1043, 0x10d0, "ASUS X540LA/X540LJ", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
David Henningsson3e0d6112013-04-22 14:30:14 +02008979 SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008980 SND_PCI_QUIRK(0x1043, 0x11c0, "ASUS X556UR", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008981 SND_PCI_QUIRK(0x1043, 0x125e, "ASUS Q524UQK", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Chris Chiu5cfca592020-12-07 15:27:55 +08008982 SND_PCI_QUIRK(0x1043, 0x1271, "ASUS X430UN", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02008983 SND_PCI_QUIRK(0x1043, 0x1290, "ASUS X441SA", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
8984 SND_PCI_QUIRK(0x1043, 0x12a0, "ASUS X441UV", ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008985 SND_PCI_QUIRK(0x1043, 0x12e0, "ASUS X541SA", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008986 SND_PCI_QUIRK(0x1043, 0x12f0, "ASUS X541UV", ALC256_FIXUP_ASUS_MIC),
Chris Chiuc1732ed2017-02-28 14:17:13 -06008987 SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
Oleksij Rempel2cede302013-11-27 17:12:03 +01008988 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
Takashi Iwai23870832013-11-29 14:13:12 +01008989 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
David Henningsson3e0d6112013-04-22 14:30:14 +02008990 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
Takashi Iwai8eedd3a2021-05-04 10:20:57 +02008991 SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
Chris Chiu48e01502019-12-30 11:11:18 +08008992 SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
Luke D Jones739d0952021-08-07 14:58:05 +12008993 SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
Takashi Iwai3cd0ed62021-04-28 13:26:58 +02008994 SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
Daniel Drake8c8967a2019-10-17 16:15:01 +08008995 SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
Adam Barber4963d662020-04-10 17:00:32 +08008996 SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
Kailang Yang158ae2f2020-07-16 15:21:59 +08008997 SND_PCI_QUIRK(0x1043, 0x194e, "ASUS UX563FD", ALC294_FIXUP_ASUS_HPE),
Takashi Iwai4fad4fb2021-11-07 09:33:39 +01008998 SND_PCI_QUIRK(0x1043, 0x1970, "ASUS UX550VE", ALC289_FIXUP_ASUS_GA401),
Jian-Hong Pan5de3b942021-01-22 13:47:06 +08008999 SND_PCI_QUIRK(0x1043, 0x1982, "ASUS B1400CEPE", ALC256_FIXUP_ASUS_HPE),
Jian-Hong Pan8b33a132020-02-25 15:29:21 +08009000 SND_PCI_QUIRK(0x1043, 0x19ce, "ASUS B9450FA", ALC294_FIXUP_ASUS_HPE),
Jian-Hong Pan7900e812020-05-12 14:15:28 +08009001 SND_PCI_QUIRK(0x1043, 0x19e1, "ASUS UX581LV", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai017f2a12011-07-09 14:42:25 +02009002 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
Chris Chiu28e8af82017-06-05 15:05:30 -06009003 SND_PCI_QUIRK(0x1043, 0x1a30, "ASUS X705UD", ALC256_FIXUP_ASUS_MIC),
Takashi Iwai1b94e592020-05-12 09:32:03 +02009004 SND_PCI_QUIRK(0x1043, 0x1b11, "ASUS UX431DA", ALC294_FIXUP_ASUS_COEF_1B),
David Henningsson693b6132012-06-22 19:12:10 +02009005 SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
Chris Chiu615966a2017-02-28 14:17:12 -06009006 SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
Takashi Iwai4eab0ea2017-06-06 12:33:17 +02009007 SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Chris Chiuc1732ed2017-02-28 14:17:13 -06009008 SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
Kailang Yangef9ce662020-11-03 15:40:35 +08009009 SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
Armas Spann4b43d052020-07-24 16:06:16 +02009010 SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
Daniel Cordova Ac1b550292021-05-07 12:31:16 -05009011 SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
Luke D Jones76fae612021-04-19 15:04:11 +12009012 SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
Armas Spann293a92c2020-07-24 16:08:37 +02009013 SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
Albert Geantă94db9cc2022-01-31 03:05:23 +02009014 SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
Chris Chiueeed4cd2017-02-28 14:17:15 -06009015 SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
Takashi Iwaiadabb3e2011-08-03 07:48:37 +02009016 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
9017 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
9018 SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
9019 SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
David Henningssond240d1d2013-04-15 12:50:02 +02009020 SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009021 SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
9022 SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
9023 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
Takashi Iwaie9bd7d52014-05-21 11:06:49 +02009024 SND_PCI_QUIRK(0x104d, 0x9099, "Sony VAIO S13", ALC275_FIXUP_SONY_DISABLE_AAMIX),
Takashi Iwaicab561f2021-04-28 13:26:59 +02009025 SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
9026 SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
Takashi Iwai24519912011-08-16 15:08:49 +02009027 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
Takashi Iwai4df3fd12015-06-29 08:38:02 +02009028 SND_PCI_QUIRK(0x10cf, 0x159f, "Lifebook E780", ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT),
Takashi Iwaicc7016a2015-04-08 20:47:55 +02009029 SND_PCI_QUIRK(0x10cf, 0x15dc, "Lifebook T731", ALC269_FIXUP_LIFEBOOK_HP_PIN),
Jan-Marek Glogowskifdcc9682018-02-14 11:29:15 +01009030 SND_PCI_QUIRK(0x10cf, 0x1629, "Lifebook U7x7", ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC),
Takashi Iwaic656f742021-04-28 13:27:01 +02009031 SND_PCI_QUIRK(0x10cf, 0x1757, "Lifebook E752", ALC269_FIXUP_LIFEBOOK_HP_PIN),
David Henningsson2041d562014-06-13 11:15:44 +02009032 SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
PeiSen Houb84e8432017-09-01 15:11:56 +08009033 SND_PCI_QUIRK(0x10ec, 0x10f2, "Intel Reference board", ALC700_FIXUP_INTEL_REFERENCE),
Takashi Iwaic656f742021-04-28 13:27:01 +02009034 SND_PCI_QUIRK(0x10ec, 0x118c, "Medion EE4254 MD62100", ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE),
PeiSen Hou6fa38ef2020-07-27 13:56:47 +02009035 SND_PCI_QUIRK(0x10ec, 0x1230, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
PeiSen Houce2e79b2020-12-31 11:57:28 +01009036 SND_PCI_QUIRK(0x10ec, 0x1252, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
9037 SND_PCI_QUIRK(0x10ec, 0x1254, "Intel Reference board", ALC295_FIXUP_CHROME_BOOK),
YOKOTA Hiroshi0fca97a2018-07-01 18:30:01 +09009038 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
David Henningssona33cc482014-10-07 10:18:41 +02009039 SND_PCI_QUIRK(0x144d, 0xc109, "Samsung Ativ book 9 (NP900X3G)", ALC269_FIXUP_INV_DMIC),
Mike Pozulp14425f12020-05-09 20:28:37 -07009040 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
9041 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Mike Pozulpf70fff82020-08-13 21:53:44 -07009042 SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Adrien Crivelli8bcea6c2020-08-26 17:40:14 +09009043 SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Gabriele Mazzotta823ff162016-12-24 19:50:01 +01009044 SND_PCI_QUIRK(0x144d, 0xc740, "Samsung Ativ book 8 (NP870Z5G)", ALC269_FIXUP_ATIV_BOOK_8),
Joonho Wohn568e4e82020-07-18 17:23:15 +09009045 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Takashi Iwaic656f742021-04-28 13:27:01 +02009046 SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET),
Anisse Astierabaa22742016-08-24 09:14:13 +02009047 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9048 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
Anisse Astier8cd65272018-11-23 17:59:11 +01009049 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
Chris Chiu6ca653e2020-12-22 23:04:58 +08009050 SND_PCI_QUIRK(0x152d, 0x1082, "Quanta NL3", ALC269_FIXUP_LIFEBOOK),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009051 SND_PCI_QUIRK(0x1558, 0x1323, "Clevo N130ZU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009052 SND_PCI_QUIRK(0x1558, 0x1325, "Clevo N15[01][CW]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009053 SND_PCI_QUIRK(0x1558, 0x1401, "Clevo L140[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9054 SND_PCI_QUIRK(0x1558, 0x1403, "Clevo N140CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9055 SND_PCI_QUIRK(0x1558, 0x1404, "Clevo N150CU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9056 SND_PCI_QUIRK(0x1558, 0x14a1, "Clevo L141MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9057 SND_PCI_QUIRK(0x1558, 0x4018, "Clevo NV40M[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9058 SND_PCI_QUIRK(0x1558, 0x4019, "Clevo NV40MZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9059 SND_PCI_QUIRK(0x1558, 0x4020, "Clevo NV40MB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9060 SND_PCI_QUIRK(0x1558, 0x40a1, "Clevo NL40GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9061 SND_PCI_QUIRK(0x1558, 0x40c1, "Clevo NL40[CZ]U", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9062 SND_PCI_QUIRK(0x1558, 0x40d1, "Clevo NL41DU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06009063 SND_PCI_QUIRK(0x1558, 0x5015, "Clevo NH5[58]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9064 SND_PCI_QUIRK(0x1558, 0x5017, "Clevo NH7[79]H[HJK]Q", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009065 SND_PCI_QUIRK(0x1558, 0x50a3, "Clevo NJ51GU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9066 SND_PCI_QUIRK(0x1558, 0x50b3, "Clevo NK50S[BEZ]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9067 SND_PCI_QUIRK(0x1558, 0x50b6, "Clevo NK50S5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9068 SND_PCI_QUIRK(0x1558, 0x50b8, "Clevo NK50SZ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9069 SND_PCI_QUIRK(0x1558, 0x50d5, "Clevo NP50D5", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Jeremy Soller1278cc5ac2021-11-02 11:21:04 -06009070 SND_PCI_QUIRK(0x1558, 0x50e1, "Clevo NH5[58]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9071 SND_PCI_QUIRK(0x1558, 0x50e2, "Clevo NH7[79]HPQ", ALC256_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009072 SND_PCI_QUIRK(0x1558, 0x50f0, "Clevo NH50A[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009073 SND_PCI_QUIRK(0x1558, 0x50f2, "Clevo NH50E[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009074 SND_PCI_QUIRK(0x1558, 0x50f3, "Clevo NH58DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009075 SND_PCI_QUIRK(0x1558, 0x50f5, "Clevo NH55EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9076 SND_PCI_QUIRK(0x1558, 0x50f6, "Clevo NH55DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009077 SND_PCI_QUIRK(0x1558, 0x5101, "Clevo S510WU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9078 SND_PCI_QUIRK(0x1558, 0x5157, "Clevo W517GU1", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9079 SND_PCI_QUIRK(0x1558, 0x51a1, "Clevo NS50MU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9080 SND_PCI_QUIRK(0x1558, 0x70a1, "Clevo NB70T[HJK]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9081 SND_PCI_QUIRK(0x1558, 0x70b3, "Clevo NK70SB", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009082 SND_PCI_QUIRK(0x1558, 0x70f2, "Clevo NH79EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9083 SND_PCI_QUIRK(0x1558, 0x70f3, "Clevo NH77DPQ", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9084 SND_PCI_QUIRK(0x1558, 0x70f4, "Clevo NH77EPY", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9085 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009086 SND_PCI_QUIRK(0x1558, 0x8228, "Clevo NR40BU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9087 SND_PCI_QUIRK(0x1558, 0x8520, "Clevo NH50D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9088 SND_PCI_QUIRK(0x1558, 0x8521, "Clevo NH77D[CD]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9089 SND_PCI_QUIRK(0x1558, 0x8535, "Clevo NH50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9090 SND_PCI_QUIRK(0x1558, 0x8536, "Clevo NH79D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009091 SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9092 SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9093 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9094 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
9095 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009096 SND_PCI_QUIRK(0x1558, 0x8668, "Clevo NP50B[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9097 SND_PCI_QUIRK(0x1558, 0x8680, "Clevo NJ50LU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembachedca7cc2021-12-15 20:16:46 +01009098 SND_PCI_QUIRK(0x1558, 0x8686, "Clevo NH50[CZ]U", ALC256_FIXUP_MIC_NO_PRESENCE_AND_RESUME),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009099 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9100 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9101 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9102 SND_PCI_QUIRK(0x1558, 0x951d, "Clevo N950T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009103 SND_PCI_QUIRK(0x1558, 0x9600, "Clevo N960K[PR]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Houb5acfe12020-11-11 08:58:59 +01009104 SND_PCI_QUIRK(0x1558, 0x961d, "Clevo N960S[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9105 SND_PCI_QUIRK(0x1558, 0x971d, "Clevo N970T[CDF]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Werner Sembach745f2602021-06-04 16:02:07 +02009106 SND_PCI_QUIRK(0x1558, 0xa500, "Clevo NL5[03]RU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9107 SND_PCI_QUIRK(0x1558, 0xa600, "Clevo NL50NU", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
PeiSen Hou1d5cfca2021-05-14 12:50:48 +02009108 SND_PCI_QUIRK(0x1558, 0xb018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9109 SND_PCI_QUIRK(0x1558, 0xb019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9110 SND_PCI_QUIRK(0x1558, 0xb022, "Clevo NH77D[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9111 SND_PCI_QUIRK(0x1558, 0xc018, "Clevo NP50D[BE]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9112 SND_PCI_QUIRK(0x1558, 0xc019, "Clevo NH77D[BE]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9113 SND_PCI_QUIRK(0x1558, 0xc022, "Clevo NH77[DC][QW]", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
Kailang Yangca169cc2017-04-25 16:17:40 +08009114 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC233_FIXUP_LENOVO_MULTI_CODECS),
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009115 SND_PCI_QUIRK(0x17aa, 0x1048, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009116 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
9117 SND_PCI_QUIRK(0x17aa, 0x215e, "Thinkpad L512", ALC269_FIXUP_SKU_IGNORE),
9118 SND_PCI_QUIRK(0x17aa, 0x21b8, "Thinkpad Edge 14", ALC269_FIXUP_SKU_IGNORE),
9119 SND_PCI_QUIRK(0x17aa, 0x21ca, "Thinkpad L412", ALC269_FIXUP_SKU_IGNORE),
9120 SND_PCI_QUIRK(0x17aa, 0x21e9, "Thinkpad Edge 15", ALC269_FIXUP_SKU_IGNORE),
Takashi Iwaif552ff52021-04-28 13:27:00 +02009121 SND_PCI_QUIRK(0x17aa, 0x21f3, "Thinkpad T430", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwaib590b382020-05-14 18:05:33 +02009122 SND_PCI_QUIRK(0x17aa, 0x21f6, "Thinkpad T530", ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST),
Felix Kaechelec8415a42012-08-06 23:02:01 +02009123 SND_PCI_QUIRK(0x17aa, 0x21fa, "Thinkpad X230", ALC269_FIXUP_LENOVO_DOCK),
Philipp A. Mohrenweiser4407be62012-08-06 13:14:18 +02009124 SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK),
David Henningsson108cc102012-07-20 10:37:25 +02009125 SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK),
David Henningssonaaedfb42013-08-16 14:09:02 +02009126 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
Takashi Iwai9a811232015-12-09 15:17:43 +01009127 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad T440s", ALC292_FIXUP_TPT440),
Takashi Iwai1c37c222014-05-06 17:34:42 +02009128 SND_PCI_QUIRK(0x17aa, 0x220e, "Thinkpad T440p", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwaia12137e2014-06-27 12:14:35 +02009129 SND_PCI_QUIRK(0x17aa, 0x2210, "Thinkpad T540p", ALC292_FIXUP_TPT440_DOCK),
Rick Sherman59a51a62015-08-18 21:04:30 -05009130 SND_PCI_QUIRK(0x17aa, 0x2211, "Thinkpad W541", ALC292_FIXUP_TPT440_DOCK),
Takashi Iwai6d169412014-10-07 17:27:02 +02009131 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad T440", ALC292_FIXUP_TPT440_DOCK),
Lukas Bossard7c215392014-10-29 18:31:07 +01009132 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad X240", ALC292_FIXUP_TPT440_DOCK),
David Henningssona4a9e082013-08-16 14:09:01 +02009133 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Takashi Iwaib6903c02015-12-10 12:20:20 +01009134 SND_PCI_QUIRK(0x17aa, 0x2218, "Thinkpad X1 Carbon 2nd", ALC292_FIXUP_TPT440_DOCK),
Laura Abbottd05ea7d2015-10-02 11:09:54 -07009135 SND_PCI_QUIRK(0x17aa, 0x2223, "ThinkPad T550", ALC292_FIXUP_TPT440_DOCK),
Yves-Alexis Perezc0278662015-04-11 09:31:35 +02009136 SND_PCI_QUIRK(0x17aa, 0x2226, "ThinkPad X250", ALC292_FIXUP_TPT440_DOCK),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009137 SND_PCI_QUIRK(0x17aa, 0x222d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9138 SND_PCI_QUIRK(0x17aa, 0x222e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Torsten Hilbrichdab38e42016-06-07 13:14:21 +02009139 SND_PCI_QUIRK(0x17aa, 0x2231, "Thinkpad T560", ALC292_FIXUP_TPT460),
Sven Eckelmannc636b952016-04-11 16:55:26 +02009140 SND_PCI_QUIRK(0x17aa, 0x2233, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009141 SND_PCI_QUIRK(0x17aa, 0x2245, "Thinkpad T470", ALC298_FIXUP_TPT470_DOCK),
9142 SND_PCI_QUIRK(0x17aa, 0x2246, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9143 SND_PCI_QUIRK(0x17aa, 0x2247, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Dennis Wassenberge4c07b32018-03-08 13:17:54 +01009144 SND_PCI_QUIRK(0x17aa, 0x2249, "Thinkpad", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009145 SND_PCI_QUIRK(0x17aa, 0x224b, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9146 SND_PCI_QUIRK(0x17aa, 0x224c, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9147 SND_PCI_QUIRK(0x17aa, 0x224d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Benjamin Berg85981df2018-02-14 13:29:39 +01009148 SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Benjamin Poirier9774dc22020-07-03 17:00:04 +09009149 SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Hans de Goedeca707b32020-04-02 19:43:11 +02009150 SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
Kailang Yang446b8182020-11-02 15:00:12 +08009151 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
9152 SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
Stefan Bindingae7abe32021-12-17 11:57:08 +00009153 SND_PCI_QUIRK(0x17aa, 0x22f1, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9154 SND_PCI_QUIRK(0x17aa, 0x22f2, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
9155 SND_PCI_QUIRK(0x17aa, 0x22f3, "Thinkpad", ALC287_FIXUP_CS35L41_I2C_2),
Kailang3694cb22015-12-28 11:35:24 +08009156 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wang6ef2f682016-03-11 12:04:02 +08009157 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
Hui Wangf33f79f2017-07-07 12:08:29 +08009158 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Dennis Wassenbergbef33e12019-06-28 10:54:53 +02009159 SND_PCI_QUIRK(0x17aa, 0x3111, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wange41fc8c2018-06-25 14:40:56 +08009160 SND_PCI_QUIRK(0x17aa, 0x312a, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Kailang Yang65811832018-04-25 17:07:27 +08009161 SND_PCI_QUIRK(0x17aa, 0x312f, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang8da5bbf2017-12-22 11:17:46 +08009162 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
Hui Wang2a36c162019-09-04 13:53:27 +08009163 SND_PCI_QUIRK(0x17aa, 0x3151, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Aaron Ma8a6c55d2019-10-24 19:44:39 +08009164 SND_PCI_QUIRK(0x17aa, 0x3176, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
9165 SND_PCI_QUIRK(0x17aa, 0x3178, "ThinkCentre Station", ALC283_FIXUP_HEADSET_MIC),
Hui Wange4efa822021-07-19 11:02:31 +08009166 SND_PCI_QUIRK(0x17aa, 0x31af, "ThinkCentre Station", ALC623_FIXUP_LENOVO_THINKSTATION_P340),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07009167 SND_PCI_QUIRK(0x17aa, 0x3813, "Legion 7i 15IMHG05", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009168 SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),
9169 SND_PCI_QUIRK(0x17aa, 0x3819, "Lenovo 13s Gen2 ITL", ALC287_FIXUP_13S_GEN2_SPEAKERS),
9170 SND_PCI_QUIRK(0x17aa, 0x3824, "Legion Y9000X 2020", ALC285_FIXUP_LEGION_Y9000X_SPEAKERS),
9171 SND_PCI_QUIRK(0x17aa, 0x3827, "Ideapad S740", ALC285_FIXUP_IDEAPAD_S740_COEF),
Bart Kroonb81e9e52021-12-13 19:20:43 +01009172 SND_PCI_QUIRK(0x17aa, 0x3834, "Lenovo IdeaPad Slim 9i 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009173 SND_PCI_QUIRK(0x17aa, 0x3843, "Yoga 9i", ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP),
Lucas Tanured3dca022021-12-17 11:57:07 +00009174 SND_PCI_QUIRK(0x17aa, 0x3847, "Legion 7 16ACHG6", ALC287_FIXUP_LEGION_16ACHG6),
Takashi Iwai2aac5502022-01-05 17:03:21 +01009175 SND_PCI_QUIRK(0x17aa, 0x384a, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Cameron Berkenpasad7cc2d2021-09-13 14:26:29 -07009176 SND_PCI_QUIRK(0x17aa, 0x3852, "Lenovo Yoga 7 14ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
9177 SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
David Henningsson56f27012016-01-11 09:33:14 +01009178 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaifedb2242014-11-13 07:11:38 +01009179 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
Michał Wadowski56df90b2019-05-14 16:58:00 +02009180 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
Takashi Iwaif552ff52021-04-28 13:27:00 +02009181 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
David Henningssona4a9e082013-08-16 14:09:01 +02009182 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang1bb3e062013-09-27 13:10:25 +02009183 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
Takashi Iwaic497d9f2014-10-08 12:14:40 +02009184 SND_PCI_QUIRK(0x17aa, 0x501e, "Thinkpad L440", ALC292_FIXUP_TPT440_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02009185 SND_PCI_QUIRK(0x17aa, 0x5026, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Jo-Philipp Wichf2aa1112015-04-13 12:47:26 +02009186 SND_PCI_QUIRK(0x17aa, 0x5034, "Thinkpad T450", ALC292_FIXUP_TPT440_DOCK),
Sebastian Wicki80b311d2015-03-23 17:23:11 +01009187 SND_PCI_QUIRK(0x17aa, 0x5036, "Thinkpad T450s", ALC292_FIXUP_TPT440_DOCK),
Ansgar Hegerfeld09ea9972015-05-14 12:31:32 +02009188 SND_PCI_QUIRK(0x17aa, 0x503c, "Thinkpad L450", ALC292_FIXUP_TPT440_DOCK),
Conrad Kostecki037e1192016-04-26 10:08:10 +02009189 SND_PCI_QUIRK(0x17aa, 0x504a, "ThinkPad X260", ALC292_FIXUP_TPT440_DOCK),
Hui Wang23adc192015-12-08 12:27:18 +08009190 SND_PCI_QUIRK(0x17aa, 0x504b, "Thinkpad", ALC293_FIXUP_LENOVO_SPK_NOISE),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02009191 SND_PCI_QUIRK(0x17aa, 0x5050, "Thinkpad T560p", ALC292_FIXUP_TPT460),
Torsten Hilbrich9cd25742016-07-05 10:40:22 +02009192 SND_PCI_QUIRK(0x17aa, 0x5051, "Thinkpad L460", ALC292_FIXUP_TPT460),
Jaroslav Kysela0f087ee2016-06-24 15:13:16 +02009193 SND_PCI_QUIRK(0x17aa, 0x5053, "Thinkpad T460", ALC292_FIXUP_TPT460),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009194 SND_PCI_QUIRK(0x17aa, 0x505d, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9195 SND_PCI_QUIRK(0x17aa, 0x505f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9196 SND_PCI_QUIRK(0x17aa, 0x5062, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
David Henningssoncd5302c2013-08-19 12:22:33 +02009197 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Kailang Yang61fcf8e2018-02-02 15:26:46 +08009198 SND_PCI_QUIRK(0x17aa, 0x511e, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
9199 SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
Takashi Iwai1d045db2011-07-07 18:23:21 +02009200 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
Werner Sembach174a7fb2021-11-12 12:07:04 +01009201 SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04009202 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
Huacai Chenf1ec5be2020-08-02 17:26:40 +08009203 SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
9204 SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
9205 SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
Anisse Astier02b504d2013-06-03 11:53:10 +02009206 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
Takashi Iwaic656f742021-04-28 13:27:01 +02009207 SND_PCI_QUIRK(0x1c06, 0x2013, "Lemote A1802", ALC269_FIXUP_LEMOTE_A1802),
9208 SND_PCI_QUIRK(0x1c06, 0x2015, "Lemote A190X", ALC269_FIXUP_LEMOTE_A190X),
Werner Sembach619764c2021-12-02 17:50:10 +01009209 SND_PCI_QUIRK(0x1d05, 0x1132, "TongFang PHxTxX1", ALC256_FIXUP_SET_COEF_DEFAULTS),
Hui Wangfc19d552020-09-09 10:00:41 +08009210 SND_PCI_QUIRK(0x1d72, 0x1602, "RedmiBook", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Xiaoliang Yub95bc122021-03-16 00:49:00 +08009211 SND_PCI_QUIRK(0x1d72, 0x1701, "XiaomiNotebook Pro", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE),
Hui Wang695d1ec2019-11-21 10:54:27 +08009212 SND_PCI_QUIRK(0x1d72, 0x1901, "RedmiBook 14", ALC256_FIXUP_ASUS_HEADSET_MIC),
Xiaoliang Yue1c86212021-03-13 07:54:53 +08009213 SND_PCI_QUIRK(0x1d72, 0x1947, "RedmiBook Air", ALC255_FIXUP_XIAOMI_HEADSET_MIC),
Phil Calvind1ee66c2021-04-15 18:01:29 -04009214 SND_PCI_QUIRK(0x8086, 0x2074, "Intel NUC 8", ALC233_FIXUP_INTEL_NUC8_DMIC),
Kai-Heng Fenge2d2fde2020-08-07 16:05:12 +08009215 SND_PCI_QUIRK(0x8086, 0x2080, "Intel NUC 8 Rugged", ALC256_FIXUP_INTEL_NUC8_RUGGED),
Werner Sembach73e71612021-03-02 19:04:14 +01009216 SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", ALC256_FIXUP_INTEL_NUC10),
Takashi Iwaia4297b52011-08-23 18:40:12 +02009217
Takashi Iwaia7f3eed2012-02-16 13:03:18 +01009218#if 0
Takashi Iwaia4297b52011-08-23 18:40:12 +02009219 /* Below is a quirk table taken from the old code.
9220 * Basically the device should work as is without the fixup table.
9221 * If BIOS doesn't give a proper info, enable the corresponding
9222 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +02009223 */
Takashi Iwaia4297b52011-08-23 18:40:12 +02009224 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A",
9225 ALC269_FIXUP_AMIC),
9226 SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269_FIXUP_AMIC),
Takashi Iwaia4297b52011-08-23 18:40:12 +02009227 SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269_FIXUP_AMIC),
9228 SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_FIXUP_AMIC),
9229 SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269_FIXUP_AMIC),
9230 SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269_FIXUP_AMIC),
9231 SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269_FIXUP_AMIC),
9232 SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269_FIXUP_AMIC),
9233 SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_FIXUP_AMIC),
9234 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82JV", ALC269_FIXUP_AMIC),
9235 SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_FIXUP_AMIC),
9236 SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_FIXUP_AMIC),
9237 SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_FIXUP_AMIC),
9238 SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_FIXUP_AMIC),
9239 SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_FIXUP_AMIC),
9240 SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_FIXUP_AMIC),
9241 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_FIXUP_AMIC),
9242 SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_FIXUP_AMIC),
9243 SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_FIXUP_AMIC),
9244 SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_FIXUP_AMIC),
9245 SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_FIXUP_AMIC),
9246 SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_FIXUP_AMIC),
9247 SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_FIXUP_AMIC),
9248 SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_FIXUP_AMIC),
9249 SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_FIXUP_AMIC),
9250 SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_FIXUP_AMIC),
9251 SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_FIXUP_AMIC),
9252 SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_FIXUP_AMIC),
9253 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_FIXUP_AMIC),
9254 SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_FIXUP_AMIC),
9255 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_FIXUP_AMIC),
9256 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_FIXUP_AMIC),
9257 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_FIXUP_AMIC),
9258 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_FIXUP_AMIC),
9259 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_FIXUP_AMIC),
9260 SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_FIXUP_DMIC),
9261 SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_FIXUP_AMIC),
9262 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_AMIC),
9263 SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_FIXUP_DMIC),
9264 SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_FIXUP_DMIC),
9265#endif
9266 {}
9267};
9268
David Henningsson214eef72014-07-22 14:09:35 +02009269static const struct snd_pci_quirk alc269_fixup_vendor_tbl[] = {
9270 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
9271 SND_PCI_QUIRK_VENDOR(0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED),
9272 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
9273 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
Ayman Bagabas0fbf21c2019-05-23 05:30:11 -04009274 SND_PCI_QUIRK_VENDOR(0x19e5, "Huawei Matebook", ALC255_FIXUP_MIC_MUTE_LED),
David Henningsson214eef72014-07-22 14:09:35 +02009275 {}
9276};
9277
Takashi Iwai1727a772013-01-10 09:52:52 +01009278static const struct hda_model_fixup alc269_fixup_models[] = {
Takashi Iwaia4297b52011-08-23 18:40:12 +02009279 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9280 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +02009281 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9282 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9283 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
David Henningsson7c478f02013-10-11 10:18:46 +02009284 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
Takashi Iwaib0169512015-05-19 10:20:13 +02009285 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9286 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
David Henningsson108cc102012-07-20 10:37:25 +02009287 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
Takashi Iwaib590b382020-05-14 18:05:33 +02009288 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
Takashi Iwai9f5c6fa2013-03-18 14:15:58 +01009289 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
Jaroslav Kysela04d54662017-03-09 13:29:13 +01009290 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
David Henningssone32aa852013-06-17 11:04:02 +02009291 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9292 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009293 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9294 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
Kailang Yangbe8ef162014-04-08 15:19:49 +08009295 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
Kailang Yang0202e992013-12-02 15:20:15 +08009296 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
Takashi Iwai1c37c222014-05-06 17:34:42 +02009297 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
Takashi Iwai9a811232015-12-09 15:17:43 +01009298 {.id = ALC292_FIXUP_TPT440, .name = "tpt440"},
Sven Eckelmannc636b952016-04-11 16:55:26 +02009299 {.id = ALC292_FIXUP_TPT460, .name = "tpt460"},
Takashi Iwai399c01a2020-05-26 08:24:06 +02009300 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009301 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +02009302 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Takashi Iwai28d1d6d2017-10-18 14:01:58 +02009303 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009304 {.id = ALC269_FIXUP_SONY_VAIO, .name = "vaio"},
9305 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9306 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9307 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9308 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9309 {.id = ALC269_FIXUP_PCM_44K, .name = "pcm44k"},
9310 {.id = ALC269_FIXUP_LIFEBOOK, .name = "lifebook"},
9311 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9312 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9313 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9314 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9315 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9316 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9317 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9318 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9319 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9320 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9321 {.id = ALC269_FIXUP_NO_SHUTUP, .name = "noshutup"},
9322 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9323 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9324 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9325 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9326 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9327 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9328 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9329 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9330 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9331 {.id = ALC269VB_FIXUP_ORDISSIMO_EVE2, .name = "ordissimo"},
9332 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9333 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9334 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9335 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9336 {.id = ALC269_FIXUP_THINKPAD_ACPI, .name = "thinkpad"},
9337 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9338 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9339 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9340 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9341 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9342 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9343 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
Takashi Iwaib3802782018-11-26 17:47:46 +01009344 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009345 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
Takashi Iwaic8426b22021-04-07 11:57:30 +02009346 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009347 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9348 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9349 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9350 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9351 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9352 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9353 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9354 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9355 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9356 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9357 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9358 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9359 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9360 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009361 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9362 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9363 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
Kailang Yang82aa0d72019-01-11 17:15:53 +08009364 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009365 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
Jaroslav Kyselad2cd7952019-11-29 15:40:27 +01009366 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
Takashi Iwaia26d96c2018-06-26 15:09:25 +02009367 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9368 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9369 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9370 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9371 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9372 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9373 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9374 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9375 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9376 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9377 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9378 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9379 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9380 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9381 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9382 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9383 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
Kailang Yang8983eb62019-04-03 15:31:49 +08009384 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9385 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
Bernhard Rosenkraenzere2a829b2019-03-05 00:38:19 +01009386 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
Tomas Espeletaa2ef03f2019-08-09 16:37:54 +02009387 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
Jan-Marek Glogowskibd9c10b2019-09-15 16:57:28 +02009388 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
Mike Pozulp23dc9582020-08-16 21:32:17 -07009389 {.id = ALC298_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc298-samsung-headphone"},
Hui Wangfc19d552020-09-09 10:00:41 +08009390 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
Hui Wang13468bf2020-09-28 16:01:17 +08009391 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
Takashi Iwaic3bb2b52021-02-15 09:25:40 +01009392 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
Takashi Iwai5d84b532021-05-04 14:18:32 +02009393 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
Elia Devitof2be77f2021-05-11 14:46:49 +02009394 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
Davide Baldod94befb2021-10-15 09:21:22 +02009395 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
Hui Wang9ebaef02021-05-22 12:26:45 +08009396 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
Peter Ujfalusi29c8f402021-05-24 23:37:26 +03009397 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
Hui Wang57c9e212021-06-08 10:46:00 +08009398 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
Bradley Scottaa723942021-12-13 11:22:47 -05009399 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
Takashi Iwai1d045db2011-07-07 18:23:21 +02009400 {}
9401};
Kailang Yangcfc5a842016-02-03 15:20:39 +08009402#define ALC225_STANDARD_PINS \
Kailang Yangcfc5a842016-02-03 15:20:39 +08009403 {0x21, 0x04211020}
Takashi Iwai1d045db2011-07-07 18:23:21 +02009404
Hui Wange8191a82015-04-24 13:39:59 +08009405#define ALC256_STANDARD_PINS \
9406 {0x12, 0x90a60140}, \
9407 {0x14, 0x90170110}, \
Hui Wange8191a82015-04-24 13:39:59 +08009408 {0x21, 0x02211020}
9409
David Henningssonfea185e2014-09-03 10:23:04 +02009410#define ALC282_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009411 {0x14, 0x90170110}
Kailang Yange1e62b92015-04-08 16:01:22 +08009412
David Henningssonfea185e2014-09-03 10:23:04 +02009413#define ALC290_STANDARD_PINS \
Hui Wang11580292015-08-03 11:03:49 +08009414 {0x12, 0x99a30130}
David Henningssonfea185e2014-09-03 10:23:04 +02009415
9416#define ALC292_STANDARD_PINS \
9417 {0x14, 0x90170110}, \
Hui Wang11580292015-08-03 11:03:49 +08009418 {0x15, 0x0221401f}
Kailang Yang977e6272015-05-18 15:31:20 +08009419
Hui Wang3f6409702016-09-11 11:26:16 +08009420#define ALC295_STANDARD_PINS \
9421 {0x12, 0xb7a60130}, \
9422 {0x14, 0x90170110}, \
Hui Wang3f6409702016-09-11 11:26:16 +08009423 {0x21, 0x04211020}
9424
Woodrow Shen703867e2015-08-05 12:34:12 +08009425#define ALC298_STANDARD_PINS \
9426 {0x12, 0x90a60130}, \
9427 {0x21, 0x03211020}
9428
Hui Wange1918932014-05-26 16:22:44 +08009429static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
Kailang Yang8a328ac2018-08-21 16:54:41 +08009430 SND_HDA_PIN_QUIRK(0x10ec0221, 0x103c, "HP Workstation", ALC221_FIXUP_HP_HEADSET_MIC,
9431 {0x14, 0x01014020},
9432 {0x17, 0x90170110},
9433 {0x18, 0x02a11030},
9434 {0x19, 0x0181303F},
9435 {0x21, 0x0221102f}),
Chris Chiu5824ce82017-02-28 14:17:11 -06009436 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1025, "Acer", ALC255_FIXUP_ACER_MIC_NO_PRESENCE,
9437 {0x12, 0x90a601c0},
9438 {0x14, 0x90171120},
9439 {0x21, 0x02211030}),
Chris Chiu615966a2017-02-28 14:17:12 -06009440 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9441 {0x14, 0x90170110},
9442 {0x1b, 0x90a70130},
9443 {0x21, 0x03211020}),
9444 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1043, "ASUS", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE,
9445 {0x1a, 0x90a70130},
9446 {0x1b, 0x90170110},
9447 {0x21, 0x03211020}),
David Henningsson2ae95572016-02-25 09:37:05 +01009448 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009449 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009450 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009451 {0x14, 0x901701a0}),
David Henningsson2ae95572016-02-25 09:37:05 +01009452 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yangcfc5a842016-02-03 15:20:39 +08009453 ALC225_STANDARD_PINS,
Hui Wang8a132092016-07-08 14:26:57 +08009454 {0x12, 0xb7a60130},
Kailang Yangcfc5a842016-02-03 15:20:39 +08009455 {0x14, 0x901701b0}),
Hui Wang8a132092016-07-08 14:26:57 +08009456 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9457 ALC225_STANDARD_PINS,
9458 {0x12, 0xb7a60150},
9459 {0x14, 0x901701a0}),
9460 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9461 ALC225_STANDARD_PINS,
9462 {0x12, 0xb7a60150},
9463 {0x14, 0x901701b0}),
9464 SND_HDA_PIN_QUIRK(0x10ec0225, 0x1028, "Dell", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE,
9465 ALC225_STANDARD_PINS,
9466 {0x12, 0xb7a60130},
9467 {0x1b, 0x90170110}),
Kai-Heng Feng0ce48e12017-11-20 02:29:13 -05009468 SND_HDA_PIN_QUIRK(0x10ec0233, 0x8086, "Intel NUC Skull Canyon", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9469 {0x1b, 0x01111010},
9470 {0x1e, 0x01451130},
9471 {0x21, 0x02211020}),
Hui Wang986376b2018-05-30 12:33:07 +08009472 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY,
9473 {0x12, 0x90a60140},
9474 {0x14, 0x90170110},
9475 {0x19, 0x02a11030},
9476 {0x21, 0x02211020}),
Hui Wange41fc8c2018-06-25 14:40:56 +08009477 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9478 {0x14, 0x90170110},
9479 {0x19, 0x02a11030},
9480 {0x1a, 0x02a11040},
9481 {0x1b, 0x01014020},
9482 {0x21, 0x0221101f}),
Hui Wangc6b17f12018-07-06 15:14:11 +08009483 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9484 {0x14, 0x90170110},
Hui Wangd06fb562018-10-10 11:57:25 +08009485 {0x19, 0x02a11030},
9486 {0x1a, 0x02a11040},
9487 {0x1b, 0x01011020},
9488 {0x21, 0x0221101f}),
9489 SND_HDA_PIN_QUIRK(0x10ec0235, 0x17aa, "Lenovo", ALC294_FIXUP_LENOVO_MIC_LOCATION,
9490 {0x14, 0x90170110},
Hui Wangc6b17f12018-07-06 15:14:11 +08009491 {0x19, 0x02a11020},
9492 {0x1a, 0x02a11030},
9493 {0x21, 0x0221101f}),
Kailang Yang92666d42020-11-19 17:04:21 +08009494 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC236_FIXUP_DELL_AIO_HEADSET_MIC,
9495 {0x21, 0x02211010}),
Kailang Yang9e885772020-11-03 15:30:51 +08009496 SND_HDA_PIN_QUIRK(0x10ec0236, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9497 {0x14, 0x90170110},
9498 {0x19, 0x02a11020},
9499 {0x21, 0x02211030}),
Hui Wangc77900e2014-09-03 11:31:07 +08009500 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE,
Hui Wangc77900e2014-09-03 11:31:07 +08009501 {0x14, 0x90170110},
Hui Wangc77900e2014-09-03 11:31:07 +08009502 {0x21, 0x02211020}),
David Henningsson76c21322014-06-24 14:46:54 +02009503 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang86c72d12016-05-25 12:12:32 +08009504 {0x14, 0x90170130},
9505 {0x21, 0x02211040}),
9506 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009507 {0x12, 0x90a60140},
9508 {0x14, 0x90170110},
David Henningsson76c21322014-06-24 14:46:54 +02009509 {0x21, 0x02211020}),
9510 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9511 {0x12, 0x90a60160},
9512 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009513 {0x21, 0x02211030}),
9514 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang392c9da2016-09-26 10:59:38 +08009515 {0x14, 0x90170110},
9516 {0x1b, 0x02011020},
9517 {0x21, 0x0221101f}),
9518 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang6aecd872016-10-20 14:03:33 +08009519 {0x14, 0x90170110},
9520 {0x1b, 0x01011020},
9521 {0x21, 0x0221101f}),
9522 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssoncba59972015-07-22 10:00:25 +02009523 {0x14, 0x90170130},
David Henningssoncba59972015-07-22 10:00:25 +02009524 {0x1b, 0x01014020},
David Henningssoncba59972015-07-22 10:00:25 +02009525 {0x21, 0x0221103f}),
9526 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang59ec4b52016-08-04 15:28:04 +08009527 {0x14, 0x90170130},
Hui Wang6aecd872016-10-20 14:03:33 +08009528 {0x1b, 0x01011020},
9529 {0x21, 0x0221103f}),
9530 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9531 {0x14, 0x90170130},
Hui Wang59ec4b52016-08-04 15:28:04 +08009532 {0x1b, 0x02011020},
9533 {0x21, 0x0221103f}),
9534 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009535 {0x14, 0x90170150},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009536 {0x1b, 0x02011020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009537 {0x21, 0x0221105f}),
9538 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shene9c28e12015-07-25 10:36:16 +08009539 {0x14, 0x90170110},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009540 {0x1b, 0x01014020},
Woodrow Shene9c28e12015-07-25 10:36:16 +08009541 {0x21, 0x0221101f}),
9542 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson76c21322014-06-24 14:46:54 +02009543 {0x12, 0x90a60160},
9544 {0x14, 0x90170120},
9545 {0x17, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009546 {0x21, 0x0321102f}),
9547 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9548 {0x12, 0x90a60160},
9549 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009550 {0x21, 0x02211040}),
9551 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9552 {0x12, 0x90a60160},
9553 {0x14, 0x90170140},
David Henningsson76c21322014-06-24 14:46:54 +02009554 {0x21, 0x02211050}),
9555 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9556 {0x12, 0x90a60170},
9557 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009558 {0x21, 0x02211030}),
9559 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9560 {0x12, 0x90a60170},
9561 {0x14, 0x90170130},
David Henningsson76c21322014-06-24 14:46:54 +02009562 {0x21, 0x02211040}),
Hui Wang70658b92015-03-06 14:03:57 +08009563 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wang70658b92015-03-06 14:03:57 +08009564 {0x12, 0x90a60170},
Hui Wang0a1f90a2016-01-13 11:51:38 +08009565 {0x14, 0x90171130},
9566 {0x21, 0x02211040}),
9567 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9568 {0x12, 0x90a60170},
Hui Wang70658b92015-03-06 14:03:57 +08009569 {0x14, 0x90170140},
Hui Wang70658b92015-03-06 14:03:57 +08009570 {0x21, 0x02211050}),
David Henningsson9b5a4e32015-05-11 14:04:14 +02009571 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5548", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningsson9b5a4e32015-05-11 14:04:14 +02009572 {0x12, 0x90a60180},
9573 {0x14, 0x90170130},
David Henningsson9b5a4e32015-05-11 14:04:14 +02009574 {0x21, 0x02211040}),
AceLan Kaof90d83b2016-06-03 14:45:25 +08009575 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell Inspiron 5565", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9576 {0x12, 0x90a60180},
9577 {0x14, 0x90170120},
9578 {0x21, 0x02211030}),
Hui Wang989dbe42016-11-23 16:05:38 +08009579 SND_HDA_PIN_QUIRK(0x10ec0255, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9580 {0x1b, 0x01011020},
9581 {0x21, 0x02211010}),
Chris Chiuc1732ed2017-02-28 14:17:13 -06009582 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9583 {0x14, 0x90170110},
9584 {0x1b, 0x90a70130},
9585 {0x21, 0x04211020}),
9586 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC,
9587 {0x14, 0x90170110},
9588 {0x1b, 0x90a70130},
9589 {0x21, 0x03211020}),
Jian-Hong Pane1037352019-03-22 11:37:18 +08009590 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiua806ef12019-03-22 11:37:20 +08009591 {0x12, 0x90a60130},
9592 {0x14, 0x90170110},
9593 {0x21, 0x03211020}),
9594 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pan6ac371a2019-03-22 11:37:22 +08009595 {0x12, 0x90a60130},
9596 {0x14, 0x90170110},
9597 {0x21, 0x04211020}),
9598 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1043, "ASUS", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Pane1037352019-03-22 11:37:18 +08009599 {0x1a, 0x90a70130},
9600 {0x1b, 0x90170110},
9601 {0x21, 0x03211020}),
Kailang Yang9e885772020-11-03 15:30:51 +08009602 SND_HDA_PIN_QUIRK(0x10ec0256, 0x103c, "HP", ALC256_FIXUP_HP_HEADSET_MIC,
9603 {0x14, 0x90170110},
9604 {0x19, 0x02a11020},
9605 {0x21, 0x0221101f}),
Kailang Yang8a8de09c2020-10-27 16:46:38 +08009606 SND_HDA_PIN_QUIRK(0x10ec0274, 0x103c, "HP", ALC274_FIXUP_HP_HEADSET_MIC,
9607 {0x17, 0x90170110},
9608 {0x19, 0x03a11030},
9609 {0x21, 0x03211020}),
David Henningssoncf51eb92014-10-30 08:26:02 +01009610 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC280_FIXUP_HP_GPIO4,
9611 {0x12, 0x90a60130},
David Henningssoncf51eb92014-10-30 08:26:02 +01009612 {0x14, 0x90170110},
9613 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009614 {0x1a, 0x04a11020}),
Hui Wang02796612014-09-03 11:31:11 +08009615 SND_HDA_PIN_QUIRK(0x10ec0280, 0x103c, "HP", ALC269_FIXUP_HP_GPIO_MIC1_LED,
9616 {0x12, 0x90a60140},
Hui Wang02796612014-09-03 11:31:11 +08009617 {0x14, 0x90170110},
9618 {0x15, 0x0421101f},
Hui Wang02796612014-09-03 11:31:11 +08009619 {0x18, 0x02811030},
Hui Wang02796612014-09-03 11:31:11 +08009620 {0x1a, 0x04a1103f},
Hui Wang11580292015-08-03 11:03:49 +08009621 {0x1b, 0x02011020}),
David Henningsson42304472014-07-22 11:42:17 +02009622 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP 15 Touchsmart", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009623 ALC282_STANDARD_PINS,
David Henningsson42304472014-07-22 11:42:17 +02009624 {0x12, 0x99a30130},
David Henningsson42304472014-07-22 11:42:17 +02009625 {0x19, 0x03a11020},
David Henningsson42304472014-07-22 11:42:17 +02009626 {0x21, 0x0321101f}),
Hui Wang2c609992014-09-03 11:31:08 +08009627 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009628 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009629 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009630 {0x19, 0x03a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009631 {0x21, 0x03211040}),
9632 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009633 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009634 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009635 {0x19, 0x03a11030},
Hui Wang2c609992014-09-03 11:31:08 +08009636 {0x21, 0x03211020}),
9637 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009638 ALC282_STANDARD_PINS,
Hui Wang2c609992014-09-03 11:31:08 +08009639 {0x12, 0x99a30130},
Hui Wang2c609992014-09-03 11:31:08 +08009640 {0x19, 0x04a11020},
Hui Wang2c609992014-09-03 11:31:08 +08009641 {0x21, 0x0421101f}),
Hui Wang200afc02014-09-03 11:31:10 +08009642 SND_HDA_PIN_QUIRK(0x10ec0282, 0x103c, "HP", ALC269_FIXUP_HP_LINE1_MIC1_LED,
David Henningssonaec856d2014-09-03 10:23:05 +02009643 ALC282_STANDARD_PINS,
Hui Wang200afc02014-09-03 11:31:10 +08009644 {0x12, 0x90a60140},
Hui Wang200afc02014-09-03 11:31:10 +08009645 {0x19, 0x04a11030},
Hui Wang200afc02014-09-03 11:31:10 +08009646 {0x21, 0x04211020}),
Chris Chiu34cdf402020-12-16 20:52:00 +08009647 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9648 ALC282_STANDARD_PINS,
9649 {0x12, 0x90a609c0},
9650 {0x18, 0x03a11830},
9651 {0x19, 0x04a19831},
9652 {0x1a, 0x0481303f},
9653 {0x1b, 0x04211020},
9654 {0x21, 0x0321101f}),
9655 SND_HDA_PIN_QUIRK(0x10ec0282, 0x1025, "Acer", ALC282_FIXUP_ACER_DISABLE_LINEOUT,
9656 ALC282_STANDARD_PINS,
9657 {0x12, 0x90a60940},
9658 {0x18, 0x03a11830},
9659 {0x19, 0x04a19831},
9660 {0x1a, 0x0481303f},
9661 {0x1b, 0x04211020},
9662 {0x21, 0x0321101f}),
David Henningsson76c21322014-06-24 14:46:54 +02009663 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009664 ALC282_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009665 {0x12, 0x90a60130},
David Henningsson76c21322014-06-24 14:46:54 +02009666 {0x21, 0x0321101f}),
9667 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9668 {0x12, 0x90a60160},
9669 {0x14, 0x90170120},
David Henningsson76c21322014-06-24 14:46:54 +02009670 {0x21, 0x02211030}),
Hui Wangbc262172014-09-03 11:31:05 +08009671 SND_HDA_PIN_QUIRK(0x10ec0283, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009672 ALC282_STANDARD_PINS,
Hui Wangbc262172014-09-03 11:31:05 +08009673 {0x12, 0x90a60130},
Hui Wangbc262172014-09-03 11:31:05 +08009674 {0x19, 0x03a11020},
Hui Wangbc262172014-09-03 11:31:05 +08009675 {0x21, 0x0321101f}),
Hui Wangc8c6ee62019-02-14 11:41:33 +08009676 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
Sami Loone266fd992021-05-01 12:07:53 +02009677 {0x12, 0x90a60130},
9678 {0x14, 0x90170110},
9679 {0x19, 0x04a11040},
9680 {0x21, 0x04211020}),
9681 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_LENOVO_PC_BEEP_IN_NOISE,
9682 {0x14, 0x90170110},
9683 {0x19, 0x04a11040},
9684 {0x1d, 0x40600001},
9685 {0x21, 0x04211020}),
9686 SND_HDA_PIN_QUIRK(0x10ec0285, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK,
Hui Wangc4cfcf62018-11-26 14:17:16 +08009687 {0x14, 0x90170110},
9688 {0x19, 0x04a11040},
9689 {0x21, 0x04211020}),
Hui Wangc72b9bf2020-12-05 13:11:30 +08009690 SND_HDA_PIN_QUIRK(0x10ec0287, 0x17aa, "Lenovo", ALC285_FIXUP_THINKPAD_HEADSET_JACK,
9691 {0x14, 0x90170110},
9692 {0x17, 0x90170111},
9693 {0x19, 0x03a11030},
9694 {0x21, 0x03211020}),
Chris Chiu33aaebd2018-12-05 14:48:53 +08009695 SND_HDA_PIN_QUIRK(0x10ec0286, 0x1025, "Acer", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE,
9696 {0x12, 0x90a60130},
9697 {0x17, 0x90170110},
9698 {0x21, 0x02211020}),
Takashi Iwaid44a6862018-06-19 23:04:03 +02009699 SND_HDA_PIN_QUIRK(0x10ec0288, 0x1028, "Dell", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE,
Kailang Yange1e62b92015-04-08 16:01:22 +08009700 {0x12, 0x90a60120},
Kailang Yange1e62b92015-04-08 16:01:22 +08009701 {0x14, 0x90170110},
Kailang Yange1e62b92015-04-08 16:01:22 +08009702 {0x21, 0x0321101f}),
Hui Wange4442bc2014-09-03 11:31:09 +08009703 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009704 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009705 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009706 {0x18, 0x90170112},
Hui Wang11580292015-08-03 11:03:49 +08009707 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009708 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009709 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009710 {0x15, 0x04211040},
Hui Wange4442bc2014-09-03 11:31:09 +08009711 {0x18, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +08009712 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009713 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009714 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009715 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009716 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009717 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009718 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009719 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009720 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009721 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009722 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009723 {0x14, 0x90170110},
9724 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009725 {0x1a, 0x04a11040}),
Hui Wange4442bc2014-09-03 11:31:09 +08009726 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009727 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009728 {0x14, 0x90170110},
9729 {0x15, 0x04211020},
Hui Wang11580292015-08-03 11:03:49 +08009730 {0x1a, 0x04a11020}),
Hui Wange4442bc2014-09-03 11:31:09 +08009731 SND_HDA_PIN_QUIRK(0x10ec0290, 0x103c, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC1,
David Henningssonaec856d2014-09-03 10:23:05 +02009732 ALC290_STANDARD_PINS,
Hui Wange4442bc2014-09-03 11:31:09 +08009733 {0x14, 0x90170110},
9734 {0x15, 0x0421101f},
Hui Wang11580292015-08-03 11:03:49 +08009735 {0x1a, 0x04a11020}),
Hui Wange8818fa2014-09-03 11:31:04 +08009736 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009737 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009738 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009739 {0x16, 0x01014020},
Hui Wang11580292015-08-03 11:03:49 +08009740 {0x19, 0x01a19030}),
Hui Wange8818fa2014-09-03 11:31:04 +08009741 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009742 ALC292_STANDARD_PINS,
Hui Wange8818fa2014-09-03 11:31:04 +08009743 {0x12, 0x90a60140},
Hui Wange8818fa2014-09-03 11:31:04 +08009744 {0x16, 0x01014020},
9745 {0x18, 0x02a19031},
Hui Wang11580292015-08-03 11:03:49 +08009746 {0x19, 0x01a1903e}),
David Henningsson76c21322014-06-24 14:46:54 +02009747 SND_HDA_PIN_QUIRK(0x10ec0292, 0x1028, "Dell", ALC269_FIXUP_DELL3_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009748 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009749 {0x12, 0x90a60140}),
David Henningsson76c21322014-06-24 14:46:54 +02009750 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009751 ALC292_STANDARD_PINS,
David Henningsson76c21322014-06-24 14:46:54 +02009752 {0x13, 0x90a60140},
David Henningsson76c21322014-06-24 14:46:54 +02009753 {0x16, 0x21014020},
Hui Wang11580292015-08-03 11:03:49 +08009754 {0x19, 0x21a19030}),
David Henningssone03fdbd2014-06-27 08:41:59 +02009755 SND_HDA_PIN_QUIRK(0x10ec0293, 0x1028, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE,
David Henningssonaec856d2014-09-03 10:23:05 +02009756 ALC292_STANDARD_PINS,
Hui Wang11580292015-08-03 11:03:49 +08009757 {0x13, 0x90a60140}),
Jian-Hong Paneeacd802020-11-24 17:20:25 +08009758 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_HPE,
9759 {0x17, 0x90170110},
9760 {0x21, 0x04211020}),
Chris Chiud8ae4582018-12-07 17:17:11 +08009761 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_MIC,
9762 {0x14, 0x90170110},
9763 {0x1b, 0x90a70130},
9764 {0x21, 0x04211020}),
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009765 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9766 {0x12, 0x90a60130},
9767 {0x17, 0x90170110},
Jian-Hong Pan8bb37a22019-02-21 17:00:18 +08009768 {0x21, 0x03211020}),
9769 SND_HDA_PIN_QUIRK(0x10ec0294, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9770 {0x12, 0x90a60130},
9771 {0x17, 0x90170110},
Jian-Hong Pan0bea4cc2018-12-07 17:17:13 +08009772 {0x21, 0x04211020}),
Takashi Iwai3887c262019-04-30 15:10:01 +02009773 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC294_FIXUP_ASUS_SPK,
9774 {0x12, 0x90a60130},
9775 {0x17, 0x90170110},
9776 {0x21, 0x03211020}),
Chris Chiu9e433422020-05-12 14:15:24 +08009777 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Jian-Hong Panad97d662020-05-12 14:15:26 +08009778 {0x12, 0x90a60120},
9779 {0x17, 0x90170110},
9780 {0x21, 0x04211030}),
9781 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
Chris Chiu9e433422020-05-12 14:15:24 +08009782 {0x12, 0x90a60130},
9783 {0x17, 0x90170110},
9784 {0x21, 0x03211020}),
9785 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1043, "ASUS", ALC295_FIXUP_ASUS_MIC_NO_PRESENCE,
9786 {0x12, 0x90a60130},
9787 {0x17, 0x90170110},
9788 {0x21, 0x03211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009789 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
Kailang Yang0a29c572019-04-24 16:34:25 +08009790 {0x14, 0x90170110},
9791 {0x21, 0x04211020}),
Kailang Yangfbc57122019-07-15 10:41:50 +08009792 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9793 {0x14, 0x90170110},
9794 {0x21, 0x04211030}),
Hui Wang3f6409702016-09-11 11:26:16 +08009795 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
Hui Wangf771d5b2016-10-18 10:59:09 +08009796 ALC295_STANDARD_PINS,
9797 {0x17, 0x21014020},
9798 {0x18, 0x21a19030}),
9799 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9800 ALC295_STANDARD_PINS,
9801 {0x17, 0x21014040},
9802 {0x18, 0x21a19050}),
Hui Wang3f307832017-03-23 10:00:25 +08009803 SND_HDA_PIN_QUIRK(0x10ec0295, 0x1028, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE,
9804 ALC295_STANDARD_PINS),
Kailang Yang977e6272015-05-18 15:31:20 +08009805 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
Woodrow Shen703867e2015-08-05 12:34:12 +08009806 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009807 {0x17, 0x90170110}),
9808 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9809 ALC298_STANDARD_PINS,
Woodrow Shen703867e2015-08-05 12:34:12 +08009810 {0x17, 0x90170140}),
9811 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_DELL1_MIC_NO_PRESENCE,
9812 ALC298_STANDARD_PINS,
Takashi Iwai9f502ff2015-08-05 12:09:45 +02009813 {0x17, 0x90170150}),
Kai-Heng Feng9f1bc2c42017-02-16 15:26:54 +08009814 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_SPK_VOLUME,
9815 {0x12, 0xb7a60140},
9816 {0x13, 0xb7a60150},
9817 {0x17, 0x90170110},
9818 {0x1a, 0x03011020},
9819 {0x21, 0x03211030}),
James McDonnell54324222019-09-16 14:53:38 +00009820 SND_HDA_PIN_QUIRK(0x10ec0298, 0x1028, "Dell", ALC298_FIXUP_ALIENWARE_MIC_NO_PRESENCE,
9821 {0x12, 0xb7a60140},
9822 {0x17, 0x90170110},
9823 {0x1a, 0x03a11030},
9824 {0x21, 0x03211020}),
Kailang Yangfcc6c872017-06-29 15:21:27 +08009825 SND_HDA_PIN_QUIRK(0x10ec0299, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9826 ALC225_STANDARD_PINS,
9827 {0x12, 0xb7a60130},
Kailang Yangfcc6c872017-06-29 15:21:27 +08009828 {0x17, 0x90170110}),
Hui Wang573fcbf2020-06-08 19:55:41 +08009829 SND_HDA_PIN_QUIRK(0x10ec0623, 0x17aa, "Lenovo", ALC283_FIXUP_HEADSET_MIC,
9830 {0x14, 0x01014010},
9831 {0x17, 0x90170120},
9832 {0x18, 0x02a11030},
9833 {0x19, 0x02a1103f},
9834 {0x21, 0x0221101f}),
Hui Wange1918932014-05-26 16:22:44 +08009835 {}
9836};
Takashi Iwai1d045db2011-07-07 18:23:21 +02009837
Hui Wang7c0a6932019-08-16 14:27:40 +08009838/* This is the fallback pin_fixup_tbl for alc269 family, to make the tbl match
9839 * more machines, don't need to match all valid pins, just need to match
9840 * all the pins defined in the tbl. Just because of this reason, it is possible
9841 * that a single machine matches multiple tbls, so there is one limitation:
9842 * at most one tbl is allowed to define for the same vendor and same codec
9843 */
9844static const struct snd_hda_pin_quirk alc269_fallback_pin_fixup_tbl[] = {
9845 SND_HDA_PIN_QUIRK(0x10ec0289, 0x1028, "Dell", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE,
9846 {0x19, 0x40000000},
9847 {0x1b, 0x40000000}),
Hui Wangaed8c7f2019-11-21 10:26:43 +08009848 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9849 {0x19, 0x40000000},
9850 {0x1a, 0x40000000}),
Hui Wangd64ebdb2019-11-21 10:26:44 +08009851 SND_HDA_PIN_QUIRK(0x10ec0236, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
9852 {0x19, 0x40000000},
9853 {0x1a, 0x40000000}),
Hui Wang5815bdf2019-12-11 13:13:21 +08009854 SND_HDA_PIN_QUIRK(0x10ec0274, 0x1028, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB,
9855 {0x19, 0x40000000},
9856 {0x1a, 0x40000000}),
Hui Wang7c0a6932019-08-16 14:27:40 +08009857 {}
9858};
9859
Takashi Iwai546bb672012-03-07 08:37:19 +01009860static void alc269_fill_coef(struct hda_codec *codec)
Takashi Iwai1d045db2011-07-07 18:23:21 +02009861{
Kailang Yang526af6e2012-03-07 08:25:20 +01009862 struct alc_spec *spec = codec->spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009863 int val;
9864
Kailang Yang526af6e2012-03-07 08:25:20 +01009865 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
Takashi Iwai546bb672012-03-07 08:37:19 +01009866 return;
Kailang Yang526af6e2012-03-07 08:25:20 +01009867
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009868 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009869 alc_write_coef_idx(codec, 0xf, 0x960b);
9870 alc_write_coef_idx(codec, 0xe, 0x8817);
9871 }
9872
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009873 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009874 alc_write_coef_idx(codec, 0xf, 0x960b);
9875 alc_write_coef_idx(codec, 0xe, 0x8814);
9876 }
9877
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009878 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009879 /* Power up output pin */
Takashi Iwai98b24882014-08-18 13:47:50 +02009880 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009881 }
9882
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009883 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009884 val = alc_read_coef_idx(codec, 0xd);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009885 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009886 /* Capless ramp up clock control */
9887 alc_write_coef_idx(codec, 0xd, val | (1<<10));
9888 }
9889 val = alc_read_coef_idx(codec, 0x17);
Takashi Iwaif3ee07d2014-08-15 17:35:00 +02009890 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
Takashi Iwai1d045db2011-07-07 18:23:21 +02009891 /* Class D power on reset */
9892 alc_write_coef_idx(codec, 0x17, val | (1<<7));
9893 }
9894 }
9895
Takashi Iwai98b24882014-08-18 13:47:50 +02009896 /* HP */
9897 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
Takashi Iwai1d045db2011-07-07 18:23:21 +02009898}
9899
9900/*
9901 */
Takashi Iwai1d045db2011-07-07 18:23:21 +02009902static int patch_alc269(struct hda_codec *codec)
9903{
9904 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +02009905 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009906
Takashi Iwai3de95172012-05-07 18:03:15 +02009907 err = alc_alloc_spec(codec, 0x0b);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009908 if (err < 0)
Takashi Iwai3de95172012-05-07 18:03:15 +02009909 return err;
9910
9911 spec = codec->spec;
Takashi Iwai08c189f2012-12-19 15:22:24 +01009912 spec->gen.shared_mic_vref_pin = 0x18;
Kailang Yang317d9312019-05-23 14:43:04 +08009913 codec->power_save_node = 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009914
Takashi Iwai225068a2015-05-29 10:42:14 +02009915#ifdef CONFIG_PM
9916 codec->patch_ops.suspend = alc269_suspend;
9917 codec->patch_ops.resume = alc269_resume;
9918#endif
Kailang Yangc2d6af52017-06-21 14:50:54 +08009919 spec->shutup = alc_default_shutup;
9920 spec->init_hook = alc_default_init;
Takashi Iwai225068a2015-05-29 10:42:14 +02009921
Takashi Iwai7639a062015-03-03 10:07:24 +01009922 switch (codec->core.vendor_id) {
Kailang Yang065380f2013-01-10 10:25:48 +01009923 case 0x10ec0269:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009924 spec->codec_variant = ALC269_TYPE_ALC269VA;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009925 switch (alc_get_coef0(codec) & 0x00f0) {
9926 case 0x0010:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009927 if (codec->bus->pci &&
9928 codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009929 spec->cdefine.platform_type == 1)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009930 err = alc_codec_rename(codec, "ALC271X");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009931 spec->codec_variant = ALC269_TYPE_ALC269VB;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009932 break;
9933 case 0x0020:
Takashi Iwai5100cd02014-02-15 10:03:19 +01009934 if (codec->bus->pci &&
9935 codec->bus->pci->subsystem_vendor == 0x17aa &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009936 codec->bus->pci->subsystem_device == 0x21f3)
Takashi Iwai20ca0c32011-10-17 16:00:35 +02009937 err = alc_codec_rename(codec, "ALC3202");
Takashi Iwai1d045db2011-07-07 18:23:21 +02009938 spec->codec_variant = ALC269_TYPE_ALC269VC;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009939 break;
Kailang Yangadcc70b2012-05-25 08:08:38 +02009940 case 0x0030:
9941 spec->codec_variant = ALC269_TYPE_ALC269VD;
9942 break;
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009943 default:
Takashi Iwai1d045db2011-07-07 18:23:21 +02009944 alc_fix_pll_init(codec, 0x20, 0x04, 15);
Takashi Iwai1bb7e432011-10-17 16:50:59 +02009945 }
Takashi Iwaie16fb6d2011-10-17 16:39:09 +02009946 if (err < 0)
9947 goto error;
Kailang Yangc2d6af52017-06-21 14:50:54 +08009948 spec->shutup = alc269_shutup;
Takashi Iwai546bb672012-03-07 08:37:19 +01009949 spec->init_hook = alc269_fill_coef;
Takashi Iwai1d045db2011-07-07 18:23:21 +02009950 alc269_fill_coef(codec);
Kailang Yang065380f2013-01-10 10:25:48 +01009951 break;
9952
9953 case 0x10ec0280:
9954 case 0x10ec0290:
9955 spec->codec_variant = ALC269_TYPE_ALC280;
9956 break;
9957 case 0x10ec0282:
Kailang Yang065380f2013-01-10 10:25:48 +01009958 spec->codec_variant = ALC269_TYPE_ALC282;
Kailang Yang7b5c7a02014-03-18 16:15:54 +08009959 spec->shutup = alc282_shutup;
9960 spec->init_hook = alc282_init;
Kailang Yang065380f2013-01-10 10:25:48 +01009961 break;
Kailang Yang2af02be2013-08-22 10:03:50 +02009962 case 0x10ec0233:
9963 case 0x10ec0283:
9964 spec->codec_variant = ALC269_TYPE_ALC283;
9965 spec->shutup = alc283_shutup;
9966 spec->init_hook = alc283_init;
9967 break;
Kailang Yang065380f2013-01-10 10:25:48 +01009968 case 0x10ec0284:
9969 case 0x10ec0292:
9970 spec->codec_variant = ALC269_TYPE_ALC284;
9971 break;
Kailang Yang161ebf22013-10-24 11:36:33 +02009972 case 0x10ec0293:
Kailang Yang4731d5d2017-06-30 15:22:57 +08009973 spec->codec_variant = ALC269_TYPE_ALC293;
Kailang Yang161ebf22013-10-24 11:36:33 +02009974 break;
Kailang Yang7fc7d042013-04-25 11:04:43 +02009975 case 0x10ec0286:
Kailang Yang7c665932014-04-14 15:09:44 +08009976 case 0x10ec0288:
Kailang Yang7fc7d042013-04-25 11:04:43 +02009977 spec->codec_variant = ALC269_TYPE_ALC286;
9978 break;
Kailang Yang506b62c2014-12-18 17:07:44 +08009979 case 0x10ec0298:
9980 spec->codec_variant = ALC269_TYPE_ALC298;
9981 break;
Kailang Yangea04a1d2018-04-25 15:31:52 +08009982 case 0x10ec0235:
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009983 case 0x10ec0255:
9984 spec->codec_variant = ALC269_TYPE_ALC255;
Kailang Yangab3b8e52018-04-25 16:05:27 +08009985 spec->shutup = alc256_shutup;
9986 spec->init_hook = alc256_init;
Kailang Yang1d04c9d2013-10-24 11:35:18 +02009987 break;
Takashi Iwai1948fc02021-06-18 18:17:20 +02009988 case 0x10ec0230:
Kailang Yang736f20a2017-10-20 15:06:34 +08009989 case 0x10ec0236:
Kailang Yang4344aec2014-12-17 17:39:05 +08009990 case 0x10ec0256:
9991 spec->codec_variant = ALC269_TYPE_ALC256;
Kailang Yang4a219ef2017-06-16 16:54:35 +08009992 spec->shutup = alc256_shutup;
9993 spec->init_hook = alc256_init;
David Henningsson7d1b6e22015-04-21 10:48:46 +02009994 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */
Kailang Yang4344aec2014-12-17 17:39:05 +08009995 break;
Kailang Yangf429e7e2017-12-05 15:38:24 +08009996 case 0x10ec0257:
9997 spec->codec_variant = ALC269_TYPE_ALC257;
Kailang Yang88d42b22018-03-14 16:08:57 +08009998 spec->shutup = alc256_shutup;
9999 spec->init_hook = alc256_init;
Kailang Yangf429e7e2017-12-05 15:38:24 +080010000 spec->gen.mixer_nid = 0;
10001 break;
Kailang Yang0a6f0602017-06-30 16:00:48 +080010002 case 0x10ec0215:
Kailang Yang7fbdcd82020-04-23 14:18:31 +080010003 case 0x10ec0245:
Kailang Yang0a6f0602017-06-30 16:00:48 +080010004 case 0x10ec0285:
10005 case 0x10ec0289:
10006 spec->codec_variant = ALC269_TYPE_ALC215;
Kailang Yang1b6832be2018-01-17 15:32:03 +080010007 spec->shutup = alc225_shutup;
10008 spec->init_hook = alc225_init;
Kailang Yang0a6f0602017-06-30 16:00:48 +080010009 spec->gen.mixer_nid = 0;
10010 break;
Kailang Yang42314302016-02-03 15:03:50 +080010011 case 0x10ec0225:
Kailang Yang7d727862016-05-24 16:46:07 +080010012 case 0x10ec0295:
Kailang Yang28f1f9b2017-01-04 14:49:07 +080010013 case 0x10ec0299:
Kailang Yang42314302016-02-03 15:03:50 +080010014 spec->codec_variant = ALC269_TYPE_ALC225;
Kailang Yangda911b12018-01-05 16:50:08 +080010015 spec->shutup = alc225_shutup;
10016 spec->init_hook = alc225_init;
Takashi Iwaic1350bf2017-12-27 09:03:45 +010010017 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */
Kailang Yang42314302016-02-03 15:03:50 +080010018 break;
Kailang Yang99cee0342021-07-01 09:09:37 +080010019 case 0x10ec0287:
10020 spec->codec_variant = ALC269_TYPE_ALC287;
10021 spec->shutup = alc225_shutup;
10022 spec->init_hook = alc225_init;
10023 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */
10024 break;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010025 case 0x10ec0234:
10026 case 0x10ec0274:
10027 case 0x10ec0294:
10028 spec->codec_variant = ALC269_TYPE_ALC294;
Hui Wang532a7782017-06-26 12:30:32 +080010029 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */
Kailang Yang71683c32017-06-20 16:33:50 +080010030 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
Kailang Yang693abe12019-01-29 15:38:21 +080010031 spec->init_hook = alc294_init;
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080010032 break;
Kailang Yang1078bef2018-11-08 16:36:15 +080010033 case 0x10ec0300:
10034 spec->codec_variant = ALC269_TYPE_ALC300;
10035 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010036 break;
Kailang Yangf0778872019-10-24 15:13:32 +080010037 case 0x10ec0623:
10038 spec->codec_variant = ALC269_TYPE_ALC623;
10039 break;
Kailang Yang6fbae352016-05-30 16:44:20 +080010040 case 0x10ec0700:
10041 case 0x10ec0701:
10042 case 0x10ec0703:
Kailang Yang83629532019-05-02 16:03:26 +080010043 case 0x10ec0711:
Kailang Yang6fbae352016-05-30 16:44:20 +080010044 spec->codec_variant = ALC269_TYPE_ALC700;
10045 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */
Kailang Yang2d7fe612017-11-22 15:21:32 +080010046 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
Kailang Yang693abe12019-01-29 15:38:21 +080010047 spec->init_hook = alc294_init;
Kailang Yang6fbae352016-05-30 16:44:20 +080010048 break;
10049
Takashi Iwai1d045db2011-07-07 18:23:21 +020010050 }
10051
Kailang Yangad60d502013-06-28 12:03:01 +020010052 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
Kailang Yang97a26572013-11-29 00:35:26 -050010053 spec->has_alc5505_dsp = 1;
Kailang Yangad60d502013-06-28 12:03:01 +020010054 spec->init_hook = alc5505_dsp_init;
10055 }
10056
Takashi Iwaic9af7532019-05-10 11:01:43 +020010057 alc_pre_init(codec);
10058
Takashi Iwaiefe55732018-06-15 11:55:02 +020010059 snd_hda_pick_fixup(codec, alc269_fixup_models,
10060 alc269_fixup_tbl, alc269_fixups);
Takashi Iwai13d9c6b2021-08-20 16:32:14 +020010061 /* FIXME: both TX300 and ROG Strix G17 have the same SSID, and
10062 * the quirk breaks the latter (bko#214101).
10063 * Clear the wrong entry.
10064 */
10065 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10066 codec->core.vendor_id == 0x10ec0294) {
10067 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10068 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10069 }
10070
Hui Wang0fc1e442019-08-16 14:27:39 +080010071 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
Hui Wang7c0a6932019-08-16 14:27:40 +080010072 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
Takashi Iwaiefe55732018-06-15 11:55:02 +020010073 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10074 alc269_fixups);
10075 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10076
10077 alc_auto_parse_customize_define(codec);
10078
10079 if (has_cdefine_beep(codec))
10080 spec->gen.beep_nid = 0x01;
10081
Takashi Iwaia4297b52011-08-23 18:40:12 +020010082 /* automatic parse from the BIOS config */
10083 err = alc269_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010084 if (err < 0)
10085 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010086
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010087 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) {
10088 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT);
10089 if (err < 0)
10090 goto error;
10091 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010092
Takashi Iwai1727a772013-01-10 09:52:52 +010010093 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010094
Takashi Iwai1d045db2011-07-07 18:23:21 +020010095 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010096
10097 error:
10098 alc_free(codec);
10099 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010100}
10101
10102/*
10103 * ALC861
10104 */
10105
Takashi Iwai1d045db2011-07-07 18:23:21 +020010106static int alc861_parse_auto_config(struct hda_codec *codec)
10107{
Takashi Iwai1d045db2011-07-07 18:23:21 +020010108 static const hda_nid_t alc861_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010109 static const hda_nid_t alc861_ssids[] = { 0x0e, 0x0f, 0x0b, 0 };
10110 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010111}
10112
Takashi Iwai1d045db2011-07-07 18:23:21 +020010113/* Pin config fixes */
10114enum {
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010115 ALC861_FIXUP_FSC_AMILO_PI1505,
10116 ALC861_FIXUP_AMP_VREF_0F,
10117 ALC861_FIXUP_NO_JACK_DETECT,
10118 ALC861_FIXUP_ASUS_A6RP,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010119 ALC660_FIXUP_ASUS_W7J,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010120};
10121
Takashi Iwai31150f22012-01-30 10:54:08 +010010122/* On some laptops, VREF of pin 0x0f is abused for controlling the main amp */
10123static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010124 const struct hda_fixup *fix, int action)
Takashi Iwai31150f22012-01-30 10:54:08 +010010125{
10126 struct alc_spec *spec = codec->spec;
10127 unsigned int val;
10128
Takashi Iwai1727a772013-01-10 09:52:52 +010010129 if (action != HDA_FIXUP_ACT_INIT)
Takashi Iwai31150f22012-01-30 10:54:08 +010010130 return;
Takashi Iwaid3f02d62013-01-10 10:12:22 +010010131 val = snd_hda_codec_get_pin_target(codec, 0x0f);
Takashi Iwai31150f22012-01-30 10:54:08 +010010132 if (!(val & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)))
10133 val |= AC_PINCTL_IN_EN;
10134 val |= AC_PINCTL_VREF_50;
Takashi Iwaicdd03ce2012-04-20 12:34:50 +020010135 snd_hda_set_pin_ctl(codec, 0x0f, val);
Takashi Iwai08c189f2012-12-19 15:22:24 +010010136 spec->gen.keep_vref_in_automute = 1;
Takashi Iwai31150f22012-01-30 10:54:08 +010010137}
10138
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010139/* suppress the jack-detection */
10140static void alc_fixup_no_jack_detect(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010141 const struct hda_fixup *fix, int action)
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010142{
Takashi Iwai1727a772013-01-10 09:52:52 +010010143 if (action == HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010144 codec->no_jack_detect = 1;
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020010145}
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010146
Takashi Iwai1727a772013-01-10 09:52:52 +010010147static const struct hda_fixup alc861_fixups[] = {
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010148 [ALC861_FIXUP_FSC_AMILO_PI1505] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010149 .type = HDA_FIXUP_PINS,
10150 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010151 { 0x0b, 0x0221101f }, /* HP */
10152 { 0x0f, 0x90170310 }, /* speaker */
10153 { }
10154 }
10155 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010156 [ALC861_FIXUP_AMP_VREF_0F] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010157 .type = HDA_FIXUP_FUNC,
Takashi Iwai31150f22012-01-30 10:54:08 +010010158 .v.func = alc861_fixup_asus_amp_vref_0f,
Takashi Iwai3b25eb62012-01-25 09:55:46 +010010159 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010160 [ALC861_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010161 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010162 .v.func = alc_fixup_no_jack_detect,
10163 },
10164 [ALC861_FIXUP_ASUS_A6RP] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010165 .type = HDA_FIXUP_FUNC,
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010166 .v.func = alc861_fixup_asus_amp_vref_0f,
10167 .chained = true,
10168 .chain_id = ALC861_FIXUP_NO_JACK_DETECT,
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010169 },
10170 [ALC660_FIXUP_ASUS_W7J] = {
10171 .type = HDA_FIXUP_VERBS,
10172 .v.verbs = (const struct hda_verb[]) {
10173 /* ASUS W7J needs a magic pin setup on unused NID 0x10
10174 * for enabling outputs
10175 */
10176 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
10177 { }
10178 },
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010179 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010180};
10181
10182static const struct snd_pci_quirk alc861_fixup_tbl[] = {
Takashi Iwai6ddf0fd2013-11-29 12:47:34 +010010183 SND_PCI_QUIRK(0x1043, 0x1253, "ASUS W7J", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie7ca2372013-12-02 15:27:19 +010010184 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS Z35HL", ALC660_FIXUP_ASUS_W7J),
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010185 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS A6Rp", ALC861_FIXUP_ASUS_A6RP),
10186 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS laptop", ALC861_FIXUP_AMP_VREF_0F),
10187 SND_PCI_QUIRK(0x1462, 0x7254, "HP DX2200", ALC861_FIXUP_NO_JACK_DETECT),
Takashi Iwaidefce242021-04-28 13:27:03 +020010188 SND_PCI_QUIRK_VENDOR(0x1584, "Haier/Uniwill", ALC861_FIXUP_AMP_VREF_0F),
Takashi Iwaie652f4c2012-02-13 11:56:25 +010010189 SND_PCI_QUIRK(0x1734, 0x10c7, "FSC Amilo Pi1505", ALC861_FIXUP_FSC_AMILO_PI1505),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010190 {}
10191};
10192
10193/*
10194 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010195static int patch_alc861(struct hda_codec *codec)
10196{
10197 struct alc_spec *spec;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010198 int err;
10199
Takashi Iwai3de95172012-05-07 18:03:15 +020010200 err = alc_alloc_spec(codec, 0x15);
10201 if (err < 0)
10202 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010203
Takashi Iwai3de95172012-05-07 18:03:15 +020010204 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010205 if (has_cdefine_beep(codec))
10206 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010207
Takashi Iwai225068a2015-05-29 10:42:14 +020010208#ifdef CONFIG_PM
10209 spec->power_hook = alc_power_eapd;
10210#endif
10211
Takashi Iwaic9af7532019-05-10 11:01:43 +020010212 alc_pre_init(codec);
10213
Takashi Iwai1727a772013-01-10 09:52:52 +010010214 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10215 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010216
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010217 /* automatic parse from the BIOS config */
10218 err = alc861_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010219 if (err < 0)
10220 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010221
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010222 if (!spec->gen.no_analog) {
10223 err = set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
10224 if (err < 0)
10225 goto error;
10226 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010227
Takashi Iwai1727a772013-01-10 09:52:52 +010010228 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010229
Takashi Iwai1d045db2011-07-07 18:23:21 +020010230 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010231
10232 error:
10233 alc_free(codec);
10234 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010235}
10236
10237/*
10238 * ALC861-VD support
10239 *
10240 * Based on ALC882
10241 *
10242 * In addition, an independent DAC
10243 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010244static int alc861vd_parse_auto_config(struct hda_codec *codec)
10245{
Takashi Iwai1d045db2011-07-07 18:23:21 +020010246 static const hda_nid_t alc861vd_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010247 static const hda_nid_t alc861vd_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10248 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010249}
10250
Takashi Iwai1d045db2011-07-07 18:23:21 +020010251enum {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010252 ALC660VD_FIX_ASUS_GPIO1,
10253 ALC861VD_FIX_DALLAS,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010254};
10255
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010256/* exclude VREF80 */
10257static void alc861vd_fixup_dallas(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010258 const struct hda_fixup *fix, int action)
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010259{
Takashi Iwai1727a772013-01-10 09:52:52 +010010260 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwaib78562b2012-12-17 20:06:49 +010010261 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10262 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010263 }
10264}
10265
Takashi Iwaidf73d832018-06-19 23:05:47 +020010266/* reset GPIO1 */
10267static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10268 const struct hda_fixup *fix, int action)
10269{
10270 struct alc_spec *spec = codec->spec;
10271
10272 if (action == HDA_FIXUP_ACT_PRE_PROBE)
10273 spec->gpio_mask |= 0x02;
10274 alc_fixup_gpio(codec, action, 0x01);
10275}
10276
Takashi Iwai1727a772013-01-10 09:52:52 +010010277static const struct hda_fixup alc861vd_fixups[] = {
Takashi Iwai1d045db2011-07-07 18:23:21 +020010278 [ALC660VD_FIX_ASUS_GPIO1] = {
Takashi Iwaidf73d832018-06-19 23:05:47 +020010279 .type = HDA_FIXUP_FUNC,
10280 .v.func = alc660vd_fixup_asus_gpio1,
Takashi Iwai1d045db2011-07-07 18:23:21 +020010281 },
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010282 [ALC861VD_FIX_DALLAS] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010283 .type = HDA_FIXUP_FUNC,
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010284 .v.func = alc861vd_fixup_dallas,
10285 },
Takashi Iwai1d045db2011-07-07 18:23:21 +020010286};
10287
10288static const struct snd_pci_quirk alc861vd_fixup_tbl[] = {
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010289 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010290 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
Takashi Iwai8fdcb6f2011-08-23 17:28:55 +020010291 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
Takashi Iwai1d045db2011-07-07 18:23:21 +020010292 {}
10293};
10294
Takashi Iwai1d045db2011-07-07 18:23:21 +020010295/*
10296 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010297static int patch_alc861vd(struct hda_codec *codec)
10298{
10299 struct alc_spec *spec;
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010300 int err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010301
Takashi Iwai3de95172012-05-07 18:03:15 +020010302 err = alc_alloc_spec(codec, 0x0b);
10303 if (err < 0)
10304 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010305
Takashi Iwai3de95172012-05-07 18:03:15 +020010306 spec = codec->spec;
Takashi Iwai2722b532019-08-22 09:55:37 +020010307 if (has_cdefine_beep(codec))
10308 spec->gen.beep_nid = 0x23;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010309
Takashi Iwai225068a2015-05-29 10:42:14 +020010310 spec->shutup = alc_eapd_shutup;
10311
Takashi Iwaic9af7532019-05-10 11:01:43 +020010312 alc_pre_init(codec);
10313
Takashi Iwai1727a772013-01-10 09:52:52 +010010314 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10315 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai1d045db2011-07-07 18:23:21 +020010316
Takashi Iwaicb4e4822011-08-23 17:34:25 +020010317 /* automatic parse from the BIOS config */
10318 err = alc861vd_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010319 if (err < 0)
10320 goto error;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010321
Takashi Iwaifea80fa2018-06-20 12:52:46 +020010322 if (!spec->gen.no_analog) {
10323 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
10324 if (err < 0)
10325 goto error;
10326 }
Takashi Iwai1d045db2011-07-07 18:23:21 +020010327
Takashi Iwai1727a772013-01-10 09:52:52 +010010328 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010010329
Takashi Iwai1d045db2011-07-07 18:23:21 +020010330 return 0;
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020010331
10332 error:
10333 alc_free(codec);
10334 return err;
Takashi Iwai1d045db2011-07-07 18:23:21 +020010335}
10336
10337/*
10338 * ALC662 support
10339 *
10340 * ALC662 is almost identical with ALC880 but has cleaner and more flexible
10341 * configuration. Each pin widget can choose any input DACs and a mixer.
10342 * Each ADC is connected from a mixer of all inputs. This makes possible
10343 * 6-channel independent captures.
10344 *
10345 * In addition, an independent DAC for the multi-playback (not used in this
10346 * driver yet).
10347 */
Takashi Iwai1d045db2011-07-07 18:23:21 +020010348
10349/*
10350 * BIOS auto configuration
10351 */
10352
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010353static int alc662_parse_auto_config(struct hda_codec *codec)
10354{
Takashi Iwai4c6d72d2011-05-02 11:30:18 +020010355 static const hda_nid_t alc662_ignore[] = { 0x1d, 0 };
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010356 static const hda_nid_t alc663_ssids[] = { 0x15, 0x1b, 0x14, 0x21 };
10357 static const hda_nid_t alc662_ssids[] = { 0x15, 0x1b, 0x14, 0 };
10358 const hda_nid_t *ssids;
Takashi Iwaiee979a142008-09-02 15:42:20 +020010359
Takashi Iwai7639a062015-03-03 10:07:24 +010010360 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10361 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10362 codec->core.vendor_id == 0x10ec0671)
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010363 ssids = alc663_ssids;
Kailang Yang6227cdc2010-02-25 08:36:52 +010010364 else
Takashi Iwai3e6179b2011-07-08 16:55:13 +020010365 ssids = alc662_ssids;
10366 return alc_parse_auto_config(codec, alc662_ignore, ssids);
Kailang Yangbc9f98a2007-04-12 13:06:07 +020010367}
10368
Todd Broch6be79482010-12-07 16:51:05 -080010369static void alc272_fixup_mario(struct hda_codec *codec,
Takashi Iwai1727a772013-01-10 09:52:52 +010010370 const struct hda_fixup *fix, int action)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010371{
Takashi Iwai9bb1f062013-01-10 17:14:29 +010010372 if (action != HDA_FIXUP_ACT_PRE_PROBE)
Takashi Iwai6fc398c2011-01-13 14:36:37 +010010373 return;
Todd Broch6be79482010-12-07 16:51:05 -080010374 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10375 (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
10376 (0x3b << AC_AMPCAP_NUM_STEPS_SHIFT) |
10377 (0x03 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10378 (0 << AC_AMPCAP_MUTE_SHIFT)))
Takashi Iwai4e76a882014-02-25 12:21:03 +010010379 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
Todd Broch6be79482010-12-07 16:51:05 -080010380}
10381
Takashi Iwai8e383952013-10-30 17:41:12 +010010382static const struct snd_pcm_chmap_elem asus_pcm_2_1_chmaps[] = {
10383 { .channels = 2,
10384 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
10385 { .channels = 4,
10386 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
10387 SNDRV_CHMAP_NA, SNDRV_CHMAP_LFE } }, /* LFE only on right */
10388 { }
10389};
10390
10391/* override the 2.1 chmap */
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010392static void alc_fixup_bass_chmap(struct hda_codec *codec,
Takashi Iwai8e383952013-10-30 17:41:12 +010010393 const struct hda_fixup *fix, int action)
10394{
10395 if (action == HDA_FIXUP_ACT_BUILD) {
10396 struct alc_spec *spec = codec->spec;
Takashi Iwaibbbc7e82015-02-27 17:43:19 +010010397 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps;
Takashi Iwai8e383952013-10-30 17:41:12 +010010398 }
10399}
10400
Takashi Iwaibf686652014-01-13 16:18:25 +010010401/* avoid D3 for keeping GPIO up */
10402static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10403 hda_nid_t nid,
10404 unsigned int power_state)
10405{
10406 struct alc_spec *spec = codec->spec;
Takashi Iwaid261eec2018-06-19 22:32:29 +020010407 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
Takashi Iwaibf686652014-01-13 16:18:25 +010010408 return AC_PWRST_D0;
10409 return power_state;
10410}
10411
Takashi Iwai3e887f32014-01-10 17:50:58 +010010412static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10413 const struct hda_fixup *fix, int action)
10414{
10415 struct alc_spec *spec = codec->spec;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010416
Takashi Iwai01e4a272018-06-19 22:47:30 +020010417 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
Takashi Iwai3e887f32014-01-10 17:50:58 +010010418 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
Takashi Iwai0f32fd192014-11-19 12:16:14 +010010419 spec->mute_led_polarity = 1;
Takashi Iwaibf686652014-01-13 16:18:25 +010010420 codec->power_filter = gpio_led_power_filter;
Takashi Iwai3e887f32014-01-10 17:50:58 +010010421 }
10422}
10423
Kailang Yangc6790c82016-11-25 16:15:17 +080010424static void alc662_usi_automute_hook(struct hda_codec *codec,
10425 struct hda_jack_callback *jack)
10426{
10427 struct alc_spec *spec = codec->spec;
10428 int vref;
10429 msleep(200);
10430 snd_hda_gen_hp_automute(codec, jack);
10431
10432 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0;
10433 msleep(100);
10434 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10435 vref);
10436}
10437
10438static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10439 const struct hda_fixup *fix, int action)
10440{
10441 struct alc_spec *spec = codec->spec;
10442 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10443 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10444 spec->gen.hp_automute_hook = alc662_usi_automute_hook;
10445 }
10446}
10447
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010448static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10449 struct hda_jack_callback *cb)
10450{
10451 /* surround speakers at 0x1b already get muted automatically when
10452 * headphones are plugged in, but we have to mute/unmute the remaining
10453 * channels manually:
10454 * 0x15 - front left/front right
10455 * 0x18 - front center/ LFE
10456 */
10457 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10458 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10459 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10460 } else {
10461 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10462 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10463 }
10464}
10465
10466static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10467 const struct hda_fixup *fix, int action)
10468{
10469 /* Pin 0x1b: shared headphones jack and surround speakers */
10470 if (!is_jack_detectable(codec, 0x1b))
10471 return;
10472
10473 switch (action) {
10474 case HDA_FIXUP_ACT_PRE_PROBE:
10475 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10476 alc662_aspire_ethos_mute_speakers);
Takashi Iwai336820c2019-11-28 21:26:30 +010010477 /* subwoofer needs an extra GPIO setting to become audible */
10478 alc_setup_gpio(codec, 0x02);
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010479 break;
10480 case HDA_FIXUP_ACT_INIT:
10481 /* Make sure to start in a correct state, i.e. if
10482 * headphones have been plugged in before powering up the system
10483 */
10484 alc662_aspire_ethos_mute_speakers(codec, NULL);
10485 break;
10486 }
10487}
10488
Kailang Yang5af290282020-01-17 14:04:01 +080010489static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10490 const struct hda_fixup *fix, int action)
10491{
10492 struct alc_spec *spec = codec->spec;
10493
10494 static const struct hda_pintbl pincfgs[] = {
10495 { 0x19, 0x02a11040 }, /* use as headset mic, with its own jack detect */
10496 { 0x1b, 0x0181304f },
10497 { }
10498 };
10499
10500 switch (action) {
10501 case HDA_FIXUP_ACT_PRE_PROBE:
10502 spec->gen.mixer_nid = 0;
10503 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
10504 snd_hda_apply_pincfgs(codec, pincfgs);
10505 break;
10506 case HDA_FIXUP_ACT_INIT:
10507 alc_write_coef_idx(codec, 0x19, 0xa054);
10508 break;
10509 }
10510}
10511
Kailang Yangd7f327912021-11-23 16:32:44 +080010512static void alc897_hp_automute_hook(struct hda_codec *codec,
10513 struct hda_jack_callback *jack)
10514{
10515 struct alc_spec *spec = codec->spec;
10516 int vref;
10517
10518 snd_hda_gen_hp_automute(codec, jack);
10519 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP;
10520 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10521 vref);
10522}
10523
10524static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10525 const struct hda_fixup *fix, int action)
10526{
10527 struct alc_spec *spec = codec->spec;
10528 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
10529 spec->gen.hp_automute_hook = alc897_hp_automute_hook;
10530 }
10531}
10532
Takashi Iwai6b0f95c2020-01-05 15:47:18 +010010533static const struct coef_fw alc668_coefs[] = {
Kailang Yangf3f91852014-10-24 15:43:46 +080010534 WRITE_COEF(0x01, 0xbebe), WRITE_COEF(0x02, 0xaaaa), WRITE_COEF(0x03, 0x0),
10535 WRITE_COEF(0x04, 0x0180), WRITE_COEF(0x06, 0x0), WRITE_COEF(0x07, 0x0f80),
10536 WRITE_COEF(0x08, 0x0031), WRITE_COEF(0x0a, 0x0060), WRITE_COEF(0x0b, 0x0),
10537 WRITE_COEF(0x0c, 0x7cf7), WRITE_COEF(0x0d, 0x1080), WRITE_COEF(0x0e, 0x7f7f),
10538 WRITE_COEF(0x0f, 0xcccc), WRITE_COEF(0x10, 0xddcc), WRITE_COEF(0x11, 0x0001),
10539 WRITE_COEF(0x13, 0x0), WRITE_COEF(0x14, 0x2aa0), WRITE_COEF(0x17, 0xa940),
10540 WRITE_COEF(0x19, 0x0), WRITE_COEF(0x1a, 0x0), WRITE_COEF(0x1b, 0x0),
10541 WRITE_COEF(0x1c, 0x0), WRITE_COEF(0x1d, 0x0), WRITE_COEF(0x1e, 0x7418),
10542 WRITE_COEF(0x1f, 0x0804), WRITE_COEF(0x20, 0x4200), WRITE_COEF(0x21, 0x0468),
10543 WRITE_COEF(0x22, 0x8ccc), WRITE_COEF(0x23, 0x0250), WRITE_COEF(0x24, 0x7418),
10544 WRITE_COEF(0x27, 0x0), WRITE_COEF(0x28, 0x8ccc), WRITE_COEF(0x2a, 0xff00),
10545 WRITE_COEF(0x2b, 0x8000), WRITE_COEF(0xa7, 0xff00), WRITE_COEF(0xa8, 0x8000),
10546 WRITE_COEF(0xaa, 0x2e17), WRITE_COEF(0xab, 0xa0c0), WRITE_COEF(0xac, 0x0),
10547 WRITE_COEF(0xad, 0x0), WRITE_COEF(0xae, 0x2ac6), WRITE_COEF(0xaf, 0xa480),
10548 WRITE_COEF(0xb0, 0x0), WRITE_COEF(0xb1, 0x0), WRITE_COEF(0xb2, 0x0),
10549 WRITE_COEF(0xb3, 0x0), WRITE_COEF(0xb4, 0x0), WRITE_COEF(0xb5, 0x1040),
10550 WRITE_COEF(0xb6, 0xd697), WRITE_COEF(0xb7, 0x902b), WRITE_COEF(0xb8, 0xd697),
10551 WRITE_COEF(0xb9, 0x902b), WRITE_COEF(0xba, 0xb8ba), WRITE_COEF(0xbb, 0xaaab),
10552 WRITE_COEF(0xbc, 0xaaaf), WRITE_COEF(0xbd, 0x6aaa), WRITE_COEF(0xbe, 0x1c02),
10553 WRITE_COEF(0xc0, 0x00ff), WRITE_COEF(0xc1, 0x0fa6),
10554 {}
10555};
10556
10557static void alc668_restore_default_value(struct hda_codec *codec)
10558{
10559 alc_process_coef_fw(codec, alc668_coefs);
10560}
10561
David Henningsson6cb3b702010-09-09 08:51:44 +020010562enum {
Daniel T Chen2df03512010-10-10 22:39:28 -040010563 ALC662_FIXUP_ASPIRE,
Takashi Iwai3e887f32014-01-10 17:50:58 +010010564 ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010565 ALC662_FIXUP_IDEAPAD,
Todd Broch6be79482010-12-07 16:51:05 -080010566 ALC272_FIXUP_MARIO,
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010567 ALC662_FIXUP_CZC_ET26,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010568 ALC662_FIXUP_CZC_P10T,
David Henningsson94024cd2011-04-29 14:10:55 +020010569 ALC662_FIXUP_SKU_IGNORE,
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010570 ALC662_FIXUP_HP_RP5800,
Takashi Iwai53c334a2011-08-23 18:27:14 +020010571 ALC662_FIXUP_ASUS_MODE1,
10572 ALC662_FIXUP_ASUS_MODE2,
10573 ALC662_FIXUP_ASUS_MODE3,
10574 ALC662_FIXUP_ASUS_MODE4,
10575 ALC662_FIXUP_ASUS_MODE5,
10576 ALC662_FIXUP_ASUS_MODE6,
10577 ALC662_FIXUP_ASUS_MODE7,
10578 ALC662_FIXUP_ASUS_MODE8,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010579 ALC662_FIXUP_NO_JACK_DETECT,
David Henningssonedfe3bf2012-06-12 13:15:12 +020010580 ALC662_FIXUP_ZOTAC_Z68,
Takashi Iwai125821a2012-06-22 14:30:29 +020010581 ALC662_FIXUP_INV_DMIC,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010582 ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson73bdd592013-04-15 15:44:14 +020010583 ALC668_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020010584 ALC662_FIXUP_HEADSET_MODE,
David Henningsson73bdd592013-04-15 15:44:14 +020010585 ALC668_FIXUP_HEADSET_MODE,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010586 ALC662_FIXUP_BASS_MODE4_CHMAP,
David Henningsson61a75f12014-02-07 09:31:08 +010010587 ALC662_FIXUP_BASS_16,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010588 ALC662_FIXUP_BASS_1A,
David Henningsson8e54b4a2014-02-07 09:31:07 +010010589 ALC662_FIXUP_BASS_CHMAP,
Hui Wang493a52a2014-01-14 14:07:36 +080010590 ALC668_FIXUP_AUTO_MUTE,
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010591 ALC668_FIXUP_DELL_DISABLE_AAMIX,
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010592 ALC668_FIXUP_DELL_XPS13,
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010593 ALC662_FIXUP_ASUS_Nx50,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010594 ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010595 ALC668_FIXUP_ASUS_Nx51,
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010596 ALC668_FIXUP_MIC_COEF,
Takashi Iwai11ba6112018-10-07 09:44:17 +020010597 ALC668_FIXUP_ASUS_G751,
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010598 ALC891_FIXUP_HEADSET_MODE,
10599 ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010600 ALC662_FIXUP_ACER_VERITON,
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010601 ALC892_FIXUP_ASROCK_MOBO,
Kailang Yangc6790c82016-11-25 16:15:17 +080010602 ALC662_FIXUP_USI_FUNC,
10603 ALC662_FIXUP_USI_HEADSET_MODE,
Kailang Yangca169cc2017-04-25 16:17:40 +080010604 ALC662_FIXUP_LENOVO_MULTI_CODECS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010605 ALC669_FIXUP_ACER_ASPIRE_ETHOS,
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010606 ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET,
Kailang Yang5af290282020-01-17 14:04:01 +080010607 ALC671_FIXUP_HP_HEADSET_MIC2,
Jian-Hong Pand858c702020-03-17 16:28:07 +080010608 ALC662_FIXUP_ACER_X2660G_HEADSET_MODE,
Jian-Hong Pana1244582020-03-17 16:28:09 +080010609 ALC662_FIXUP_ACER_NITRO_HEADSET_MODE,
Hui Wanga3fd1a92021-10-12 19:47:48 +080010610 ALC668_FIXUP_ASUS_NO_HEADSET_MIC,
10611 ALC668_FIXUP_HEADSET_MIC,
10612 ALC668_FIXUP_MIC_DET_COEF,
Kailang Yangd7f327912021-11-23 16:32:44 +080010613 ALC897_FIXUP_LENOVO_HEADSET_MIC,
10614 ALC897_FIXUP_HEADSET_MIC_PIN,
David Henningsson6cb3b702010-09-09 08:51:44 +020010615};
10616
Takashi Iwai1727a772013-01-10 09:52:52 +010010617static const struct hda_fixup alc662_fixups[] = {
Daniel T Chen2df03512010-10-10 22:39:28 -040010618 [ALC662_FIXUP_ASPIRE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010619 .type = HDA_FIXUP_PINS,
10620 .v.pins = (const struct hda_pintbl[]) {
Daniel T Chen2df03512010-10-10 22:39:28 -040010621 { 0x15, 0x99130112 }, /* subwoofer */
10622 { }
10623 }
10624 },
Takashi Iwai3e887f32014-01-10 17:50:58 +010010625 [ALC662_FIXUP_LED_GPIO1] = {
10626 .type = HDA_FIXUP_FUNC,
10627 .v.func = alc662_fixup_led_gpio1,
10628 },
David Henningsson6cb3b702010-09-09 08:51:44 +020010629 [ALC662_FIXUP_IDEAPAD] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010630 .type = HDA_FIXUP_PINS,
10631 .v.pins = (const struct hda_pintbl[]) {
David Henningsson6cb3b702010-09-09 08:51:44 +020010632 { 0x17, 0x99130112 }, /* subwoofer */
10633 { }
Takashi Iwai3e887f32014-01-10 17:50:58 +010010634 },
10635 .chained = true,
10636 .chain_id = ALC662_FIXUP_LED_GPIO1,
David Henningsson6cb3b702010-09-09 08:51:44 +020010637 },
Todd Broch6be79482010-12-07 16:51:05 -080010638 [ALC272_FIXUP_MARIO] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010639 .type = HDA_FIXUP_FUNC,
Takashi Iwaib5bfbc62011-01-13 14:22:32 +010010640 .v.func = alc272_fixup_mario,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010641 },
Huacai Chenf1ec5be2020-08-02 17:26:40 +080010642 [ALC662_FIXUP_CZC_ET26] = {
10643 .type = HDA_FIXUP_PINS,
10644 .v.pins = (const struct hda_pintbl[]) {
10645 {0x12, 0x403cc000},
10646 {0x14, 0x90170110}, /* speaker */
10647 {0x15, 0x411111f0},
10648 {0x16, 0x411111f0},
10649 {0x18, 0x01a19030}, /* mic */
10650 {0x19, 0x90a7013f}, /* int-mic */
10651 {0x1a, 0x01014020},
10652 {0x1b, 0x0121401f},
10653 {0x1c, 0x411111f0},
10654 {0x1d, 0x411111f0},
10655 {0x1e, 0x40478e35},
10656 {}
10657 },
10658 .chained = true,
10659 .chain_id = ALC662_FIXUP_SKU_IGNORE
10660 },
Anisse Astierd2ebd472011-01-20 12:36:21 +010010661 [ALC662_FIXUP_CZC_P10T] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010662 .type = HDA_FIXUP_VERBS,
Anisse Astierd2ebd472011-01-20 12:36:21 +010010663 .v.verbs = (const struct hda_verb[]) {
10664 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
10665 {}
10666 }
10667 },
David Henningsson94024cd2011-04-29 14:10:55 +020010668 [ALC662_FIXUP_SKU_IGNORE] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010669 .type = HDA_FIXUP_FUNC,
Takashi Iwai23d30f22012-05-07 17:17:32 +020010670 .v.func = alc_fixup_sku_ignore,
Takashi Iwaic6b35872011-03-28 12:05:31 +020010671 },
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010672 [ALC662_FIXUP_HP_RP5800] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010673 .type = HDA_FIXUP_PINS,
10674 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020010675 { 0x14, 0x0221201f }, /* HP out */
10676 { }
10677 },
10678 .chained = true,
10679 .chain_id = ALC662_FIXUP_SKU_IGNORE
10680 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010681 [ALC662_FIXUP_ASUS_MODE1] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010682 .type = HDA_FIXUP_PINS,
10683 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010684 { 0x14, 0x99130110 }, /* speaker */
10685 { 0x18, 0x01a19c20 }, /* mic */
10686 { 0x19, 0x99a3092f }, /* int-mic */
10687 { 0x21, 0x0121401f }, /* HP out */
10688 { }
10689 },
10690 .chained = true,
10691 .chain_id = ALC662_FIXUP_SKU_IGNORE
10692 },
10693 [ALC662_FIXUP_ASUS_MODE2] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010694 .type = HDA_FIXUP_PINS,
10695 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010696 { 0x14, 0x99130110 }, /* speaker */
10697 { 0x18, 0x01a19820 }, /* mic */
10698 { 0x19, 0x99a3092f }, /* int-mic */
10699 { 0x1b, 0x0121401f }, /* HP out */
10700 { }
10701 },
Takashi Iwai53c334a2011-08-23 18:27:14 +020010702 .chained = true,
10703 .chain_id = ALC662_FIXUP_SKU_IGNORE
10704 },
10705 [ALC662_FIXUP_ASUS_MODE3] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010706 .type = HDA_FIXUP_PINS,
10707 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010708 { 0x14, 0x99130110 }, /* speaker */
10709 { 0x15, 0x0121441f }, /* HP */
10710 { 0x18, 0x01a19840 }, /* mic */
10711 { 0x19, 0x99a3094f }, /* int-mic */
10712 { 0x21, 0x01211420 }, /* HP2 */
10713 { }
10714 },
10715 .chained = true,
10716 .chain_id = ALC662_FIXUP_SKU_IGNORE
10717 },
10718 [ALC662_FIXUP_ASUS_MODE4] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010719 .type = HDA_FIXUP_PINS,
10720 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010721 { 0x14, 0x99130110 }, /* speaker */
10722 { 0x16, 0x99130111 }, /* speaker */
10723 { 0x18, 0x01a19840 }, /* mic */
10724 { 0x19, 0x99a3094f }, /* int-mic */
10725 { 0x21, 0x0121441f }, /* HP */
10726 { }
10727 },
10728 .chained = true,
10729 .chain_id = ALC662_FIXUP_SKU_IGNORE
10730 },
10731 [ALC662_FIXUP_ASUS_MODE5] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010732 .type = HDA_FIXUP_PINS,
10733 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010734 { 0x14, 0x99130110 }, /* speaker */
10735 { 0x15, 0x0121441f }, /* HP */
10736 { 0x16, 0x99130111 }, /* speaker */
10737 { 0x18, 0x01a19840 }, /* mic */
10738 { 0x19, 0x99a3094f }, /* int-mic */
10739 { }
10740 },
10741 .chained = true,
10742 .chain_id = ALC662_FIXUP_SKU_IGNORE
10743 },
10744 [ALC662_FIXUP_ASUS_MODE6] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010745 .type = HDA_FIXUP_PINS,
10746 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010747 { 0x14, 0x99130110 }, /* speaker */
10748 { 0x15, 0x01211420 }, /* HP2 */
10749 { 0x18, 0x01a19840 }, /* mic */
10750 { 0x19, 0x99a3094f }, /* int-mic */
10751 { 0x1b, 0x0121441f }, /* HP */
10752 { }
10753 },
10754 .chained = true,
10755 .chain_id = ALC662_FIXUP_SKU_IGNORE
10756 },
10757 [ALC662_FIXUP_ASUS_MODE7] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010758 .type = HDA_FIXUP_PINS,
10759 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010760 { 0x14, 0x99130110 }, /* speaker */
10761 { 0x17, 0x99130111 }, /* speaker */
10762 { 0x18, 0x01a19840 }, /* mic */
10763 { 0x19, 0x99a3094f }, /* int-mic */
10764 { 0x1b, 0x01214020 }, /* HP */
10765 { 0x21, 0x0121401f }, /* HP */
10766 { }
10767 },
10768 .chained = true,
10769 .chain_id = ALC662_FIXUP_SKU_IGNORE
10770 },
10771 [ALC662_FIXUP_ASUS_MODE8] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010772 .type = HDA_FIXUP_PINS,
10773 .v.pins = (const struct hda_pintbl[]) {
Takashi Iwai53c334a2011-08-23 18:27:14 +020010774 { 0x14, 0x99130110 }, /* speaker */
10775 { 0x12, 0x99a30970 }, /* int-mic */
10776 { 0x15, 0x01214020 }, /* HP */
10777 { 0x17, 0x99130111 }, /* speaker */
10778 { 0x18, 0x01a19840 }, /* mic */
10779 { 0x21, 0x0121401f }, /* HP */
10780 { }
10781 },
10782 .chained = true,
10783 .chain_id = ALC662_FIXUP_SKU_IGNORE
Takashi Iwai2996bdb2011-08-18 16:02:24 +020010784 },
Takashi Iwai1565cc32012-02-13 12:03:25 +010010785 [ALC662_FIXUP_NO_JACK_DETECT] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010786 .type = HDA_FIXUP_FUNC,
Takashi Iwai1565cc32012-02-13 12:03:25 +010010787 .v.func = alc_fixup_no_jack_detect,
10788 },
David Henningssonedfe3bf2012-06-12 13:15:12 +020010789 [ALC662_FIXUP_ZOTAC_Z68] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010790 .type = HDA_FIXUP_PINS,
10791 .v.pins = (const struct hda_pintbl[]) {
David Henningssonedfe3bf2012-06-12 13:15:12 +020010792 { 0x1b, 0x02214020 }, /* Front HP */
10793 { }
10794 }
10795 },
Takashi Iwai125821a2012-06-22 14:30:29 +020010796 [ALC662_FIXUP_INV_DMIC] = {
Takashi Iwai1727a772013-01-10 09:52:52 +010010797 .type = HDA_FIXUP_FUNC,
David Henningsson9d36a7d2014-10-07 10:18:42 +020010798 .v.func = alc_fixup_inv_dmic,
Takashi Iwai125821a2012-06-22 14:30:29 +020010799 },
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020010800 [ALC668_FIXUP_DELL_XPS13] = {
10801 .type = HDA_FIXUP_FUNC,
10802 .v.func = alc_fixup_dell_xps13,
10803 .chained = true,
10804 .chain_id = ALC668_FIXUP_DELL_DISABLE_AAMIX
10805 },
Gabriele Mazzotta5e6db662014-05-20 18:58:26 +020010806 [ALC668_FIXUP_DELL_DISABLE_AAMIX] = {
10807 .type = HDA_FIXUP_FUNC,
10808 .v.func = alc_fixup_disable_aamix,
10809 .chained = true,
10810 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10811 },
Hui Wang493a52a2014-01-14 14:07:36 +080010812 [ALC668_FIXUP_AUTO_MUTE] = {
10813 .type = HDA_FIXUP_FUNC,
10814 .v.func = alc_fixup_auto_mute_via_amp,
10815 .chained = true,
10816 .chain_id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE
10817 },
David Henningsson1f8b46c2015-05-12 14:38:15 +020010818 [ALC662_FIXUP_DELL_MIC_NO_PRESENCE] = {
10819 .type = HDA_FIXUP_PINS,
10820 .v.pins = (const struct hda_pintbl[]) {
10821 { 0x19, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10822 /* headphone mic by setting pin control of 0x1b (headphone out) to in + vref_50 */
10823 { }
10824 },
10825 .chained = true,
10826 .chain_id = ALC662_FIXUP_HEADSET_MODE
10827 },
10828 [ALC662_FIXUP_HEADSET_MODE] = {
10829 .type = HDA_FIXUP_FUNC,
10830 .v.func = alc_fixup_headset_mode_alc662,
10831 },
David Henningsson73bdd592013-04-15 15:44:14 +020010832 [ALC668_FIXUP_DELL_MIC_NO_PRESENCE] = {
10833 .type = HDA_FIXUP_PINS,
10834 .v.pins = (const struct hda_pintbl[]) {
10835 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10836 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10837 { }
10838 },
10839 .chained = true,
10840 .chain_id = ALC668_FIXUP_HEADSET_MODE
10841 },
10842 [ALC668_FIXUP_HEADSET_MODE] = {
10843 .type = HDA_FIXUP_FUNC,
10844 .v.func = alc_fixup_headset_mode_alc668,
10845 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010846 [ALC662_FIXUP_BASS_MODE4_CHMAP] = {
Takashi Iwai8e383952013-10-30 17:41:12 +010010847 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010848 .v.func = alc_fixup_bass_chmap,
Takashi Iwai8e383952013-10-30 17:41:12 +010010849 .chained = true,
10850 .chain_id = ALC662_FIXUP_ASUS_MODE4
10851 },
David Henningsson61a75f12014-02-07 09:31:08 +010010852 [ALC662_FIXUP_BASS_16] = {
10853 .type = HDA_FIXUP_PINS,
10854 .v.pins = (const struct hda_pintbl[]) {
10855 {0x16, 0x80106111}, /* bass speaker */
10856 {}
10857 },
10858 .chained = true,
10859 .chain_id = ALC662_FIXUP_BASS_CHMAP,
10860 },
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010861 [ALC662_FIXUP_BASS_1A] = {
10862 .type = HDA_FIXUP_PINS,
10863 .v.pins = (const struct hda_pintbl[]) {
10864 {0x1a, 0x80106111}, /* bass speaker */
10865 {}
10866 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010867 .chained = true,
10868 .chain_id = ALC662_FIXUP_BASS_CHMAP,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010869 },
David Henningsson8e54b4a2014-02-07 09:31:07 +010010870 [ALC662_FIXUP_BASS_CHMAP] = {
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010871 .type = HDA_FIXUP_FUNC,
Takashi Iwaieb9ca3a2013-11-28 15:24:34 +010010872 .v.func = alc_fixup_bass_chmap,
Takashi Iwaia30c9aa2013-11-21 08:00:20 +010010873 },
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020010874 [ALC662_FIXUP_ASUS_Nx50] = {
10875 .type = HDA_FIXUP_FUNC,
10876 .v.func = alc_fixup_auto_mute_via_amp,
10877 .chained = true,
10878 .chain_id = ALC662_FIXUP_BASS_1A
10879 },
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010880 [ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE] = {
10881 .type = HDA_FIXUP_FUNC,
10882 .v.func = alc_fixup_headset_mode_alc668,
10883 .chain_id = ALC662_FIXUP_BASS_CHMAP
10884 },
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010885 [ALC668_FIXUP_ASUS_Nx51] = {
10886 .type = HDA_FIXUP_PINS,
10887 .v.pins = (const struct hda_pintbl[]) {
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010888 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10889 { 0x1a, 0x90170151 }, /* bass speaker */
10890 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010891 {}
10892 },
10893 .chained = true,
Mikhail Paulyshkafc7438b2017-04-21 08:52:42 +020010894 .chain_id = ALC668_FIXUP_ASUS_Nx51_HEADSET_MODE,
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070010895 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010896 [ALC668_FIXUP_MIC_COEF] = {
Takashi Iwai11ba6112018-10-07 09:44:17 +020010897 .type = HDA_FIXUP_VERBS,
10898 .v.verbs = (const struct hda_verb[]) {
10899 { 0x20, AC_VERB_SET_COEF_INDEX, 0xc3 },
10900 { 0x20, AC_VERB_SET_PROC_COEF, 0x4000 },
10901 {}
10902 },
10903 },
Takashi Iwai5b7c5e12018-10-09 14:20:17 +020010904 [ALC668_FIXUP_ASUS_G751] = {
10905 .type = HDA_FIXUP_PINS,
10906 .v.pins = (const struct hda_pintbl[]) {
10907 { 0x16, 0x0421101f }, /* HP */
10908 {}
10909 },
10910 .chained = true,
10911 .chain_id = ALC668_FIXUP_MIC_COEF
10912 },
Kailang Yang78f4f7c2016-06-07 11:31:34 +080010913 [ALC891_FIXUP_HEADSET_MODE] = {
10914 .type = HDA_FIXUP_FUNC,
10915 .v.func = alc_fixup_headset_mode,
10916 },
10917 [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = {
10918 .type = HDA_FIXUP_PINS,
10919 .v.pins = (const struct hda_pintbl[]) {
10920 { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
10921 { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */
10922 { }
10923 },
10924 .chained = true,
10925 .chain_id = ALC891_FIXUP_HEADSET_MODE
10926 },
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080010927 [ALC662_FIXUP_ACER_VERITON] = {
10928 .type = HDA_FIXUP_PINS,
10929 .v.pins = (const struct hda_pintbl[]) {
10930 { 0x15, 0x50170120 }, /* no internal speaker */
10931 { }
10932 }
10933 },
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010934 [ALC892_FIXUP_ASROCK_MOBO] = {
10935 .type = HDA_FIXUP_PINS,
10936 .v.pins = (const struct hda_pintbl[]) {
10937 { 0x15, 0x40f000f0 }, /* disabled */
10938 { 0x16, 0x40f000f0 }, /* disabled */
Takashi Iwai1a3f0992016-10-20 12:14:51 +020010939 { }
10940 }
10941 },
Kailang Yangc6790c82016-11-25 16:15:17 +080010942 [ALC662_FIXUP_USI_FUNC] = {
10943 .type = HDA_FIXUP_FUNC,
10944 .v.func = alc662_fixup_usi_headset_mic,
10945 },
10946 [ALC662_FIXUP_USI_HEADSET_MODE] = {
10947 .type = HDA_FIXUP_PINS,
10948 .v.pins = (const struct hda_pintbl[]) {
10949 { 0x19, 0x02a1913c }, /* use as headset mic, without its own jack detect */
10950 { 0x18, 0x01a1903d },
10951 { }
10952 },
10953 .chained = true,
10954 .chain_id = ALC662_FIXUP_USI_FUNC
10955 },
Kailang Yangca169cc2017-04-25 16:17:40 +080010956 [ALC662_FIXUP_LENOVO_MULTI_CODECS] = {
10957 .type = HDA_FIXUP_FUNC,
10958 .v.func = alc233_alc662_fixup_lenovo_dual_codecs,
10959 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010960 [ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET] = {
10961 .type = HDA_FIXUP_FUNC,
10962 .v.func = alc662_fixup_aspire_ethos_hp,
10963 },
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010964 [ALC669_FIXUP_ACER_ASPIRE_ETHOS] = {
10965 .type = HDA_FIXUP_PINS,
10966 .v.pins = (const struct hda_pintbl[]) {
10967 { 0x15, 0x92130110 }, /* front speakers */
10968 { 0x18, 0x99130111 }, /* center/subwoofer */
10969 { 0x1b, 0x11130012 }, /* surround plus jack for HP */
10970 { }
10971 },
10972 .chained = true,
Takashi Iwai336820c2019-11-28 21:26:30 +010010973 .chain_id = ALC669_FIXUP_ACER_ASPIRE_ETHOS_HEADSET
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020010974 },
Kailang Yang5af290282020-01-17 14:04:01 +080010975 [ALC671_FIXUP_HP_HEADSET_MIC2] = {
10976 .type = HDA_FIXUP_FUNC,
10977 .v.func = alc671_fixup_hp_headset_mic2,
10978 },
Jian-Hong Pand858c702020-03-17 16:28:07 +080010979 [ALC662_FIXUP_ACER_X2660G_HEADSET_MODE] = {
10980 .type = HDA_FIXUP_PINS,
10981 .v.pins = (const struct hda_pintbl[]) {
10982 { 0x1a, 0x02a1113c }, /* use as headset mic, without its own jack detect */
10983 { }
10984 },
10985 .chained = true,
10986 .chain_id = ALC662_FIXUP_USI_FUNC
10987 },
Jian-Hong Pana1244582020-03-17 16:28:09 +080010988 [ALC662_FIXUP_ACER_NITRO_HEADSET_MODE] = {
10989 .type = HDA_FIXUP_PINS,
10990 .v.pins = (const struct hda_pintbl[]) {
10991 { 0x1a, 0x01a11140 }, /* use as headset mic, without its own jack detect */
10992 { 0x1b, 0x0221144f },
10993 { }
10994 },
10995 .chained = true,
10996 .chain_id = ALC662_FIXUP_USI_FUNC
10997 },
Hui Wanga3fd1a92021-10-12 19:47:48 +080010998 [ALC668_FIXUP_ASUS_NO_HEADSET_MIC] = {
10999 .type = HDA_FIXUP_PINS,
11000 .v.pins = (const struct hda_pintbl[]) {
11001 { 0x1b, 0x04a1112c },
11002 { }
11003 },
11004 .chained = true,
11005 .chain_id = ALC668_FIXUP_HEADSET_MIC
11006 },
11007 [ALC668_FIXUP_HEADSET_MIC] = {
11008 .type = HDA_FIXUP_FUNC,
11009 .v.func = alc269_fixup_headset_mic,
11010 .chained = true,
11011 .chain_id = ALC668_FIXUP_MIC_DET_COEF
11012 },
11013 [ALC668_FIXUP_MIC_DET_COEF] = {
11014 .type = HDA_FIXUP_VERBS,
11015 .v.verbs = (const struct hda_verb[]) {
11016 { 0x20, AC_VERB_SET_COEF_INDEX, 0x15 },
11017 { 0x20, AC_VERB_SET_PROC_COEF, 0x0d60 },
11018 {}
11019 },
11020 },
Kailang Yangd7f327912021-11-23 16:32:44 +080011021 [ALC897_FIXUP_LENOVO_HEADSET_MIC] = {
11022 .type = HDA_FIXUP_FUNC,
11023 .v.func = alc897_fixup_lenovo_headset_mic,
11024 },
11025 [ALC897_FIXUP_HEADSET_MIC_PIN] = {
11026 .type = HDA_FIXUP_PINS,
11027 .v.pins = (const struct hda_pintbl[]) {
11028 { 0x1a, 0x03a11050 },
11029 { }
11030 },
11031 .chained = true,
11032 .chain_id = ALC897_FIXUP_LENOVO_HEADSET_MIC
11033 },
David Henningsson6cb3b702010-09-09 08:51:44 +020011034};
11035
Takashi Iwaia9111322011-05-02 11:30:18 +020011036static const struct snd_pci_quirk alc662_fixup_tbl[] = {
Takashi Iwai53c334a2011-08-23 18:27:14 +020011037 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_FIXUP_ASUS_MODE2),
Takashi Iwaid3d38352013-08-19 20:05:50 +020011038 SND_PCI_QUIRK(0x1025, 0x022f, "Acer Aspire One", ALC662_FIXUP_INV_DMIC),
David Henningsson02f6ff92015-12-07 11:29:31 +010011039 SND_PCI_QUIRK(0x1025, 0x0241, "Packard Bell DOTS", ALC662_FIXUP_INV_DMIC),
David Henningssona6c47a82011-02-10 15:39:19 +010011040 SND_PCI_QUIRK(0x1025, 0x0308, "Acer Aspire 8942G", ALC662_FIXUP_ASPIRE),
David Henningsson94024cd2011-04-29 14:10:55 +020011041 SND_PCI_QUIRK(0x1025, 0x031c, "Gateway NV79", ALC662_FIXUP_SKU_IGNORE),
Takashi Iwai125821a2012-06-22 14:30:29 +020011042 SND_PCI_QUIRK(0x1025, 0x0349, "eMachines eM250", ALC662_FIXUP_INV_DMIC),
Takashi Iwai18019282013-08-16 08:17:05 +020011043 SND_PCI_QUIRK(0x1025, 0x034a, "Gateway LT27", ALC662_FIXUP_INV_DMIC),
Daniel T Chen2df03512010-10-10 22:39:28 -040011044 SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
Takashi Iwai9edeb112021-04-28 13:27:02 +020011045 SND_PCI_QUIRK(0x1025, 0x0566, "Acer Aspire Ethos 8951G", ALC669_FIXUP_ACER_ASPIRE_ETHOS),
Jian-Hong Pana1244582020-03-17 16:28:09 +080011046 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
Jian-Hong Pand858c702020-03-17 16:28:07 +080011047 SND_PCI_QUIRK(0x1025, 0x124e, "Acer 2660G", ALC662_FIXUP_ACER_X2660G_HEADSET_MODE),
David Henningsson73bdd592013-04-15 15:44:14 +020011048 SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11049 SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaic5d019c2014-07-22 17:33:32 +020011050 SND_PCI_QUIRK(0x1028, 0x05fe, "Dell XPS 15", ALC668_FIXUP_DELL_XPS13),
Gabriele Mazzotta033b0a72014-05-26 17:11:46 +020011051 SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_XPS13),
Niranjan Sivakumar467e1432015-09-05 18:20:35 +020011052 SND_PCI_QUIRK(0x1028, 0x060d, "Dell M3800", ALC668_FIXUP_DELL_XPS13),
David Henningsson09d20142013-11-20 11:43:30 +010011053 SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
David Henningssonad8ff99e2013-11-07 09:28:59 +010011054 SND_PCI_QUIRK(0x1028, 0x0626, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang8dc9abb2014-04-16 15:53:12 +080011055 SND_PCI_QUIRK(0x1028, 0x0696, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
11056 SND_PCI_QUIRK(0x1028, 0x0698, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Kailang Yang6a98e342014-10-27 16:20:30 +080011057 SND_PCI_QUIRK(0x1028, 0x069f, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
Takashi Iwaie59ea3e2011-06-29 17:21:00 +020011058 SND_PCI_QUIRK(0x103c, 0x1632, "HP RP5800", ALC662_FIXUP_HP_RP5800),
Jeremy Szu148ebf542020-10-08 18:56:44 +080011059 SND_PCI_QUIRK(0x103c, 0x873e, "HP", ALC671_FIXUP_HP_HEADSET_MIC2),
Kaho Ng2da2dc92016-05-09 00:27:49 +080011060 SND_PCI_QUIRK(0x1043, 0x1080, "Asus UX501VW", ALC668_FIXUP_HEADSET_MODE),
Bobi Mihalca83a9efb2016-03-23 13:32:33 +020011061 SND_PCI_QUIRK(0x1043, 0x11cd, "Asus N550", ALC662_FIXUP_ASUS_Nx50),
Bobi Mihalca9d4dc582016-03-23 13:26:11 +020011062 SND_PCI_QUIRK(0x1043, 0x129d, "Asus N750", ALC662_FIXUP_ASUS_Nx50),
Takashi Iwai11ba6112018-10-07 09:44:17 +020011063 SND_PCI_QUIRK(0x1043, 0x12ff, "ASUS G751", ALC668_FIXUP_ASUS_G751),
Takashi Iwai9edeb112021-04-28 13:27:02 +020011064 SND_PCI_QUIRK(0x1043, 0x13df, "Asus N550JX", ALC662_FIXUP_BASS_1A),
David Henningsson8e54b4a2014-02-07 09:31:07 +010011065 SND_PCI_QUIRK(0x1043, 0x1477, "ASUS N56VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
David Henningsson61a75f12014-02-07 09:31:08 +010011066 SND_PCI_QUIRK(0x1043, 0x15a7, "ASUS UX51VZH", ALC662_FIXUP_BASS_16),
Yura Pakhuchiy3231e202016-05-07 23:53:36 +070011067 SND_PCI_QUIRK(0x1043, 0x177d, "ASUS N551", ALC668_FIXUP_ASUS_Nx51),
11068 SND_PCI_QUIRK(0x1043, 0x17bd, "ASUS N751", ALC668_FIXUP_ASUS_Nx51),
Hui Wanga3fd1a92021-10-12 19:47:48 +080011069 SND_PCI_QUIRK(0x1043, 0x185d, "ASUS G551JW", ALC668_FIXUP_ASUS_NO_HEADSET_MIC),
Takashi Iwaic7efff92017-01-04 21:38:16 +010011070 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71SL", ALC662_FIXUP_ASUS_MODE8),
David Henningsson61a75f12014-02-07 09:31:08 +010011071 SND_PCI_QUIRK(0x1043, 0x1b73, "ASUS N55SF", ALC662_FIXUP_BASS_16),
David Henningsson8e54b4a2014-02-07 09:31:07 +010011072 SND_PCI_QUIRK(0x1043, 0x1bf3, "ASUS N76VZ", ALC662_FIXUP_BASS_MODE4_CHMAP),
Takashi Iwai1565cc32012-02-13 12:03:25 +010011073 SND_PCI_QUIRK(0x1043, 0x8469, "ASUS mobo", ALC662_FIXUP_NO_JACK_DETECT),
Takashi Iwai53c334a2011-08-23 18:27:14 +020011074 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_FIXUP_ASUS_MODE2),
Daniel T Chena0e90ac2010-11-20 10:20:35 -050011075 SND_PCI_QUIRK(0x144d, 0xc051, "Samsung R720", ALC662_FIXUP_IDEAPAD),
Kailang Yangc6790c82016-11-25 16:15:17 +080011076 SND_PCI_QUIRK(0x14cd, 0x5003, "USI", ALC662_FIXUP_USI_HEADSET_MODE),
Kailang Yangca169cc2017-04-25 16:17:40 +080011077 SND_PCI_QUIRK(0x17aa, 0x1036, "Lenovo P520", ALC662_FIXUP_LENOVO_MULTI_CODECS),
Kailang Yangd7f327912021-11-23 16:32:44 +080011078 SND_PCI_QUIRK(0x17aa, 0x32ca, "Lenovo ThinkCentre M80", ALC897_FIXUP_HEADSET_MIC_PIN),
11079 SND_PCI_QUIRK(0x17aa, 0x32cb, "Lenovo ThinkCentre M70", ALC897_FIXUP_HEADSET_MIC_PIN),
11080 SND_PCI_QUIRK(0x17aa, 0x32cf, "Lenovo ThinkCentre M950", ALC897_FIXUP_HEADSET_MIC_PIN),
11081 SND_PCI_QUIRK(0x17aa, 0x32f7, "Lenovo ThinkCentre M90", ALC897_FIXUP_HEADSET_MIC_PIN),
Valentine Sinitsynd4118582010-10-01 22:24:08 +060011082 SND_PCI_QUIRK(0x17aa, 0x38af, "Lenovo Ideapad Y550P", ALC662_FIXUP_IDEAPAD),
David Henningsson6cb3b702010-09-09 08:51:44 +020011083 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Ideapad Y550", ALC662_FIXUP_IDEAPAD),
Takashi Iwai1a3f0992016-10-20 12:14:51 +020011084 SND_PCI_QUIRK(0x1849, 0x5892, "ASRock B150M", ALC892_FIXUP_ASROCK_MOBO),
David Henningssonedfe3bf2012-06-12 13:15:12 +020011085 SND_PCI_QUIRK(0x19da, 0xa130, "Zotac Z68", ALC662_FIXUP_ZOTAC_Z68),
Shrirang Bagul9b51fe32016-08-01 13:16:17 +080011086 SND_PCI_QUIRK(0x1b0a, 0x01b8, "ACER Veriton", ALC662_FIXUP_ACER_VERITON),
Huacai Chenf1ec5be2020-08-02 17:26:40 +080011087 SND_PCI_QUIRK(0x1b35, 0x1234, "CZC ET26", ALC662_FIXUP_CZC_ET26),
Anisse Astierd2ebd472011-01-20 12:36:21 +010011088 SND_PCI_QUIRK(0x1b35, 0x2206, "CZC P10T", ALC662_FIXUP_CZC_P10T),
Takashi Iwai53c334a2011-08-23 18:27:14 +020011089
11090#if 0
11091 /* Below is a quirk table taken from the old code.
11092 * Basically the device should work as is without the fixup table.
11093 * If BIOS doesn't give a proper info, enable the corresponding
11094 * fixup entry.
Jesper Juhl7d7eb9e2012-04-12 22:11:25 +020011095 */
Takashi Iwai53c334a2011-08-23 18:27:14 +020011096 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC662_FIXUP_ASUS_MODE1),
11097 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC662_FIXUP_ASUS_MODE3),
11098 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC662_FIXUP_ASUS_MODE1),
11099 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC662_FIXUP_ASUS_MODE3),
11100 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11101 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11102 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11103 SND_PCI_QUIRK(0x1043, 0x1303, "ASUS G60J", ALC662_FIXUP_ASUS_MODE1),
11104 SND_PCI_QUIRK(0x1043, 0x1333, "ASUS G60Jx", ALC662_FIXUP_ASUS_MODE1),
11105 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11106 SND_PCI_QUIRK(0x1043, 0x13e3, "ASUS N71JA", ALC662_FIXUP_ASUS_MODE7),
11107 SND_PCI_QUIRK(0x1043, 0x1463, "ASUS N71", ALC662_FIXUP_ASUS_MODE7),
11108 SND_PCI_QUIRK(0x1043, 0x14d3, "ASUS G72", ALC662_FIXUP_ASUS_MODE8),
11109 SND_PCI_QUIRK(0x1043, 0x1563, "ASUS N90", ALC662_FIXUP_ASUS_MODE3),
11110 SND_PCI_QUIRK(0x1043, 0x15d3, "ASUS N50SF F50SF", ALC662_FIXUP_ASUS_MODE1),
11111 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11112 SND_PCI_QUIRK(0x1043, 0x16f3, "ASUS K40C K50C", ALC662_FIXUP_ASUS_MODE2),
11113 SND_PCI_QUIRK(0x1043, 0x1733, "ASUS N81De", ALC662_FIXUP_ASUS_MODE1),
11114 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11115 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11116 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11117 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11118 SND_PCI_QUIRK(0x1043, 0x1793, "ASUS F50GX", ALC662_FIXUP_ASUS_MODE1),
11119 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC662_FIXUP_ASUS_MODE3),
11120 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_FIXUP_ASUS_MODE2),
11121 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11122 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC662_FIXUP_ASUS_MODE5),
11123 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC662_FIXUP_ASUS_MODE6),
11124 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11125 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC662_FIXUP_ASUS_MODE1),
11126 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11127 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11128 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC662_FIXUP_ASUS_MODE3),
11129 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC662_FIXUP_ASUS_MODE3),
11130 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC662_FIXUP_ASUS_MODE1),
11131 SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC662_FIXUP_ASUS_MODE1),
11132 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC662_FIXUP_ASUS_MODE1),
11133 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC662_FIXUP_ASUS_MODE1),
11134 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC662_FIXUP_ASUS_MODE1),
11135 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_FIXUP_ASUS_MODE2),
11136 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_FIXUP_ASUS_MODE2),
11137 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC662_FIXUP_ASUS_MODE1),
11138 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11139 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC662_FIXUP_ASUS_MODE3),
11140 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC662_FIXUP_ASUS_MODE1),
11141 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC662_FIXUP_ASUS_MODE1),
11142 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC662_FIXUP_ASUS_MODE1),
11143 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_FIXUP_ASUS_MODE2),
11144 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC662_FIXUP_ASUS_MODE1),
11145 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC662_FIXUP_ASUS_MODE4),
11146#endif
David Henningsson6cb3b702010-09-09 08:51:44 +020011147 {}
11148};
11149
Takashi Iwai1727a772013-01-10 09:52:52 +010011150static const struct hda_model_fixup alc662_fixup_models[] = {
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011151 {.id = ALC662_FIXUP_ASPIRE, .name = "aspire"},
11152 {.id = ALC662_FIXUP_IDEAPAD, .name = "ideapad"},
Todd Broch6be79482010-12-07 16:51:05 -080011153 {.id = ALC272_FIXUP_MARIO, .name = "mario"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011154 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
Takashi Iwai53c334a2011-08-23 18:27:14 +020011155 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11156 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11157 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11158 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11159 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11160 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11161 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11162 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011163 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
Takashi Iwai6e72aa52012-06-25 10:52:25 +020011164 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011165 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
David Henningssone32aa852013-06-17 11:04:02 +020011166 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011167 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11168 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11169 {.id = ALC662_FIXUP_BASS_16, .name = "bass16"},
11170 {.id = ALC662_FIXUP_BASS_1A, .name = "bass1a"},
11171 {.id = ALC668_FIXUP_AUTO_MUTE, .name = "automute"},
11172 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11173 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11174 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
Takashi Iwai40c51672018-10-07 09:47:39 +020011175 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
Takashi Iwaiaa3841b2018-06-26 07:42:40 +020011176 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11177 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11178 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11179 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11180 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
Takashi Iwaiba90d6a2017-05-22 16:38:47 +020011181 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
Sergey Bostandzhyan00066e92019-09-06 11:33:43 +020011182 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
Todd Broch6be79482010-12-07 16:51:05 -080011183 {}
11184};
David Henningsson6cb3b702010-09-09 08:51:44 +020011185
Hui Wang532895c2014-05-29 15:59:19 +080011186static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = {
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011187 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11188 {0x17, 0x02211010},
11189 {0x18, 0x01a19030},
11190 {0x1a, 0x01813040},
11191 {0x21, 0x01014020}),
Hui Wang4b4e0e32019-07-16 15:21:34 +080011192 SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE,
11193 {0x16, 0x01813030},
11194 {0x17, 0x02211010},
11195 {0x18, 0x01a19040},
11196 {0x21, 0x01014020}),
David Henningsson1f8b46c2015-05-12 14:38:15 +020011197 SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE,
David Henningsson1f8b46c2015-05-12 14:38:15 +020011198 {0x14, 0x01014010},
David Henningsson1f8b46c2015-05-12 14:38:15 +020011199 {0x18, 0x01a19020},
David Henningsson1f8b46c2015-05-12 14:38:15 +020011200 {0x1a, 0x0181302f},
Hui Wang11580292015-08-03 11:03:49 +080011201 {0x1b, 0x0221401f}),
David Henningsson76c21322014-06-24 14:46:54 +020011202 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11203 {0x12, 0x99a30130},
11204 {0x14, 0x90170110},
11205 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011206 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011207 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11208 {0x12, 0x99a30140},
11209 {0x14, 0x90170110},
11210 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011211 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011212 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
11213 {0x12, 0x99a30150},
11214 {0x14, 0x90170110},
11215 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011216 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011217 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell", ALC668_FIXUP_AUTO_MUTE,
David Henningsson76c21322014-06-24 14:46:54 +020011218 {0x14, 0x90170110},
11219 {0x15, 0x0321101f},
Hui Wang11580292015-08-03 11:03:49 +080011220 {0x16, 0x03011020}),
David Henningsson76c21322014-06-24 14:46:54 +020011221 SND_HDA_PIN_QUIRK(0x10ec0668, 0x1028, "Dell XPS 15", ALC668_FIXUP_AUTO_MUTE,
11222 {0x12, 0x90a60130},
11223 {0x14, 0x90170110},
Hui Wang11580292015-08-03 11:03:49 +080011224 {0x15, 0x0321101f}),
Kailang Yang5af290282020-01-17 14:04:01 +080011225 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11226 {0x14, 0x01014010},
11227 {0x17, 0x90170150},
Kailang Yangf2adbae2020-02-05 15:40:01 +080011228 {0x19, 0x02a11060},
Kailang Yang5af290282020-01-17 14:04:01 +080011229 {0x1b, 0x01813030},
11230 {0x21, 0x02211020}),
11231 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11232 {0x14, 0x01014010},
11233 {0x18, 0x01a19040},
11234 {0x1b, 0x01813030},
11235 {0x21, 0x02211020}),
11236 SND_HDA_PIN_QUIRK(0x10ec0671, 0x103c, "HP cPC", ALC671_FIXUP_HP_HEADSET_MIC2,
11237 {0x14, 0x01014020},
11238 {0x17, 0x90170110},
11239 {0x18, 0x01a19050},
11240 {0x1b, 0x01813040},
11241 {0x21, 0x02211030}),
Hui Wang532895c2014-05-29 15:59:19 +080011242 {}
11243};
11244
Takashi Iwai1d045db2011-07-07 18:23:21 +020011245/*
11246 */
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011247static int patch_alc662(struct hda_codec *codec)
11248{
11249 struct alc_spec *spec;
Takashi Iwai3de95172012-05-07 18:03:15 +020011250 int err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011251
Takashi Iwai3de95172012-05-07 18:03:15 +020011252 err = alc_alloc_spec(codec, 0x0b);
11253 if (err < 0)
11254 return err;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011255
Takashi Iwai3de95172012-05-07 18:03:15 +020011256 spec = codec->spec;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011257
Takashi Iwai225068a2015-05-29 10:42:14 +020011258 spec->shutup = alc_eapd_shutup;
11259
Takashi Iwai53c334a2011-08-23 18:27:14 +020011260 /* handle multiple HPs as is */
11261 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
11262
Takashi Iwai2c3bf9a2008-06-04 12:39:38 +020011263 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11264
Takashi Iwai7639a062015-03-03 10:07:24 +010011265 switch (codec->core.vendor_id) {
Kailang Yangf3f91852014-10-24 15:43:46 +080011266 case 0x10ec0668:
11267 spec->init_hook = alc668_restore_default_value;
11268 break;
Kailang Yangf3f91852014-10-24 15:43:46 +080011269 }
Kailang Yang8663ff72012-06-29 09:35:52 +020011270
Takashi Iwaic9af7532019-05-10 11:01:43 +020011271 alc_pre_init(codec);
11272
Takashi Iwai1727a772013-01-10 09:52:52 +010011273 snd_hda_pick_fixup(codec, alc662_fixup_models,
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011274 alc662_fixup_tbl, alc662_fixups);
Hui Wang0fc1e442019-08-16 14:27:39 +080011275 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
Takashi Iwai1727a772013-01-10 09:52:52 +010011276 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
Takashi Iwai8e5a0502012-06-21 15:49:33 +020011277
11278 alc_auto_parse_customize_define(codec);
11279
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011280 if (has_cdefine_beep(codec))
11281 spec->gen.beep_nid = 0x01;
11282
Takashi Iwai1bb7e432011-10-17 16:50:59 +020011283 if ((alc_get_coef0(codec) & (1 << 14)) &&
Takashi Iwai5100cd02014-02-15 10:03:19 +010011284 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011285 spec->cdefine.platform_type == 1) {
Wei Yongjun6134b1a2013-04-18 11:12:59 +080011286 err = alc_codec_rename(codec, "ALC272X");
11287 if (err < 0)
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011288 goto error;
Takashi Iwai20ca0c32011-10-17 16:00:35 +020011289 }
Kailang Yang274693f2009-12-03 10:07:50 +010011290
Takashi Iwaib9c51062011-08-24 18:08:07 +020011291 /* automatic parse from the BIOS config */
11292 err = alc662_parse_auto_config(codec);
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011293 if (err < 0)
11294 goto error;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011295
Takashi Iwai7504b6c2013-03-18 11:25:51 +010011296 if (!spec->gen.no_analog && spec->gen.beep_nid) {
Takashi Iwai7639a062015-03-03 10:07:24 +010011297 switch (codec->core.vendor_id) {
Kailang Yangda00c242010-03-19 11:23:45 +010011298 case 0x10ec0662:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011299 err = set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011300 break;
11301 case 0x10ec0272:
11302 case 0x10ec0663:
11303 case 0x10ec0665:
Kailang Yang9ad54542013-11-26 15:41:40 +080011304 case 0x10ec0668:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011305 err = set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011306 break;
11307 case 0x10ec0273:
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011308 err = set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT);
Kailang Yangda00c242010-03-19 11:23:45 +010011309 break;
11310 }
Takashi Iwaifea80fa2018-06-20 12:52:46 +020011311 if (err < 0)
11312 goto error;
Kailang Yangcec27c82010-02-04 14:18:18 +010011313 }
Takashi Iwai2134ea42008-01-10 16:53:55 +010011314
Takashi Iwai1727a772013-01-10 09:52:52 +010011315 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
Takashi Iwai589876e2012-02-20 15:47:55 +010011316
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011317 return 0;
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011318
Takashi Iwaie16fb6d2011-10-17 16:39:09 +020011319 error:
11320 alc_free(codec);
11321 return err;
Kailang Yangb478b992011-05-18 11:51:15 +020011322}
11323
Kailang Yangbc9f98a2007-04-12 13:06:07 +020011324/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011325 * ALC680 support
11326 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011327
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011328static int alc680_parse_auto_config(struct hda_codec *codec)
11329{
Takashi Iwai3e6179b2011-07-08 16:55:13 +020011330 return alc_parse_auto_config(codec, NULL, NULL);
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011331}
11332
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011333/*
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011334 */
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011335static int patch_alc680(struct hda_codec *codec)
11336{
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011337 int err;
11338
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011339 /* ALC680 has no aa-loopback mixer */
Takashi Iwai3de95172012-05-07 18:03:15 +020011340 err = alc_alloc_spec(codec, 0);
11341 if (err < 0)
11342 return err;
Takashi Iwai1f0f4b82011-06-27 10:52:59 +020011343
Takashi Iwai1ebec5f2011-08-15 13:21:48 +020011344 /* automatic parse from the BIOS config */
11345 err = alc680_parse_auto_config(codec);
11346 if (err < 0) {
11347 alc_free(codec);
11348 return err;
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011349 }
11350
Kailang Yangd1eb57f2010-06-23 16:25:26 +020011351 return 0;
11352}
11353
11354/*
Linus Torvalds1da177e2005-04-16 15:20:36 -070011355 * patch entries
11356 */
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011357static const struct hda_device_id snd_hda_id_realtek[] = {
Kailang Yang0a6f0602017-06-30 16:00:48 +080011358 HDA_CODEC_ENTRY(0x10ec0215, "ALC215", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011359 HDA_CODEC_ENTRY(0x10ec0221, "ALC221", patch_alc269),
Hui Wang2a36c162019-09-04 13:53:27 +080011360 HDA_CODEC_ENTRY(0x10ec0222, "ALC222", patch_alc269),
Kailang Yang42314302016-02-03 15:03:50 +080011361 HDA_CODEC_ENTRY(0x10ec0225, "ALC225", patch_alc269),
Takashi Iwai1948fc02021-06-18 18:17:20 +020011362 HDA_CODEC_ENTRY(0x10ec0230, "ALC236", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011363 HDA_CODEC_ENTRY(0x10ec0231, "ALC231", patch_alc269),
11364 HDA_CODEC_ENTRY(0x10ec0233, "ALC233", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011365 HDA_CODEC_ENTRY(0x10ec0234, "ALC234", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011366 HDA_CODEC_ENTRY(0x10ec0235, "ALC233", patch_alc269),
Kailang Yang736f20a2017-10-20 15:06:34 +080011367 HDA_CODEC_ENTRY(0x10ec0236, "ALC236", patch_alc269),
Kailang Yang7fbdcd82020-04-23 14:18:31 +080011368 HDA_CODEC_ENTRY(0x10ec0245, "ALC245", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011369 HDA_CODEC_ENTRY(0x10ec0255, "ALC255", patch_alc269),
11370 HDA_CODEC_ENTRY(0x10ec0256, "ALC256", patch_alc269),
Kailang Yangf429e7e2017-12-05 15:38:24 +080011371 HDA_CODEC_ENTRY(0x10ec0257, "ALC257", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011372 HDA_CODEC_ENTRY(0x10ec0260, "ALC260", patch_alc260),
11373 HDA_CODEC_ENTRY(0x10ec0262, "ALC262", patch_alc262),
11374 HDA_CODEC_ENTRY(0x10ec0267, "ALC267", patch_alc268),
11375 HDA_CODEC_ENTRY(0x10ec0268, "ALC268", patch_alc268),
11376 HDA_CODEC_ENTRY(0x10ec0269, "ALC269", patch_alc269),
11377 HDA_CODEC_ENTRY(0x10ec0270, "ALC270", patch_alc269),
11378 HDA_CODEC_ENTRY(0x10ec0272, "ALC272", patch_alc662),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011379 HDA_CODEC_ENTRY(0x10ec0274, "ALC274", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011380 HDA_CODEC_ENTRY(0x10ec0275, "ALC275", patch_alc269),
11381 HDA_CODEC_ENTRY(0x10ec0276, "ALC276", patch_alc269),
11382 HDA_CODEC_ENTRY(0x10ec0280, "ALC280", patch_alc269),
11383 HDA_CODEC_ENTRY(0x10ec0282, "ALC282", patch_alc269),
11384 HDA_CODEC_ENTRY(0x10ec0283, "ALC283", patch_alc269),
11385 HDA_CODEC_ENTRY(0x10ec0284, "ALC284", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011386 HDA_CODEC_ENTRY(0x10ec0285, "ALC285", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011387 HDA_CODEC_ENTRY(0x10ec0286, "ALC286", patch_alc269),
Kailang Yang630e3612020-05-27 14:10:26 +080011388 HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011389 HDA_CODEC_ENTRY(0x10ec0288, "ALC288", patch_alc269),
Kailang Yang0a6f0602017-06-30 16:00:48 +080011390 HDA_CODEC_ENTRY(0x10ec0289, "ALC289", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011391 HDA_CODEC_ENTRY(0x10ec0290, "ALC290", patch_alc269),
11392 HDA_CODEC_ENTRY(0x10ec0292, "ALC292", patch_alc269),
11393 HDA_CODEC_ENTRY(0x10ec0293, "ALC293", patch_alc269),
Kailang Yangdcd4f0d2016-05-04 15:50:18 +080011394 HDA_CODEC_ENTRY(0x10ec0294, "ALC294", patch_alc269),
Kailang Yang7d727862016-05-24 16:46:07 +080011395 HDA_CODEC_ENTRY(0x10ec0295, "ALC295", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011396 HDA_CODEC_ENTRY(0x10ec0298, "ALC298", patch_alc269),
Kailang Yang28f1f9b2017-01-04 14:49:07 +080011397 HDA_CODEC_ENTRY(0x10ec0299, "ALC299", patch_alc269),
Kailang Yang1078bef2018-11-08 16:36:15 +080011398 HDA_CODEC_ENTRY(0x10ec0300, "ALC300", patch_alc269),
Kailang Yangf0778872019-10-24 15:13:32 +080011399 HDA_CODEC_ENTRY(0x10ec0623, "ALC623", patch_alc269),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011400 HDA_CODEC_REV_ENTRY(0x10ec0861, 0x100340, "ALC660", patch_alc861),
11401 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11402 HDA_CODEC_ENTRY(0x10ec0861, "ALC861", patch_alc861),
11403 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11404 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100002, "ALC662 rev2", patch_alc882),
11405 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100101, "ALC662 rev1", patch_alc662),
11406 HDA_CODEC_REV_ENTRY(0x10ec0662, 0x100300, "ALC662 rev3", patch_alc662),
11407 HDA_CODEC_ENTRY(0x10ec0663, "ALC663", patch_alc662),
11408 HDA_CODEC_ENTRY(0x10ec0665, "ALC665", patch_alc662),
11409 HDA_CODEC_ENTRY(0x10ec0667, "ALC667", patch_alc662),
11410 HDA_CODEC_ENTRY(0x10ec0668, "ALC668", patch_alc662),
11411 HDA_CODEC_ENTRY(0x10ec0670, "ALC670", patch_alc662),
11412 HDA_CODEC_ENTRY(0x10ec0671, "ALC671", patch_alc662),
11413 HDA_CODEC_ENTRY(0x10ec0680, "ALC680", patch_alc680),
Kailang Yang6fbae352016-05-30 16:44:20 +080011414 HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269),
11415 HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269),
11416 HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269),
Kailang Yang83629532019-05-02 16:03:26 +080011417 HDA_CODEC_ENTRY(0x10ec0711, "ALC711", patch_alc269),
Kailang Yang78f4f7c2016-06-07 11:31:34 +080011418 HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011419 HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880),
11420 HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882),
11421 HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882),
11422 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100101, "ALC889A", patch_alc882),
11423 HDA_CODEC_REV_ENTRY(0x10ec0885, 0x100103, "ALC889A", patch_alc882),
11424 HDA_CODEC_ENTRY(0x10ec0885, "ALC885", patch_alc882),
11425 HDA_CODEC_ENTRY(0x10ec0887, "ALC887", patch_alc882),
11426 HDA_CODEC_REV_ENTRY(0x10ec0888, 0x100101, "ALC1200", patch_alc882),
11427 HDA_CODEC_ENTRY(0x10ec0888, "ALC888", patch_alc882),
11428 HDA_CODEC_ENTRY(0x10ec0889, "ALC889", patch_alc882),
11429 HDA_CODEC_ENTRY(0x10ec0892, "ALC892", patch_alc662),
Kailang Yange5782a52020-11-27 14:39:23 +080011430 HDA_CODEC_ENTRY(0x10ec0897, "ALC897", patch_alc662),
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011431 HDA_CODEC_ENTRY(0x10ec0899, "ALC898", patch_alc882),
11432 HDA_CODEC_ENTRY(0x10ec0900, "ALC1150", patch_alc882),
Kailang Yang6d9ffcf2020-01-03 16:24:06 +080011433 HDA_CODEC_ENTRY(0x10ec0b00, "ALCS1200A", patch_alc882),
Kailang Yang65553b12017-07-11 15:15:47 +080011434 HDA_CODEC_ENTRY(0x10ec1168, "ALC1220", patch_alc882),
Kailang Yanga535ad52017-01-16 16:59:26 +080011435 HDA_CODEC_ENTRY(0x10ec1220, "ALC1220", patch_alc882),
Linus Torvalds1da177e2005-04-16 15:20:36 -070011436 {} /* terminator */
11437};
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011438MODULE_DEVICE_TABLE(hdaudio, snd_hda_id_realtek);
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011439
11440MODULE_LICENSE("GPL");
11441MODULE_DESCRIPTION("Realtek HD-audio codec");
11442
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011443static struct hda_codec_driver realtek_driver = {
Takashi Iwaib9a94a92015-10-01 16:20:04 +020011444 .id = snd_hda_id_realtek,
Takashi Iwai1289e9e2008-11-27 15:47:11 +010011445};
11446
Takashi Iwaid8a766a2015-02-17 15:25:37 +010011447module_hda_codec_driver(realtek_driver);