Lines Matching +full:codec +full:- +full:1
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal Interface for Intel High Definition Audio Codec
38 /* extra amp-initialization sequence types */
69 unsigned int enable_pcbeep:1;
70 unsigned int platform_type:1;
71 unsigned int swap:1;
72 unsigned int override:1;
73 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
86 /* codec parameterization */
114 void (*init_hook)(struct hda_codec *codec);
115 void (*power_hook)(struct hda_codec *codec);
116 void (*shutup)(struct hda_codec *codec);
120 unsigned int has_alc5505_dsp:1;
121 unsigned int no_depop_delay:1;
122 unsigned int done_hp_init:1;
123 unsigned int no_shutup_pins:1;
124 unsigned int ultra_low_power:1;
125 unsigned int has_hs_key:1;
126 unsigned int no_internal_mic_pin:1;
127 unsigned int en_3kpull_low:1;
135 u8 alc_mute_keycode_map[1];
145 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
147 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
149 snd_hda_power_up_pm(codec); in coef_mutex_lock()
150 mutex_lock(&spec->coef_mutex); in coef_mutex_lock()
153 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
155 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
157 mutex_unlock(&spec->coef_mutex); in coef_mutex_unlock()
158 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
161 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
166 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
167 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
171 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
176 coef_mutex_lock(codec); in alc_read_coefex_idx()
177 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
178 coef_mutex_unlock(codec); in alc_read_coefex_idx()
182 #define alc_read_coef_idx(codec, coef_idx) \ argument
183 alc_read_coefex_idx(codec, 0x20, coef_idx)
185 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
188 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
192 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
195 coef_mutex_lock(codec); in alc_write_coefex_idx()
196 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
197 coef_mutex_unlock(codec); in alc_write_coefex_idx()
200 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
201 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
203 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
207 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
209 if (val != -1) in __alc_update_coefex_idx()
210 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
214 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
218 coef_mutex_lock(codec); in alc_update_coefex_idx()
219 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
220 coef_mutex_unlock(codec); in alc_update_coefex_idx()
223 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
224 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
227 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
229 struct alc_spec *spec = codec->spec; in alc_get_coef0()
231 if (!spec->coef0) in alc_get_coef0()
232 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
233 return spec->coef0; in alc_get_coef0()
246 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
250 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
253 coef_mutex_lock(codec); in alc_process_coef_fw()
254 for (; fw->nid; fw++) { in alc_process_coef_fw()
255 if (fw->mask == (unsigned short)-1) in alc_process_coef_fw()
256 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
258 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
259 fw->mask, fw->val); in alc_process_coef_fw()
261 coef_mutex_unlock(codec); in alc_process_coef_fw()
269 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
271 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
273 spec->gpio_mask |= mask; in alc_setup_gpio()
274 spec->gpio_dir |= mask; in alc_setup_gpio()
275 spec->gpio_data |= mask; in alc_setup_gpio()
278 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
280 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
282 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
283 spec->gpio_data); in alc_write_gpio_data()
286 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
289 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
290 unsigned int oldval = spec->gpio_data; in alc_update_gpio_data()
293 spec->gpio_data |= mask; in alc_update_gpio_data()
295 spec->gpio_data &= ~mask; in alc_update_gpio_data()
296 if (oldval != spec->gpio_data) in alc_update_gpio_data()
297 alc_write_gpio_data(codec); in alc_update_gpio_data()
300 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
302 struct alc_spec *spec = codec->spec; in alc_write_gpio()
304 if (!spec->gpio_mask) in alc_write_gpio()
307 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
308 AC_VERB_SET_GPIO_MASK, spec->gpio_mask); in alc_write_gpio()
309 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
310 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir); in alc_write_gpio()
311 if (spec->gpio_write_delay) in alc_write_gpio()
312 msleep(1); in alc_write_gpio()
313 alc_write_gpio_data(codec); in alc_write_gpio()
316 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
320 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
323 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
326 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
329 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
332 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
335 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
338 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
341 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
344 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
347 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
351 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
357 * the default value is 1.
359 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
361 struct alc_spec *spec = codec->spec; in alc_fix_pll()
363 if (spec->pll_nid) in alc_fix_pll()
364 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
365 1 << spec->pll_coef_bit, 0); in alc_fix_pll()
368 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
371 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
372 spec->pll_nid = nid; in alc_fix_pll_init()
373 spec->pll_coef_idx = coef_idx; in alc_fix_pll_init()
374 spec->pll_coef_bit = coef_bit; in alc_fix_pll_init()
375 alc_fix_pll(codec); in alc_fix_pll_init()
378 /* update the master volume per volume-knob's unsol event */
379 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
386 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
392 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
395 uctl->value.integer.value[0] = val; in alc_update_knob_master()
396 uctl->value.integer.value[1] = val; in alc_update_knob_master()
397 kctl->put(kctl, uctl); in alc_update_knob_master()
401 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
405 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
409 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
413 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
415 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
417 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
421 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
425 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
427 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
429 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
435 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
440 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
445 alc_update_coef_idx(codec, 0x36, 1<<13, 0); in alc_fill_eapd_coef()
462 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
465 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
468 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
469 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
472 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
476 alc_write_coef_idx(codec, 0x6e, 0x0c25); in alc_fill_eapd_coef()
483 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
487 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
496 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
500 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
503 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
506 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
510 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
514 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
521 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
527 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
529 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
530 /* alc888-VA */ in alc888_coef_init()
532 /* alc888-VB */ in alc888_coef_init()
534 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
540 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
542 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
544 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
545 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
549 /* turn on/off EAPD controls of the codec */
550 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
558 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
561 static int find_ext_mic_pin(struct hda_codec *codec);
563 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
566 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
572 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
575 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
577 if (pin->nid != mic_pin) in alc_headset_mic_no_shutup()
578 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
582 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
585 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
587 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
589 if (spec->no_shutup_pins) in alc_shutup_pins()
592 switch (codec->core.vendor_id) { in alc_shutup_pins()
604 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
607 snd_hda_shutup_pins(codec); in alc_shutup_pins()
613 * just turning off EAPD and a little pause for avoiding pop-noise
615 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
617 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
619 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
620 if (!spec->no_depop_delay) in alc_eapd_shutup()
622 alc_shutup_pins(codec); in alc_eapd_shutup()
626 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
628 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
629 alc_write_gpio(codec); in alc_auto_init_amp()
632 switch (codec->core.vendor_id) { in alc_auto_init_amp()
634 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
640 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
643 alc888_coef_init(codec); in alc_auto_init_amp()
653 if (spec->gen.autocfg.hp_pins[0]) in alc_get_hp_pin()
654 return spec->gen.autocfg.hp_pins[0]; in alc_get_hp_pin()
655 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) in alc_get_hp_pin()
656 return spec->gen.autocfg.line_out_pins[0]; in alc_get_hp_pin()
664 /* Could be any non-zero and even value. When used as fixup, tells
669 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
672 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
674 spec->cdefine.fixup = 1; in alc_fixup_sku_ignore()
675 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; in alc_fixup_sku_ignore()
679 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
682 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
685 spec->no_depop_delay = 1; in alc_fixup_no_depop_delay()
686 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
690 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
694 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
696 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ in alc_auto_parse_customize_define()
698 if (spec->cdefine.fixup) { in alc_auto_parse_customize_define()
699 ass = spec->cdefine.sku_cfg; in alc_auto_parse_customize_define()
701 return -1; in alc_auto_parse_customize_define()
705 if (!codec->bus->pci) in alc_auto_parse_customize_define()
706 return -1; in alc_auto_parse_customize_define()
707 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
708 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
712 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
714 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
716 if (!(ass & 1)) { in alc_auto_parse_customize_define()
717 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
718 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
719 return -1; in alc_auto_parse_customize_define()
724 for (i = 1; i < 16; i++) { in alc_auto_parse_customize_define()
725 if ((ass >> i) & 1) in alc_auto_parse_customize_define()
729 return -1; in alc_auto_parse_customize_define()
731 spec->cdefine.port_connectivity = ass >> 30; in alc_auto_parse_customize_define()
732 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; in alc_auto_parse_customize_define()
733 spec->cdefine.check_sum = (ass >> 16) & 0xf; in alc_auto_parse_customize_define()
734 spec->cdefine.customization = ass >> 8; in alc_auto_parse_customize_define()
736 spec->cdefine.sku_cfg = ass; in alc_auto_parse_customize_define()
737 spec->cdefine.external_amp = (ass & 0x38) >> 3; in alc_auto_parse_customize_define()
738 spec->cdefine.platform_type = (ass & 0x4) >> 2; in alc_auto_parse_customize_define()
739 spec->cdefine.swap = (ass & 0x2) >> 1; in alc_auto_parse_customize_define()
740 spec->cdefine.override = ass & 0x1; in alc_auto_parse_customize_define()
742 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
743 nid, spec->cdefine.sku_cfg); in alc_auto_parse_customize_define()
744 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
745 spec->cdefine.port_connectivity); in alc_auto_parse_customize_define()
746 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
747 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
748 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
749 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
750 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
751 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
752 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
757 /* return the position of NID in the list, or -1 if not found */
764 return -1; in find_idx_in_nid_list()
772 /* check subsystem ID and set up device-specific initialization;
773 * return 1 if initialized, 0 if invalid SSID
775 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
779 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
781 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
785 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
787 if (spec->cdefine.fixup) { in alc_subsystem_id()
788 ass = spec->cdefine.sku_cfg; in alc_subsystem_id()
794 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
795 if (codec->bus->pci && in alc_subsystem_id()
796 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
804 * 19~16 : Check sum (15:1) in alc_subsystem_id()
805 * 15~1 : Custom in alc_subsystem_id()
809 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
811 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
812 codec_dbg(codec, in alc_subsystem_id()
815 if (!(ass & 1)) in alc_subsystem_id()
817 if ((ass >> 30) != 1) /* no physical connection */ in alc_subsystem_id()
822 for (i = 1; i < 16; i++) { in alc_subsystem_id()
823 if ((ass >> i) & 1) in alc_subsystem_id()
829 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
830 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
833 * 1 : Swap Jack in alc_subsystem_id()
834 * 2 : 0 --> Desktop, 1 --> Laptop in alc_subsystem_id()
839 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_subsystem_id()
841 case 1: in alc_subsystem_id()
842 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
845 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
848 alc_setup_gpio(codec, 0x04); in alc_subsystem_id()
852 spec->init_amp = ALC_INIT_DEFAULT; in alc_subsystem_id()
861 return 1; in alc_subsystem_id()
864 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered in alc_subsystem_id()
866 * 15 : 1 --> enable the function "Mute internal speaker in alc_subsystem_id()
873 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, in alc_subsystem_id()
874 spec->gen.autocfg.line_outs)) in alc_subsystem_id()
875 return 1; in alc_subsystem_id()
876 spec->gen.autocfg.hp_pins[0] = nid; in alc_subsystem_id()
878 return 1; in alc_subsystem_id()
881 /* Check the validity of ALC subsystem-id
882 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
883 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
885 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
886 struct alc_spec *spec = codec->spec; in alc_ssid_check()
887 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_ssid_check()
888 codec_dbg(codec, in alc_ssid_check()
890 spec->init_amp = ALC_INIT_DEFAULT; in alc_ssid_check()
895 /* inverted digital-mic */
896 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
899 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
901 spec->gen.inv_dmic_split = 1; in alc_fixup_inv_dmic()
905 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
909 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
913 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
922 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
924 alc_fill_eapd_coef(codec); in alc_pre_init()
927 #define is_s3_resume(codec) \ argument
928 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
929 #define is_s4_resume(codec) \ argument
930 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
931 #define is_s4_suspend(codec) \ argument
932 ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
934 static int alc_init(struct hda_codec *codec) in alc_init() argument
936 struct alc_spec *spec = codec->spec; in alc_init()
939 if (is_s4_resume(codec)) in alc_init()
940 alc_pre_init(codec); in alc_init()
942 if (spec->init_hook) in alc_init()
943 spec->init_hook(codec); in alc_init()
945 spec->gen.skip_verbs = 1; /* applied in below */ in alc_init()
946 snd_hda_gen_init(codec); in alc_init()
947 alc_fix_pll(codec); in alc_init()
948 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
949 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
959 static void alc_free(struct hda_codec *codec) in alc_free() argument
961 struct alc_spec *spec = codec->spec; in alc_free()
964 hda_component_manager_free(&spec->comps, &comp_master_ops); in alc_free()
966 snd_hda_gen_free(codec); in alc_free()
969 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
971 struct alc_spec *spec = codec->spec; in alc_shutup()
973 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
976 if (spec && spec->shutup) in alc_shutup()
977 spec->shutup(codec); in alc_shutup()
979 alc_shutup_pins(codec); in alc_shutup()
982 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
984 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
987 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
989 struct alc_spec *spec = codec->spec; in alc_suspend()
990 alc_shutup(codec); in alc_suspend()
991 if (spec && spec->power_hook) in alc_suspend()
992 spec->power_hook(codec); in alc_suspend()
996 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
998 struct alc_spec *spec = codec->spec; in alc_resume()
1000 if (!spec->no_depop_delay) in alc_resume()
1002 codec->patch_ops.init(codec); in alc_resume()
1003 snd_hda_regmap_sync(codec); in alc_resume()
1004 hda_call_check_power_status(codec, 0x01); in alc_resume()
1022 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1052 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1053 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1093 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1098 for (p = rename_tbl; p->vendor_id; p++) { in alc_codec_rename_from_preset()
1099 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1101 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1102 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1105 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1107 for (q = rename_pci_tbl; q->codec_vendor_id; q++) { in alc_codec_rename_from_preset()
1108 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1110 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1112 if (!q->pci_subdevice || in alc_codec_rename_from_preset()
1113 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1114 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1122 * Digital-beep handlers
1141 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, in set_beep_amp()
1144 return -ENOMEM; in set_beep_amp()
1145 knew->private_value = beep_amp; in set_beep_amp()
1151 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1152 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1153 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1154 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1155 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1156 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1157 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1158 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1159 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1160 /* denylist -- no beep available */
1166 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1168 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1170 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1172 return q->value; in has_cdefine_beep()
1173 return spec->cdefine.enable_pcbeep; in has_cdefine_beep()
1177 #define has_cdefine_beep(codec) 0 argument
1181 /* return 1 if successful, 0 if the proper config is not found,
1184 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1188 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1189 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_parse_auto_config()
1192 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1193 spec->parse_flags); in alc_parse_auto_config()
1198 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1200 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1204 return 1; in alc_parse_auto_config()
1208 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1214 return -ENOMEM; in alc_alloc_spec()
1215 codec->spec = spec; in alc_alloc_spec()
1216 snd_hda_gen_spec_init(&spec->gen); in alc_alloc_spec()
1217 spec->gen.mixer_nid = mixer_nid; in alc_alloc_spec()
1218 spec->gen.own_eapd_ctl = 1; in alc_alloc_spec()
1219 codec->single_adc_amp = 1; in alc_alloc_spec()
1220 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1221 codec->spdif_status_reset = 1; in alc_alloc_spec()
1222 codec->forced_resume = 1; in alc_alloc_spec()
1223 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1224 mutex_init(&spec->coef_mutex); in alc_alloc_spec()
1226 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1234 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1238 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1242 * ALC880 fix-ups
1272 /* enable the volume-knob widget support on NID 0x21 */
1273 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1277 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1313 { 0x1a, 0x0181344f }, /* line-in */
1361 { 0x19, 0x01a19950 }, /* mic-in */
1381 { 0x19, 0x01a19950 }, /* mic-in */
1421 { 0x18, 0x01a19950 }, /* mic-in */
1423 { 0x1a, 0x01813031 }, /* line-in */
1454 { 0x14, 0x01014010 }, /* line-out */
1458 { 0x18, 0x01a19c30 }, /* mic-in */
1460 { 0x1a, 0x01813031 }, /* line-in */
1461 { 0x1b, 0x02a19c40 }, /* front-mic */
1494 { 0x18, 0x01a19c30 }, /* mic-in */
1496 { 0x1a, 0x01813031 }, /* line-in */
1497 { 0x1b, 0x02a19c40 }, /* front-mic */
1530 { 0x18, 0x01a19c30 }, /* mic-in */
1531 { 0x19, 0x02a19c40 }, /* front-mic */
1532 { 0x1a, 0x01813031 }, /* line-in */
1596 * It's not quite sure whether BIOS sets the correct pin-config table
1621 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1636 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1643 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1645 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1647 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1648 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1656 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1661 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1665 spec = codec->spec; in patch_alc880()
1666 spec->gen.need_dac_fix = 1; in patch_alc880()
1667 spec->gen.beep_nid = 0x01; in patch_alc880()
1669 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1671 alc_pre_init(codec); in patch_alc880()
1673 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1675 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1678 err = alc880_parse_auto_config(codec); in patch_alc880()
1682 if (!spec->gen.no_analog) { in patch_alc880()
1688 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1693 alc_free(codec); in patch_alc880()
1701 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1705 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1725 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1727 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1729 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1732 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1735 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1740 spec->gen.automute_hook = alc260_gpio1_automute; in alc260_fixup_gpio1_toggle()
1741 spec->gen.detect_hp = 1; in alc260_fixup_gpio1_toggle()
1742 spec->gen.automute_speaker = 1; in alc260_fixup_gpio1_toggle()
1743 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ in alc260_fixup_gpio1_toggle()
1744 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1746 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1750 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1753 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1772 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1773 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_kn1()
1778 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1781 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1783 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_fsc_s7020()
1786 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1789 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1791 spec->gen.add_jack_modes = 1; in alc260_fixup_fsc_s7020_jwse()
1792 spec->gen.hp_mic = 1; in alc260_fixup_fsc_s7020_jwse()
1899 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1905 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1910 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1914 spec = codec->spec; in patch_alc260()
1919 spec->gen.prefer_hp_amp = 1; in patch_alc260()
1920 spec->gen.beep_nid = 0x01; in patch_alc260()
1922 spec->shutup = alc_eapd_shutup; in patch_alc260()
1924 alc_pre_init(codec); in patch_alc260()
1926 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1931 err = alc260_parse_auto_config(codec); in patch_alc260()
1935 if (!spec->gen.no_analog) { in patch_alc260()
1941 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1946 alc_free(codec); in patch_alc260()
1957 * 6-channel independent captures.
1959 * In addition, an independent DAC for the multi-playback (not used in this
2011 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
2016 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2020 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2023 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2025 spec->gpio_write_delay = true; in alc885_fixup_macpro_gpio()
2026 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2033 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2040 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2041 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2042 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2043 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2047 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2048 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2049 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2050 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2055 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2059 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2065 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2068 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2070 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2071 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mbp_vref()
2076 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2079 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2084 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2086 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2088 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mac_pins()
2092 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2098 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2102 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2108 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2112 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2118 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2123 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2125 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2128 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2130 spec->gen.no_primary_hp = 1; in alc882_fixup_no_primary_hp()
2131 spec->gen.no_multi_io = 1; in alc882_fixup_no_primary_hp()
2135 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2138 /* For dual-codec configuration, we need to disable some features to avoid
2141 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2144 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2149 spec->gen.suppress_vmaster = 1; in alc_fixup_dual_codecs()
2150 /* auto-mute and auto-mic switch don't work with multiple codecs */ in alc_fixup_dual_codecs()
2151 spec->gen.suppress_auto_mute = 1; in alc_fixup_dual_codecs()
2152 spec->gen.suppress_auto_mic = 1; in alc_fixup_dual_codecs()
2154 spec->gen.mixer_nid = 0; in alc_fixup_dual_codecs()
2156 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2159 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2164 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2166 snd_ctl_rename(codec->card, kctl, newname); in rename_ctl()
2169 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2173 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2177 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2180 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2181 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2182 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2183 "Rear-Panel Capture Volume" : in alc1220_fixup_gb_dual_codecs()
2184 "Front-Panel Capture Volume"); in alc1220_fixup_gb_dual_codecs()
2185 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2186 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2187 "Rear-Panel Capture Switch" : in alc1220_fixup_gb_dual_codecs()
2188 "Front-Panel Capture Switch"); in alc1220_fixup_gb_dual_codecs()
2193 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2208 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2209 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2212 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2217 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2226 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2230 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2231 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2234 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2237 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2241 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2242 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2245 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2248 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2251 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2253 if (spec->gen.hp_jack_present) in alc887_asus_hp_automute_hook()
2257 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2260 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2263 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2266 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2267 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook; in alc887_fixup_asus_jack()
2420 /* DAC DISABLE/MUTE 1? */
2421 /* setting bits 1-5 disables DAC nids 0x02-0x06
2432 * The mics are only 1cm apart which makes the stereo
2437 * codec replicate the sum signal to both channels,
2589 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2606 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2607 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2613 /* All Apple entries are in codec SSIDs */
2614 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2616 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2622 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2623 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2624 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2625 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2626 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2628 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2629 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2630 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2631 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2632 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2634 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2639 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2640 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2641 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2645 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2646 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2650 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2653 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2655 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2661 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2665 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2668 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2673 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2683 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2685 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2695 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2696 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2697 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2698 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2700 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2701 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2703 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2704 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2708 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2709 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2710 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2711 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2712 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2713 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2714 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2715 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2716 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2717 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2718 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2719 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2720 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2721 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2722 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2723 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2724 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2725 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2726 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2740 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2756 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2760 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2765 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2770 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2774 spec = codec->spec; in patch_alc882()
2776 switch (codec->core.vendor_id) { in patch_alc882()
2785 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2789 alc_pre_init(codec); in patch_alc882()
2791 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2793 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2794 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2796 alc_auto_parse_customize_define(codec); in patch_alc882()
2798 if (has_cdefine_beep(codec)) in patch_alc882()
2799 spec->gen.beep_nid = 0x01; in patch_alc882()
2802 err = alc882_parse_auto_config(codec); in patch_alc882()
2806 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc882()
2812 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2817 alc_free(codec); in patch_alc882()
2825 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2829 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2924 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2930 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2931 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2932 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2933 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2935 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2937 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2944 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2949 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2953 spec = codec->spec; in patch_alc262()
2954 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc262()
2956 spec->shutup = alc_eapd_shutup; in patch_alc262()
2960 * under-run in patch_alc262()
2962 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2964 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2966 alc_pre_init(codec); in patch_alc262()
2968 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2970 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2972 alc_auto_parse_customize_define(codec); in patch_alc262()
2974 if (has_cdefine_beep(codec)) in patch_alc262()
2975 spec->gen.beep_nid = 0x01; in patch_alc262()
2978 err = alc262_parse_auto_config(codec); in patch_alc262()
2982 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc262()
2988 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2993 alc_free(codec); in patch_alc262()
3004 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
3008 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
3009 pval = kcontrol->private_value; in alc268_beep_switch_put()
3010 kcontrol->private_value = (pval & ~0xff) | 0x0f; in alc268_beep_switch_put()
3013 kcontrol->private_value = (pval & ~0xff) | 0x10; in alc268_beep_switch_put()
3016 kcontrol->private_value = pval; in alc268_beep_switch_put()
3017 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3030 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3037 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3038 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3070 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3071 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3079 /* below is codec SSID since multiple Toshiba laptops have the
3089 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3092 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3097 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3102 /* ALC268 has no aa-loopback mixer */ in patch_alc268()
3103 err = alc_alloc_spec(codec, 0); in patch_alc268()
3107 spec = codec->spec; in patch_alc268()
3108 if (has_cdefine_beep(codec)) in patch_alc268()
3109 spec->gen.beep_nid = 0x01; in patch_alc268()
3111 spec->shutup = alc_eapd_shutup; in patch_alc268()
3113 alc_pre_init(codec); in patch_alc268()
3115 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3116 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3119 err = alc268_parse_auto_config(codec); in patch_alc268()
3123 if (err > 0 && !spec->gen.no_analog && in patch_alc268()
3124 spec->gen.autocfg.speaker_pins[0] != 0x1d) { in patch_alc268()
3126 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, in patch_alc268()
3128 err = -ENOMEM; in patch_alc268()
3132 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3133 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3135 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3142 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3147 alc_free(codec); in patch_alc268()
3163 /* different alc269-variants */
3192 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3197 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3200 switch (spec->codec_variant) { in alc269_parse_auto_config()
3232 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3243 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3248 if (jack->unsol_res & (7 << 13)) in alc_headset_btn_callback()
3251 if (jack->unsol_res & (1 << 16 | 3 << 8)) in alc_headset_btn_callback()
3255 if (jack->unsol_res & (7 << 23)) in alc_headset_btn_callback()
3259 if (jack->unsol_res & (7 << 10)) in alc_headset_btn_callback()
3262 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3265 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3267 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3269 if (!spec->has_hs_key) in alc_disable_headset_jack_key()
3272 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3280 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3281 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3282 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3289 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3290 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3295 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3297 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3299 if (!spec->has_hs_key) in alc_enable_headset_jack_key()
3302 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3310 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3311 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3312 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3319 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3320 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3325 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3328 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3333 spec->has_hs_key = 1; in alc_fixup_headset_jack()
3334 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3339 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3342 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3346 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3351 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3353 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3356 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3358 struct alc_spec *spec = codec->spec; in alc269_shutup()
3360 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_shutup()
3361 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3362 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_shutup()
3363 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3366 alc_shutup_pins(codec); in alc269_shutup()
3402 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3404 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3407 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3409 struct alc_spec *spec = codec->spec; in alc282_init()
3414 alc282_restore_default_value(codec); in alc282_init()
3418 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3419 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3421 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */ in alc282_init()
3423 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3428 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3434 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3441 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3444 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3446 struct alc_spec *spec = codec->spec; in alc282_shutup()
3452 alc269_shutup(codec); in alc282_shutup()
3456 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3457 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3458 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3463 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3469 if (!spec->no_shutup_pins) in alc282_shutup()
3470 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3476 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3477 alc_shutup_pins(codec); in alc282_shutup()
3478 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3518 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3520 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3523 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3525 struct alc_spec *spec = codec->spec; in alc283_init()
3529 alc283_restore_default_value(codec); in alc283_init()
3535 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3537 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */ in alc283_init()
3539 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3541 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3547 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3554 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3556 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3559 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3561 struct alc_spec *spec = codec->spec; in alc283_shutup()
3566 alc269_shutup(codec); in alc283_shutup()
3570 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3572 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3575 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3577 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3583 if (!spec->no_shutup_pins) in alc283_shutup()
3584 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3587 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3591 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3592 alc_shutup_pins(codec); in alc283_shutup()
3593 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3596 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3598 struct alc_spec *spec = codec->spec; in alc256_init()
3602 if (spec->ultra_low_power) { in alc256_init()
3603 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3604 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3605 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3606 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3607 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3616 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3620 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3622 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3627 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3631 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3633 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3634 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3635 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3638 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See in alc256_init()
3639 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of in alc256_init()
3642 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3645 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3647 struct alc_spec *spec = codec->spec; in alc256_shutup()
3654 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_shutup()
3655 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3660 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3666 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3668 * when booting with headset plugged. So skip setting it for the codec alc257 in alc256_shutup()
3670 if (spec->en_3kpull_low) in alc256_shutup()
3671 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3673 if (!spec->no_shutup_pins) in alc256_shutup()
3674 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3680 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3681 alc_shutup_pins(codec); in alc256_shutup()
3682 if (spec->ultra_low_power) { in alc256_shutup()
3684 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3685 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3686 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3687 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3688 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3693 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3695 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3700 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */ in alc285_hp_init()
3701 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3702 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3703 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3704 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3705 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3706 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3708 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3711 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3715 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3716 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3719 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3722 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3723 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3724 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3725 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3727 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3728 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3731 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3734 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3735 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3736 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3737 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3740 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3743 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3745 struct alc_spec *spec = codec->spec; in alc225_init()
3749 if (spec->ultra_low_power) { in alc225_init()
3750 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3751 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3752 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3756 if (spec->codec_variant != ALC269_TYPE_ALC287 && in alc225_init()
3757 spec->codec_variant != ALC269_TYPE_ALC245) in alc225_init()
3759 if (!spec->done_hp_init || in alc225_init()
3760 is_s3_resume(codec) || in alc225_init()
3761 is_s4_resume(codec)) { in alc225_init()
3762 alc285_hp_init(codec); in alc225_init()
3763 spec->done_hp_init = true; in alc225_init()
3770 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3771 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3775 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3778 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3781 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3786 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3789 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3793 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3794 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3798 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3800 struct alc_spec *spec = codec->spec; in alc225_shutup()
3807 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3808 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3811 alc_disable_headset_jack_key(codec); in alc225_shutup()
3813 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3817 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3820 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3826 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3829 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3833 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3834 alc_enable_headset_jack_key(codec); in alc225_shutup()
3836 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3837 alc_shutup_pins(codec); in alc225_shutup()
3838 if (spec->ultra_low_power) { in alc225_shutup()
3840 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3841 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3842 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3843 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3848 static void alc222_init(struct hda_codec *codec) in alc222_init() argument
3850 struct alc_spec *spec = codec->spec; in alc222_init()
3859 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_init()
3860 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_init()
3866 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3869 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3874 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3877 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3884 static void alc222_shutup(struct hda_codec *codec) in alc222_shutup() argument
3886 struct alc_spec *spec = codec->spec; in alc222_shutup()
3893 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_shutup()
3894 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_shutup()
3900 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3903 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3909 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3912 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3917 alc_auto_setup_eapd(codec, false); in alc222_shutup()
3918 alc_shutup_pins(codec); in alc222_shutup()
3921 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3923 struct alc_spec *spec = codec->spec; in alc_default_init()
3932 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3937 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3942 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3948 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3950 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3955 alc269_shutup(codec); in alc_default_shutup()
3959 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3964 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3969 if (!spec->no_shutup_pins) in alc_default_shutup()
3970 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3975 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3976 alc_shutup_pins(codec); in alc_default_shutup()
3979 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3981 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3988 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3993 if (!spec->no_shutup_pins) in alc294_hp_init()
3994 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3997 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3998 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
4001 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4004 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4007 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
4011 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
4013 struct alc_spec *spec = codec->spec; in alc294_init()
4016 if (!spec->done_hp_init || in alc294_init()
4017 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
4018 alc294_hp_init(codec); in alc294_init()
4019 spec->done_hp_init = true; in alc294_init()
4021 alc_default_init(codec); in alc294_init()
4024 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
4027 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
4028 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
4029 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
4032 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
4036 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
4037 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4039 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4044 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
4048 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
4049 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
4050 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
4051 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
4052 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
4053 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
4054 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
4055 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
4056 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
4059 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
4061 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
4062 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
4063 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
4064 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
4065 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
4066 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
4069 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
4073 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4074 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
4075 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
4076 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
4077 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
4078 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
4079 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
4080 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
4081 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
4082 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
4083 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
4084 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
4085 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
4086 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
4087 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
4089 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
4091 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
4093 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
4095 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
4096 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
4097 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
4098 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
4099 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
4100 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
4101 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
4104 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4109 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
4110 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
4112 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
4113 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
4116 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
4118 struct alc_spec *spec = codec->spec; in alc269_suspend()
4120 if (spec->has_alc5505_dsp) in alc269_suspend()
4121 alc5505_dsp_suspend(codec); in alc269_suspend()
4123 return alc_suspend(codec); in alc269_suspend()
4126 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
4128 struct alc_spec *spec = codec->spec; in alc269_resume()
4130 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
4131 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
4132 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
4133 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
4137 codec->patch_ops.init(codec); in alc269_resume()
4139 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
4140 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
4141 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
4142 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
4146 snd_hda_regmap_sync(codec); in alc269_resume()
4147 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4149 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
4153 if (spec->gpio_data) in alc269_resume()
4154 alc_write_gpio_data(codec); in alc269_resume()
4156 if (spec->has_alc5505_dsp) in alc269_resume()
4157 alc5505_dsp_resume(codec); in alc269_resume()
4162 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4165 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4168 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc269_fixup_pincfg_no_hp_to_lineout()
4171 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4175 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4176 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4179 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4184 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4188 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4191 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4194 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4197 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_headset_mic()
4200 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4210 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4211 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4213 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4215 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4219 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4224 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4227 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4230 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4238 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; in alc269_fixup_pcm_44k()
4239 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; in alc269_fixup_pcm_44k()
4242 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4245 /* The digital-mic unit sends PDM (differential signal) instead of in alc269_fixup_stereo_dmic()
4251 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4254 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4256 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4258 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4259 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4262 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4265 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4268 spec->gen.automute_hook = alc269_quanta_automute; in alc269_fixup_quanta_mute()
4271 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4274 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4277 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4279 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc269_x101_hp_automute_hook()
4281 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4284 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4296 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4300 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4301 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4304 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4306 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4307 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4308 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4310 if (initval->value_0x23 != 0x1e) in alc298_huawei_mbx_stereo_seq()
4311 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4313 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4314 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4317 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4341 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4342 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4343 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4344 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4345 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4346 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4347 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4348 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4350 for (seq = dac_init; seq->value_0x23; seq++) in alc298_fixup_huawei_mbx_stereo()
4351 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4354 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4357 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4359 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_x101_headset_mic()
4360 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook; in alc269_fixup_x101_headset_mic()
4364 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4373 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4377 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4378 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4379 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4382 /* update mute-LED according to the speaker mute state via mic VREF pin */
4386 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4387 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4389 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4390 spec->mute_led_polarity, brightness); in vref_mute_led_set()
4395 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4399 struct alc_spec *spec = codec->spec; in led_power_filter()
4402 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid)) in led_power_filter()
4406 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4407 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4409 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4412 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4415 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4423 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) in alc269_fixup_hp_mute_led()
4427 spec->mute_led_polarity = pol; in alc269_fixup_hp_mute_led()
4428 spec->mute_led_nid = pin - 0x0a + 0x18; in alc269_fixup_hp_mute_led()
4429 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4430 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4431 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4432 "Detected mute LED for %x:%d\n", spec->mute_led_nid, in alc269_fixup_hp_mute_led()
4433 spec->mute_led_polarity); in alc269_fixup_hp_mute_led()
4438 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4442 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4445 spec->mute_led_polarity = 0; in alc269_fixup_hp_mute_led_micx()
4446 spec->mute_led_nid = pin; in alc269_fixup_hp_mute_led_micx()
4447 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4448 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4452 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4455 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4458 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4461 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4464 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4467 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4471 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4476 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4483 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4484 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4486 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4487 spec->mute_led_polarity, !brightness); in gpio_mute_led_set()
4491 /* turn on/off mic-mute LED via GPIO per capture hook */
4495 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4496 struct alc_spec *spec = codec->spec; in micmute_led_set()
4498 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4499 spec->micmute_led_polarity, !brightness); in micmute_led_set()
4503 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4504 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4509 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4511 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4516 spec->gpio_mute_led_mask = mute_mask; in alc_fixup_hp_gpio_led()
4517 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4520 spec->gpio_mic_led_mask = micmute_mask; in alc_fixup_hp_gpio_led()
4521 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4525 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4528 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4531 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4534 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4537 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4540 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4543 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4546 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4549 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4552 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4555 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4558 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4561 spec->micmute_led_polarity = 1; in alc245_fixup_hp_gpio_led()
4562 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4565 /* turn on/off mic-mute LED per capture hook via VREF change */
4569 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4570 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4572 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4573 spec->micmute_led_polarity, brightness); in vref_micmute_led_set()
4577 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4580 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4582 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4587 spec->gpio_mask |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4588 spec->gpio_dir |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4589 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_gpio_mic1_led()
4590 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4591 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4595 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4598 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4600 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4602 spec->cap_mute_led_nid = 0x18; in alc280_fixup_hp_gpio4()
4603 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4604 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4611 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4614 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4618 spec->gpio_mask |= 0x01; in alc245_fixup_hp_x360_amp()
4619 spec->gpio_dir |= 0x01; in alc245_fixup_hp_x360_amp()
4623 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4625 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4632 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4638 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4641 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4646 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4650 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4653 spec->gpio_mask |= 0x04; in alc274_fixup_hp_envy_gpio()
4654 spec->gpio_dir |= 0x04; in alc274_fixup_hp_envy_gpio()
4655 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook; in alc274_fixup_hp_envy_gpio()
4659 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4666 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4667 on ? led->on : led->off); in alc_update_coef_led()
4670 /* update mute-LED according to the speaker mute state via COEF bit */
4674 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4675 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4677 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4678 spec->mute_led_polarity, brightness); in coef_mute_led_set()
4682 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4686 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4689 spec->mute_led_polarity = 0; in alc285_fixup_hp_mute_led_coefbit()
4690 spec->mute_led_coef.idx = 0x0b; in alc285_fixup_hp_mute_led_coefbit()
4691 spec->mute_led_coef.mask = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4692 spec->mute_led_coef.on = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4693 spec->mute_led_coef.off = 0; in alc285_fixup_hp_mute_led_coefbit()
4694 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4698 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4702 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4705 spec->mute_led_polarity = 0; in alc236_fixup_hp_mute_led_coefbit()
4706 spec->mute_led_coef.idx = 0x34; in alc236_fixup_hp_mute_led_coefbit()
4707 spec->mute_led_coef.mask = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4708 spec->mute_led_coef.on = 0; in alc236_fixup_hp_mute_led_coefbit()
4709 spec->mute_led_coef.off = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4710 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4714 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit2() argument
4717 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit2()
4720 spec->mute_led_polarity = 0; in alc236_fixup_hp_mute_led_coefbit2()
4721 spec->mute_led_coef.idx = 0x07; in alc236_fixup_hp_mute_led_coefbit2()
4722 spec->mute_led_coef.mask = 1; in alc236_fixup_hp_mute_led_coefbit2()
4723 spec->mute_led_coef.on = 1; in alc236_fixup_hp_mute_led_coefbit2()
4724 spec->mute_led_coef.off = 0; in alc236_fixup_hp_mute_led_coefbit2()
4725 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit2()
4729 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_coefbit() argument
4733 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_coefbit()
4736 spec->mute_led_polarity = 0; in alc245_fixup_hp_mute_led_coefbit()
4737 spec->mute_led_coef.idx = 0x0b; in alc245_fixup_hp_mute_led_coefbit()
4738 spec->mute_led_coef.mask = 3 << 2; in alc245_fixup_hp_mute_led_coefbit()
4739 spec->mute_led_coef.on = 2 << 2; in alc245_fixup_hp_mute_led_coefbit()
4740 spec->mute_led_coef.off = 1 << 2; in alc245_fixup_hp_mute_led_coefbit()
4741 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_coefbit()
4745 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_v1_coefbit() argument
4749 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_v1_coefbit()
4752 spec->mute_led_polarity = 0; in alc245_fixup_hp_mute_led_v1_coefbit()
4753 spec->mute_led_coef.idx = 0x0b; in alc245_fixup_hp_mute_led_v1_coefbit()
4754 spec->mute_led_coef.mask = 1 << 3; in alc245_fixup_hp_mute_led_v1_coefbit()
4755 spec->mute_led_coef.on = 1 << 3; in alc245_fixup_hp_mute_led_v1_coefbit()
4756 spec->mute_led_coef.off = 0; in alc245_fixup_hp_mute_led_v1_coefbit()
4757 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_v1_coefbit()
4761 /* turn on/off mic-mute LED per capture hook by coef bit */
4765 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4766 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4768 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4769 spec->micmute_led_polarity, brightness); in coef_micmute_led_set()
4773 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4776 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4779 spec->mic_led_coef.idx = 0x19; in alc285_fixup_hp_coef_micmute_led()
4780 spec->mic_led_coef.mask = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4781 spec->mic_led_coef.on = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4782 spec->mic_led_coef.off = 0; in alc285_fixup_hp_coef_micmute_led()
4783 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4787 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_micmute_led() argument
4790 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_gpio_micmute_led()
4793 spec->micmute_led_polarity = 1; in alc285_fixup_hp_gpio_micmute_led()
4794 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc285_fixup_hp_gpio_micmute_led()
4797 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4800 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4803 spec->mic_led_coef.idx = 0x35; in alc236_fixup_hp_coef_micmute_led()
4804 spec->mic_led_coef.mask = 3 << 2; in alc236_fixup_hp_coef_micmute_led()
4805 spec->mic_led_coef.on = 2 << 2; in alc236_fixup_hp_coef_micmute_led()
4806 spec->mic_led_coef.off = 1 << 2; in alc236_fixup_hp_coef_micmute_led()
4807 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4811 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec, in alc295_fixup_hp_mute_led_coefbit11() argument
4814 struct alc_spec *spec = codec->spec; in alc295_fixup_hp_mute_led_coefbit11()
4817 spec->mute_led_polarity = 0; in alc295_fixup_hp_mute_led_coefbit11()
4818 spec->mute_led_coef.idx = 0xb; in alc295_fixup_hp_mute_led_coefbit11()
4819 spec->mute_led_coef.mask = 3 << 3; in alc295_fixup_hp_mute_led_coefbit11()
4820 spec->mute_led_coef.on = 1 << 3; in alc295_fixup_hp_mute_led_coefbit11()
4821 spec->mute_led_coef.off = 1 << 4; in alc295_fixup_hp_mute_led_coefbit11()
4822 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc295_fixup_hp_mute_led_coefbit11()
4826 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4829 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4830 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4833 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_mute_led() argument
4836 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4837 alc285_fixup_hp_gpio_micmute_led(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4840 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4843 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4844 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4847 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4850 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4853 spec->cap_mute_led_nid = 0x1a; in alc236_fixup_hp_micmute_led_vref()
4854 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4855 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4859 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4862 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4863 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4866 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4869 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4870 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4871 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4879 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4898 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4901 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4904 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4948 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec) in alc298_samsung_v2_enable_amps() argument
4950 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_enable_amps()
4956 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_enable_amps()
4957 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_enable_amps()
4959 alc298_samsung_write_coef_pack(codec, enable_seq[j]); in alc298_samsung_v2_enable_amps()
4960 codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n", in alc298_samsung_v2_enable_amps()
4965 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec) in alc298_samsung_v2_disable_amps() argument
4967 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_disable_amps()
4973 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_disable_amps()
4974 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_disable_amps()
4976 alc298_samsung_write_coef_pack(codec, disable_seq[j]); in alc298_samsung_v2_disable_amps()
4977 codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n", in alc298_samsung_v2_disable_amps()
4983 struct hda_codec *codec, in alc298_samsung_v2_playback_hook() argument
4989 alc298_samsung_v2_enable_amps(codec); in alc298_samsung_v2_playback_hook()
4991 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_playback_hook()
4994 static void alc298_samsung_v2_init_amps(struct hda_codec *codec, in alc298_samsung_v2_init_amps() argument
4997 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_init_amps()
5001 spec->num_speaker_amps = num_speaker_amps; in alc298_samsung_v2_init_amps()
5004 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_init_amps()
5007 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_init_amps()
5008 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_init_amps()
5010 alc298_samsung_write_coef_pack(codec, in alc298_samsung_v2_init_amps()
5013 alc_write_coef_idx(codec, 0x89, 0x0); in alc298_samsung_v2_init_amps()
5014 codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n", in alc298_samsung_v2_init_amps()
5019 spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook; in alc298_samsung_v2_init_amps()
5022 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_2_amps() argument
5026 alc298_samsung_v2_init_amps(codec, 2); in alc298_fixup_samsung_amp_v2_2_amps()
5029 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_4_amps() argument
5033 alc298_samsung_v2_init_amps(codec, 4); in alc298_fixup_samsung_amp_v2_4_amps()
5036 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
5039 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
5043 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1); in gpio2_mic_hotkey_event()
5044 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
5045 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0); in gpio2_mic_hotkey_event()
5046 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
5049 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
5051 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
5054 spec->kb_dev = input_allocate_device(); in alc_register_micmute_input_device()
5055 if (!spec->kb_dev) { in alc_register_micmute_input_device()
5056 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
5057 return -ENOMEM; in alc_register_micmute_input_device()
5060 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE; in alc_register_micmute_input_device()
5062 spec->kb_dev->name = "Microphone Mute Button"; in alc_register_micmute_input_device()
5063 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY); in alc_register_micmute_input_device()
5064 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]); in alc_register_micmute_input_device()
5065 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map); in alc_register_micmute_input_device()
5066 spec->kb_dev->keycode = spec->alc_mute_keycode_map; in alc_register_micmute_input_device()
5067 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++) in alc_register_micmute_input_device()
5068 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit); in alc_register_micmute_input_device()
5070 if (input_register_device(spec->kb_dev)) { in alc_register_micmute_input_device()
5071 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
5072 input_free_device(spec->kb_dev); in alc_register_micmute_input_device()
5073 spec->kb_dev = NULL; in alc_register_micmute_input_device()
5074 return -ENOMEM; in alc_register_micmute_input_device()
5085 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
5088 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
5090 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
5092 spec->init_amp = ALC_INIT_DEFAULT; in alc280_fixup_hp_gpio2_mic_hotkey()
5093 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
5096 spec->gpio_mask |= 0x06; in alc280_fixup_hp_gpio2_mic_hotkey()
5097 spec->gpio_dir |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
5098 spec->gpio_data |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
5099 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
5101 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
5106 if (!spec->kb_dev) in alc280_fixup_hp_gpio2_mic_hotkey()
5111 input_unregister_device(spec->kb_dev); in alc280_fixup_hp_gpio2_mic_hotkey()
5112 spec->kb_dev = NULL; in alc280_fixup_hp_gpio2_mic_hotkey()
5119 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
5122 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
5124 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
5126 spec->init_amp = ALC_INIT_DEFAULT; in alc233_fixup_lenovo_line2_mic_hotkey()
5127 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
5130 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
5135 if (!spec->kb_dev) in alc233_fixup_lenovo_line2_mic_hotkey()
5140 input_unregister_device(spec->kb_dev); in alc233_fixup_lenovo_line2_mic_hotkey()
5141 spec->kb_dev = NULL; in alc233_fixup_lenovo_line2_mic_hotkey()
5145 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
5148 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
5150 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
5152 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_line1_mic1_led()
5153 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
5157 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec, in alc233_fixup_lenovo_low_en_micmute_led() argument
5160 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_low_en_micmute_led()
5163 spec->micmute_led_polarity = 1; in alc233_fixup_lenovo_low_en_micmute_led()
5164 alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action); in alc233_fixup_lenovo_low_en_micmute_led()
5167 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay) in alc_hp_mute_disable() argument
5171 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5174 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5179 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay) in alc_hp_enable_unmute() argument
5183 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5186 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5192 UPDATE_COEF(0x4a, 1<<8, 0),
5193 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
5202 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
5204 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
5208 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_unplugged()
5218 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_unplugged()
5252 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ in alc_headset_mode_unplugged()
5253 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ in alc_headset_mode_unplugged()
5254 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */ in alc_headset_mode_unplugged()
5279 if (spec->no_internal_mic_pin) { in alc_headset_mode_unplugged()
5280 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
5284 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
5286 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
5292 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5293 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
5298 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
5302 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
5306 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5309 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
5310 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5313 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
5316 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
5319 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
5327 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5328 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
5329 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
5332 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
5335 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
5339 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5348 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_mic_in()
5354 UPDATE_COEF(0x35, 0, 1<<14), in alc_headset_mode_mic_in()
5375 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ in alc_headset_mode_mic_in()
5376 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ in alc_headset_mode_mic_in()
5377 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_mic_in()
5383 UPDATE_COEF(0xc3, 0, 1<<12), in alc_headset_mode_mic_in()
5387 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), in alc_headset_mode_mic_in()
5399 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5401 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5402 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5403 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5404 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5410 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5411 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5412 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5413 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5418 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5419 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5420 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5421 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5425 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5426 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5427 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5428 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5433 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5434 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5435 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5438 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5439 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5443 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5444 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5445 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5446 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5449 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5453 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5454 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5457 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5458 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5459 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5460 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5468 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5469 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5470 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5471 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5472 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5475 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5478 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5500 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_default()
5527 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_default()
5544 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5551 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5552 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5553 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5556 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5562 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5563 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5565 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5566 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5571 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5575 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5580 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5583 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5586 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5589 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5592 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5595 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5599 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5635 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ in alc_headset_mode_ctia()
5651 UPDATE_COEF(0x63, 3<<14, 1<<14), in alc_headset_mode_ctia()
5655 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5657 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5663 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5664 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5669 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5673 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5676 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5677 if (val & (1 << 12)) { in alc_headset_mode_ctia()
5678 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5679 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5682 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5683 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5689 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5691 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5694 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5697 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5700 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5708 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5709 if (val & (1 << 9)) in alc_headset_mode_ctia()
5710 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5712 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5713 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5716 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5719 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5723 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5757 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ in alc_headset_mode_omtp()
5772 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5774 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5780 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5781 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5786 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5790 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5793 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5794 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5799 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5801 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5804 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5807 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5810 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5818 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5819 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5822 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5825 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5829 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5868 if (spec->no_internal_mic_pin) { in alc_determine_headset_type()
5869 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5873 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5875 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5877 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5884 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5885 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5886 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5888 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5890 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5893 alc_write_coef_idx(codec, 0x45, 0xe089); in alc_determine_headset_type()
5895 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5901 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5902 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5907 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5909 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5914 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5916 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5920 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5923 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5927 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5928 if (val & (1 << 12)) { in alc_determine_headset_type()
5929 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5930 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5932 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5935 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5936 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5938 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5941 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5942 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5945 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5950 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5952 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5956 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5958 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5962 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5964 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5968 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5970 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5979 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5980 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5981 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5982 if (val & (1 << 9)) { in alc_determine_headset_type()
5983 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5984 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5986 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5989 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5990 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5992 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5996 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10); in alc_determine_headset_type()
5997 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5999 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
6005 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
6006 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
6007 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
6014 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
6016 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP; in alc_determine_headset_type()
6019 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
6021 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
6023 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in alc_update_headset_mode()
6028 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
6030 else if (mux_pin == spec->headset_mic_pin) in alc_update_headset_mode()
6032 else if (mux_pin == spec->headphone_mic_pin) in alc_update_headset_mode()
6037 if (new_headset_mode == spec->current_headset_mode) { in alc_update_headset_mode()
6038 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6044 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
6045 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_update_headset_mode()
6046 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_update_headset_mode()
6047 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
6050 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) in alc_update_headset_mode()
6051 alc_determine_headset_type(codec); in alc_update_headset_mode()
6052 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) in alc_update_headset_mode()
6053 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
6054 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) in alc_update_headset_mode()
6055 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
6056 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
6059 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
6060 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
6063 alc_headset_mode_default(codec); in alc_update_headset_mode()
6064 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
6068 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
6070 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin) in alc_update_headset_mode()
6071 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
6074 spec->current_headset_mode = new_headset_mode; in alc_update_headset_mode()
6076 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6079 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
6083 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
6086 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
6089 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
6090 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
6093 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
6096 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
6097 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_probe_headset_mode()
6100 for (i = 0; i < cfg->num_inputs; i++) { in alc_probe_headset_mode()
6101 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin) in alc_probe_headset_mode()
6102 spec->headset_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
6103 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin) in alc_probe_headset_mode()
6104 spec->headphone_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
6107 WARN_ON(spec->gen.cap_sync_hook); in alc_probe_headset_mode()
6108 spec->gen.cap_sync_hook = alc_update_headset_mode_hook; in alc_probe_headset_mode()
6109 spec->gen.automute_hook = alc_update_headset_mode; in alc_probe_headset_mode()
6110 spec->gen.hp_automute_hook = alc_update_headset_jack_cb; in alc_probe_headset_mode()
6113 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
6116 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
6120 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC; in alc_fixup_headset_mode()
6123 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
6126 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
6127 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_fixup_headset_mode()
6128 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_fixup_headset_mode()
6130 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
6135 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
6139 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
6140 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_no_hp_mic()
6143 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
6146 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
6165 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
6167 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
6173 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
6179 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
6183 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
6185 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
6188 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
6192 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
6193 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc255_no_hp_mic()
6194 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
6197 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
6200 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
6203 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
6205 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
6207 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
6210 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
6213 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
6215 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
6217 spec->gpio_mask |= 0x40; in alc_fixup_headset_mode_dell_alc288()
6218 spec->gpio_dir |= 0x40; in alc_fixup_headset_mode_dell_alc288()
6219 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb; in alc_fixup_headset_mode_dell_alc288()
6223 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
6227 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
6228 spec->gen.auto_mute_via_amp = 1; in alc_fixup_auto_mute_via_amp()
6232 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
6236 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
6237 spec->no_shutup_pins = 1; in alc_fixup_no_shutup()
6241 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
6245 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
6246 /* Disable AA-loopback as it causes white noise */ in alc_fixup_disable_aamix()
6247 spec->gen.mixer_nid = 0; in alc_fixup_disable_aamix()
6252 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
6260 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
6263 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt440_dock()
6264 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
6265 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
6269 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
6277 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
6280 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt470_dock()
6281 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
6284 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
6287 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
6292 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
6297 * ALC298 codec in alc_fixup_tpt470_dacs()
6303 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
6306 spec->gen.preferred_dacs = preferred_pairs; in alc_fixup_tpt470_dacs()
6309 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
6315 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
6318 spec->gen.preferred_dacs = preferred_pairs; in alc295_fixup_asus_dacs()
6321 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
6323 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
6327 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
6332 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
6335 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
6336 struct hda_input_mux *imux = &spec->gen.input_mux; in alc_fixup_dell_xps13()
6341 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise in alc_fixup_dell_xps13()
6344 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6345 spec->shutup = alc_shutup_dell_xps13; in alc_fixup_dell_xps13()
6349 for (i = 0; i < imux->num_items; i++) { in alc_fixup_dell_xps13()
6350 if (spec->gen.imux_pins[i] == 0x12) { in alc_fixup_dell_xps13()
6351 spec->gen.cur_mux[0] = i; in alc_fixup_dell_xps13()
6359 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6362 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6365 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc662()
6366 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ in alc_fixup_headset_mode_alc662()
6368 /* Disable boost for mic-in permanently. (This code is only called in alc_fixup_headset_mode_alc662()
6370 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6371 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6373 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6376 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6380 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6381 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6382 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6384 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6388 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6390 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6391 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in find_ext_mic_pin()
6396 for (i = 0; i < cfg->num_inputs; i++) { in find_ext_mic_pin()
6397 if (cfg->inputs[i].type != AUTO_PIN_MIC) in find_ext_mic_pin()
6399 nid = cfg->inputs[i].pin; in find_ext_mic_pin()
6400 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6409 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6413 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6416 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6421 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6425 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6429 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6430 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc269_fixup_limit_int_mic_boost()
6435 Therefore limit the boost to 0 or 1. */ in alc269_fixup_limit_int_mic_boost()
6440 for (i = 0; i < cfg->num_inputs; i++) { in alc269_fixup_limit_int_mic_boost()
6441 hda_nid_t nid = cfg->inputs[i].pin; in alc269_fixup_limit_int_mic_boost()
6443 if (cfg->inputs[i].type != AUTO_PIN_MIC) in alc269_fixup_limit_int_mic_boost()
6445 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6449 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6457 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6460 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6464 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6466 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc283_hp_automute_hook()
6469 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6473 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6476 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6480 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6481 /* Disable AA-loopback as it causes white noise */ in alc283_fixup_chromebook()
6482 spec->gen.mixer_nid = 0; in alc283_fixup_chromebook()
6485 /* MIC2-VREF control */ in alc283_fixup_chromebook()
6487 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6489 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6494 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6497 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6501 spec->gen.hp_automute_hook = alc283_hp_automute_hook; in alc283_fixup_sense_combo_jack()
6504 /* MIC2-VREF control */ in alc283_fixup_sense_combo_jack()
6506 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6512 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6514 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6515 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6516 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6517 spec->gen.mute_bits |= (1ULL << 0x14); in asus_tx300_automute()
6520 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6523 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6531 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6533 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6534 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6535 spec->gen.auto_mute_via_amp = 1; in alc282_fixup_asus_tx300()
6536 spec->gen.automute_hook = asus_tx300_automute; in alc282_fixup_asus_tx300()
6537 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6541 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6547 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6549 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6555 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6563 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6564 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6568 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6574 Amp-out capability. we change the speaker's route to: in alc298_fixup_speaker_volume()
6575 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 ( in alc298_fixup_speaker_volume()
6576 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust in alc298_fixup_speaker_volume()
6580 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6585 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6590 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6595 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6600 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6604 /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */
6605 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec, in alc294_fixup_bass_speaker_15() argument
6610 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc294_fixup_bass_speaker_15()
6615 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6618 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6620 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6622 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6623 !spec->gen.hp_jack_present); in alc280_hp_gpio4_automute_hook()
6632 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6636 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6638 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6641 spec->gpio_mask |= 0x10; in alc280_fixup_hp_9480m()
6642 spec->gpio_dir |= 0x10; in alc280_fixup_hp_9480m()
6643 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; in alc280_fixup_hp_9480m()
6647 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6651 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6654 spec->gpio_mask |= 0x04; in alc275_fixup_gpio4_off()
6655 spec->gpio_dir |= 0x04; in alc275_fixup_gpio4_off()
6662 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6663 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6664 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6666 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6673 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6677 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6678 spec->gen.preferred_dacs = preferred_pairs; in alc285_fixup_thinkpad_x1_gen7()
6687 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6688 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6693 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6697 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6701 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6704 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
6705 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6706 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6707 "Rear-Panel Capture Volume" : in alc233_alc662_fixup_lenovo_dual_codecs()
6708 "Front-Panel Capture Volume"); in alc233_alc662_fixup_lenovo_dual_codecs()
6709 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6710 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6711 "Rear-Panel Capture Switch" : in alc233_alc662_fixup_lenovo_dual_codecs()
6712 "Front-Panel Capture Switch"); in alc233_alc662_fixup_lenovo_dual_codecs()
6717 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6723 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6727 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6730 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6739 spec->gen.preferred_dacs = preferred_pairs; in alc274_fixup_bind_dacs()
6740 spec->gen.auto_mute_via_amp = 1; in alc274_fixup_bind_dacs()
6741 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6745 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6751 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6754 spec->gen.preferred_dacs = preferred_pairs; in alc289_fixup_asus_ga401()
6758 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6764 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6767 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6769 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6775 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6776 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6785 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6786 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6791 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6794 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6798 spec->ultra_low_power = true; in alc295_fixup_chromebook()
6801 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6806 static void alc256_fixup_chromebook(struct hda_codec *codec, in alc256_fixup_chromebook() argument
6809 struct alc_spec *spec = codec->spec; in alc256_fixup_chromebook()
6813 spec->gen.suppress_auto_mute = 1; in alc256_fixup_chromebook()
6814 spec->gen.suppress_auto_mic = 1; in alc256_fixup_chromebook()
6815 spec->en_3kpull_low = false; in alc256_fixup_chromebook()
6820 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6824 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6828 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6831 /* The Windows driver sets the codec up in a very different way where in alc294_gx502_toggle_output()
6834 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6835 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6837 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6840 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6844 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6849 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6856 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6861 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6867 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6868 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6870 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6873 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6876 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6881 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6885 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6890 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6897 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6900 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6905 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6910 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6913 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6918 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6919 spec->no_internal_mic_pin = true; in alc_fixup_no_int_mic()
6922 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6930 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6935 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6943 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6947 spec->micmute_led_polarity = 1; in alc285_fixup_hp_spectre_x360_eb1()
6949 spec->gpio_mask |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6950 spec->gpio_dir |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6951 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6953 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6954 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6958 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6960 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6965 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6976 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6978 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6983 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec, in alc285_fixup_hp_envy_x360() argument
7009 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_envy_x360()
7012 alc295_fixup_disable_dac3(codec, fix, action); in alc285_fixup_hp_envy_x360()
7015 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0); in alc285_fixup_hp_envy_x360()
7017 /* Auto-enable headset mic when plugged */ in alc285_fixup_hp_envy_x360()
7018 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21); in alc285_fixup_hp_envy_x360()
7021 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50); in alc285_fixup_hp_envy_x360()
7024 alc_process_coef_fw(codec, coefs); in alc285_fixup_hp_envy_x360()
7027 rename_ctl(codec, "Bass Speaker Playback Volume", in alc285_fixup_hp_envy_x360()
7028 "B&O-Tuned Playback Volume"); in alc285_fixup_hp_envy_x360()
7029 rename_ctl(codec, "Front Playback Switch", in alc285_fixup_hp_envy_x360()
7031 rename_ctl(codec, "Bass Speaker Playback Switch", in alc285_fixup_hp_envy_x360()
7040 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
7043 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
7044 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
7050 static void alc_fixup_ideapad_acpi(struct hda_codec *codec, in alc_fixup_ideapad_acpi() argument
7053 hda_fixup_ideapad_acpi(codec, fix, action); in alc_fixup_ideapad_acpi()
7057 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
7061 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
7065 spec->gen.suppress_auto_mute = 1; in alc287_fixup_legion_15imhg05_speakers()
7073 struct alc_spec *spec = cdc->spec; in comp_acpi_device_notify()
7077 hda_component_acpi_device_notify(&spec->comps, handle, event, data); in comp_acpi_device_notify()
7083 struct alc_spec *spec = cdc->spec; in comp_bind()
7086 ret = hda_component_manager_bind(cdc, &spec->comps); in comp_bind()
7091 &spec->comps, in comp_bind()
7098 struct alc_spec *spec = cdc->spec; in comp_unbind()
7100 hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify); in comp_unbind()
7101 hda_component_manager_unbind(cdc, &spec->comps); in comp_unbind()
7112 struct alc_spec *spec = cdc->spec; in comp_generic_playback_hook()
7114 hda_component_manager_playback_hook(&spec->comps, action); in comp_generic_playback_hook()
7120 struct alc_spec *spec = cdc->spec; in comp_generic_fixup()
7125 ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid, in comp_generic_fixup()
7130 spec->gen.pcm_playback_hook = comp_generic_playback_hook; in comp_generic_fixup()
7133 hda_component_manager_free(&spec->comps, &comp_master_ops); in comp_generic_fixup()
7147 } acpi_ids[] = {{ "CSC3554", "cs35l54-hda" }, in find_cirrus_companion_amps()
7148 { "CSC3556", "cs35l56-hda" }, in find_cirrus_companion_amps()
7149 { "CSC3557", "cs35l57-hda" }}; in find_cirrus_companion_amps()
7154 adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1); in find_cirrus_companion_amps()
7186 * When available the cirrus,dev-index property is an accurate in find_cirrus_companion_amps()
7191 count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index"); in find_cirrus_companion_amps()
7195 match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name); in find_cirrus_companion_amps()
7204 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2); in cs35l41_fixup_i2c_two()
7209 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4); in cs35l41_fixup_i2c_four()
7212 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_two() argument
7214 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2); in cs35l41_fixup_spi_two()
7217 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_four() argument
7219 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4); in cs35l41_fixup_spi_four()
7225 comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2); in alc287_fixup_legion_16achg6_speakers()
7231 comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2); in alc287_fixup_legion_16ithg6_speakers()
7237 * The same SSID has been re-used in different hardware, they have in alc285_fixup_asus_ga403u()
7240 if (cdc->core.vendor_id != 0x10ec0285) in alc285_fixup_asus_ga403u()
7247 comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1); in tas2781_fixup_i2c()
7252 comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2); in tas2781_fixup_spi()
7258 comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1); in yoga7_14arb7_fixup_i2c()
7261 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec, in alc256_fixup_acer_sfg16_micmute_led() argument
7264 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc256_fixup_acer_sfg16_micmute_led()
7281 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
7290 * plugged-in state, while the internal microphone is always in an in alc256_fixup_set_coef_defaults()
7293 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
7303 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
7314 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
7317 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
7322 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, in alc256_fixup_mic_no_presence_and_resume()
7323 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec in alc256_fixup_mic_no_presence_and_resume()
7326 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
7327 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
7328 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
7330 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
7334 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec, in alc256_decrease_headphone_amp_val() argument
7343 caps = query_amp_caps(codec, 0x3, HDA_OUTPUT); in alc256_decrease_headphone_amp_val()
7344 nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10; in alc256_decrease_headphone_amp_val()
7345 offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10; in alc256_decrease_headphone_amp_val()
7349 if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps)) in alc256_decrease_headphone_amp_val()
7350 codec_warn(codec, "failed to override amp caps for NID 0x3\n"); in alc256_decrease_headphone_amp_val()
7353 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, in alc_fixup_dell4_mic_no_presence_quiet() argument
7357 struct alc_spec *spec = codec->spec; in alc_fixup_dell4_mic_no_presence_quiet()
7358 struct hda_input_mux *imux = &spec->gen.input_mux; in alc_fixup_dell4_mic_no_presence_quiet()
7361 alc269_fixup_limit_int_mic_boost(codec, fix, action); in alc_fixup_dell4_mic_no_presence_quiet()
7367 * to Hi-Z to avoid pop noises at startup and when plugging and in alc_fixup_dell4_mic_no_presence_quiet()
7370 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7371 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7378 for (i = 0; i < imux->num_items; i++) { in alc_fixup_dell4_mic_no_presence_quiet()
7379 if (spec->gen.imux_pins[i] == 0x12) { in alc_fixup_dell4_mic_no_presence_quiet()
7380 spec->gen.cur_mux[0] = i; in alc_fixup_dell4_mic_no_presence_quiet()
7388 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, in alc287_fixup_yoga9_14iap7_bass_spk_pin() argument
7414 struct alc_spec *spec = codec->spec; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7418 snd_hda_apply_pincfgs(codec, pincfgs); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7419 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7420 spec->gen.preferred_dacs = preferred_pairs; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7425 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec, in alc295_fixup_dell_inspiron_top_speakers() argument
7440 struct alc_spec *spec = codec->spec; in alc295_fixup_dell_inspiron_top_speakers()
7442 alc_fixup_no_shutup(codec, fix, action); in alc295_fixup_dell_inspiron_top_speakers()
7446 snd_hda_apply_pincfgs(codec, pincfgs); in alc295_fixup_dell_inspiron_top_speakers()
7447 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_dell_inspiron_top_speakers()
7448 spec->gen.preferred_dacs = preferred_pairs; in alc295_fixup_dell_inspiron_top_speakers()
7454 static void alc287_fixup_bind_dacs(struct hda_codec *codec, in alc287_fixup_bind_dacs() argument
7457 struct alc_spec *spec = codec->spec; in alc287_fixup_bind_dacs()
7466 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_bind_dacs()
7467 spec->gen.preferred_dacs = preferred_pairs; in alc287_fixup_bind_dacs()
7468 spec->gen.auto_mute_via_amp = 1; in alc287_fixup_bind_dacs()
7469 if (spec->gen.autocfg.speaker_pins[0] != 0x14) { in alc287_fixup_bind_dacs()
7470 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc287_fixup_bind_dacs()
7475 static void alc_fixup_headset_mic(struct hda_codec *codec, in alc_fixup_headset_mic() argument
7478 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mic()
7486 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_headset_mic()
7487 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_headset_mic()
7488 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mic()
7493 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_eu0xxx() argument
7515 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_eu0xxx()
7516 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_eu0xxx()
7520 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7521 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7522 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7526 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_16_aa0xxx() argument
7535 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7550 spec->gpio_mask |= 0x01; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7551 spec->gpio_dir |= 0x01; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7552 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7553 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7557 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7559 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7563 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7564 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7565 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7572 struct hda_codec *codec, in alc287_alc1318_playback_pcm_hook() argument
7578 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */ in alc287_alc1318_playback_pcm_hook()
7581 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_alc1318_playback_pcm_hook()
7586 static void alc287_s4_power_gpio3_default(struct hda_codec *codec) in alc287_s4_power_gpio3_default() argument
7588 if (is_s4_suspend(codec)) { in alc287_s4_power_gpio3_default()
7589 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_s4_power_gpio3_default()
7593 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, in alc287_fixup_lenovo_thinkpad_with_alc1318() argument
7596 struct alc_spec *spec = codec->spec; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7606 alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7607 alc_process_coef_fw(codec, coefs); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7608 spec->power_hook = alc287_s4_power_gpio3_default; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7609 spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7616 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec, in alc283_fixup_dell_hp_resume() argument
7620 alc_write_coef_idx(codec, 0xd, 0x2800); in alc283_fixup_dell_hp_resume()
7932 * depending on the codec ID
7934 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
7940 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
7944 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
8052 { 0x1a, 0x2101103f }, /* dock line-out */
8053 { 0x1b, 0x23a11040 }, /* dock mic-in */
8114 { 0x19, 0x99a3092f }, /* int-mic */
8121 { 0x12, 0x99a3092f }, /* int-mic */
8133 { 0x19, 0x99a3092f }, /* int-mic */
8141 { 0x12, 0x99a3092f }, /* int-mic */
8335 { 0x1b, 0x99a7012f }, /* int-mic */
8355 { 0x12, 0x99a3092f }, /* int-mic */
8380 /* class-D output amp +5dB */
8406 { 0x12, 0x99a3092f }, /* int-mic */
8603 { 0x1b, 0x21011020 }, /* line-out */
8605 { 0x18, 0x2181103f }, /* line-in */
8614 { 0x1b, 0x21011020 }, /* line-out */
8615 { 0x18, 0x2181103f }, /* line-in */
8762 /* Disable pass-through path for FRONT 14h */
9118 /* Disable PCBEEP-IN passthrough */
9331 /* set 0x15 to HP-OUT ctrl */
9358 /* set 0x15 to HP-OUT ctrl */
9362 /* set 0x1b to HP-OUT */
10295 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10298 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10299 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10300 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10301 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10303 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10305 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10306 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10308 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10309 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10310 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10313 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10314 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10318 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10319 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10323 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10324 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10325 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10326 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10327 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10328 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10330 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10331 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10332 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10333 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10334 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10335 SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10399 …SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_…
10403 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10416 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10417 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10418 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10420 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10421 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10422 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10423 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10496 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10499 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10500 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10502 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10504 …SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_C…
10505 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10509 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10511 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10512 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10513 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10523 …SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS…
10533 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10535 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10545 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10546 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10549 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10550 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10552 SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10562 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10563 SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10564 …SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS…
10569 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10570 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10573 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10600 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10601 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10602 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10657 SND_PCI_QUIRK(0x103c, 0x8bcd, "HP Omen 16-xd0xxx", ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT),
10671 …SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X…
10672 …SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X…
10674 SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10675 SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10679 …SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_L…
10686 SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10715 SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10909 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10916 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10918 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10919 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10920 …SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP…
10921 …SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP…
10922 …SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP…
10926 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10927 …SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP…
10937 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
10938 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
10939 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
10941 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
10983 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
10993 …SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENC…
10994 …SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENC…
10995 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10996 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
10997 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
11004 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11005 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11006 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11051 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11096 HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11118 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11119 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11120 SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11121 SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11136 SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11137 SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11138 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11139 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11140 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11141 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11148 SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11149 SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11150 SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11151 SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11160 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11162 SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11163 SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11165 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11182 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
11195 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11196 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11197 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11201 …b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11205 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11225 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11230 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11302 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11303 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11304 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11305 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11306 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11307 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11308 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11309 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11310 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11311 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11312 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11313 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11314 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11315 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11316 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11317 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11318 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11319 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11320 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11321 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11324 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11325 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11326 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11327 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11329 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11330 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11331 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11332 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11335 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11336 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11337 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11338 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11339 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11340 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11341 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11342 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11343 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11344 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11346 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11347 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11348 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11349 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11350 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11351 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11352 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11353 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11354 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11356 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11357 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11358 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11359 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11361 {.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11362 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11363 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11364 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11365 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11366 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11367 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11368 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11369 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11370 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11371 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11372 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11373 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11374 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11375 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11376 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11377 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11378 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11379 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11380 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11381 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11382 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11383 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11384 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11385 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11386 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11387 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11388 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11389 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11390 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11391 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11392 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11393 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11394 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11395 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11396 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11397 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11398 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11399 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11400 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11401 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11402 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11403 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11404 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11405 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11406 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11407 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11408 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11409 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11410 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11411 {.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11412 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11413 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11414 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11415 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11416 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11417 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11418 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11419 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11420 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11421 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11422 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11423 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11424 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11425 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11426 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11427 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11428 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11429 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11430 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11431 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11432 {.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11867 * at most one tbl is allowed to define for the same vendor and same codec
11894 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
11896 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
11899 if (spec->codec_variant != ALC269_TYPE_ALC269VB) in alc269_fill_coef()
11902 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
11903 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11904 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
11907 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
11908 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11909 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
11912 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
11914 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
11917 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
11918 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
11919 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { in alc269_fill_coef()
11921 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
11923 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
11924 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { in alc269_fill_coef()
11926 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
11931 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
11936 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
11941 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
11945 spec = codec->spec; in patch_alc269()
11946 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc269()
11947 codec->power_save_node = 0; in patch_alc269()
11948 spec->en_3kpull_low = true; in patch_alc269()
11950 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
11951 codec->patch_ops.resume = alc269_resume; in patch_alc269()
11952 spec->shutup = alc_default_shutup; in patch_alc269()
11953 spec->init_hook = alc_default_init; in patch_alc269()
11955 switch (codec->core.vendor_id) { in patch_alc269()
11957 spec->codec_variant = ALC269_TYPE_ALC269VA; in patch_alc269()
11958 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
11960 if (codec->bus->pci && in patch_alc269()
11961 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
11962 spec->cdefine.platform_type == 1) in patch_alc269()
11963 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
11964 spec->codec_variant = ALC269_TYPE_ALC269VB; in patch_alc269()
11967 if (codec->bus->pci && in patch_alc269()
11968 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
11969 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
11970 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
11971 spec->codec_variant = ALC269_TYPE_ALC269VC; in patch_alc269()
11974 spec->codec_variant = ALC269_TYPE_ALC269VD; in patch_alc269()
11977 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
11981 spec->shutup = alc269_shutup; in patch_alc269()
11982 spec->init_hook = alc269_fill_coef; in patch_alc269()
11983 alc269_fill_coef(codec); in patch_alc269()
11988 spec->codec_variant = ALC269_TYPE_ALC280; in patch_alc269()
11991 spec->codec_variant = ALC269_TYPE_ALC282; in patch_alc269()
11992 spec->shutup = alc282_shutup; in patch_alc269()
11993 spec->init_hook = alc282_init; in patch_alc269()
11997 spec->codec_variant = ALC269_TYPE_ALC283; in patch_alc269()
11998 spec->shutup = alc283_shutup; in patch_alc269()
11999 spec->init_hook = alc283_init; in patch_alc269()
12003 spec->codec_variant = ALC269_TYPE_ALC284; in patch_alc269()
12006 spec->codec_variant = ALC269_TYPE_ALC293; in patch_alc269()
12010 spec->codec_variant = ALC269_TYPE_ALC286; in patch_alc269()
12013 spec->codec_variant = ALC269_TYPE_ALC298; in patch_alc269()
12017 spec->codec_variant = ALC269_TYPE_ALC255; in patch_alc269()
12018 spec->shutup = alc256_shutup; in patch_alc269()
12019 spec->init_hook = alc256_init; in patch_alc269()
12025 spec->codec_variant = ALC269_TYPE_ALC256; in patch_alc269()
12026 spec->shutup = alc256_shutup; in patch_alc269()
12027 spec->init_hook = alc256_init; in patch_alc269()
12028 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */ in patch_alc269()
12029 if (codec->core.vendor_id == 0x10ec0236 && in patch_alc269()
12030 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD) in patch_alc269()
12031 spec->en_3kpull_low = false; in patch_alc269()
12034 spec->codec_variant = ALC269_TYPE_ALC257; in patch_alc269()
12035 spec->shutup = alc256_shutup; in patch_alc269()
12036 spec->init_hook = alc256_init; in patch_alc269()
12037 spec->gen.mixer_nid = 0; in patch_alc269()
12038 spec->en_3kpull_low = false; in patch_alc269()
12044 if (alc_get_coef0(codec) & 0x0010) in patch_alc269()
12045 spec->codec_variant = ALC269_TYPE_ALC245; in patch_alc269()
12047 spec->codec_variant = ALC269_TYPE_ALC215; in patch_alc269()
12048 spec->shutup = alc225_shutup; in patch_alc269()
12049 spec->init_hook = alc225_init; in patch_alc269()
12050 spec->gen.mixer_nid = 0; in patch_alc269()
12055 spec->codec_variant = ALC269_TYPE_ALC225; in patch_alc269()
12056 spec->shutup = alc225_shutup; in patch_alc269()
12057 spec->init_hook = alc225_init; in patch_alc269()
12058 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */ in patch_alc269()
12061 spec->codec_variant = ALC269_TYPE_ALC287; in patch_alc269()
12062 spec->shutup = alc225_shutup; in patch_alc269()
12063 spec->init_hook = alc225_init; in patch_alc269()
12064 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */ in patch_alc269()
12069 spec->codec_variant = ALC269_TYPE_ALC294; in patch_alc269()
12070 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ in patch_alc269()
12071 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
12072 spec->init_hook = alc294_init; in patch_alc269()
12075 spec->codec_variant = ALC269_TYPE_ALC300; in patch_alc269()
12076 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */ in patch_alc269()
12080 spec->codec_variant = ALC269_TYPE_ALC623; in patch_alc269()
12081 spec->shutup = alc222_shutup; in patch_alc269()
12082 spec->init_hook = alc222_init; in patch_alc269()
12088 spec->codec_variant = ALC269_TYPE_ALC700; in patch_alc269()
12089 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ in patch_alc269()
12090 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
12091 spec->init_hook = alc294_init; in patch_alc269()
12096 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
12097 spec->has_alc5505_dsp = 1; in patch_alc269()
12098 spec->init_hook = alc5505_dsp_init; in patch_alc269()
12101 alc_pre_init(codec); in patch_alc269()
12103 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
12109 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
12110 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
12111 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
12112 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
12115 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
12116 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
12117 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
12124 find_cirrus_companion_amps(codec); in patch_alc269()
12126 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
12128 alc_auto_parse_customize_define(codec); in patch_alc269()
12130 if (has_cdefine_beep(codec)) in patch_alc269()
12131 spec->gen.beep_nid = 0x01; in patch_alc269()
12134 err = alc269_parse_auto_config(codec); in patch_alc269()
12138 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) { in patch_alc269()
12139 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT); in patch_alc269()
12144 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
12149 alc_free(codec); in patch_alc269()
12157 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
12161 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
12174 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
12177 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
12182 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
12186 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
12187 spec->gen.keep_vref_in_automute = 1; in alc861_fixup_asus_amp_vref_0f()
12190 /* suppress the jack-detection */
12191 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
12195 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
12246 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
12251 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
12255 spec = codec->spec; in patch_alc861()
12256 if (has_cdefine_beep(codec)) in patch_alc861()
12257 spec->gen.beep_nid = 0x23; in patch_alc861()
12259 spec->power_hook = alc_power_eapd; in patch_alc861()
12261 alc_pre_init(codec); in patch_alc861()
12263 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
12264 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
12267 err = alc861_parse_auto_config(codec); in patch_alc861()
12271 if (!spec->gen.no_analog) { in patch_alc861()
12277 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
12282 alc_free(codec); in patch_alc861()
12287 * ALC861-VD support
12293 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
12297 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
12306 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
12310 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
12311 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
12316 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
12319 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
12322 spec->gpio_mask |= 0x02; in alc660vd_fixup_asus_gpio1()
12323 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
12339 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12340 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12346 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
12351 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
12355 spec = codec->spec; in patch_alc861vd()
12356 if (has_cdefine_beep(codec)) in patch_alc861vd()
12357 spec->gen.beep_nid = 0x23; in patch_alc861vd()
12359 spec->shutup = alc_eapd_shutup; in patch_alc861vd()
12361 alc_pre_init(codec); in patch_alc861vd()
12363 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
12364 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
12367 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
12371 if (!spec->gen.no_analog) { in patch_alc861vd()
12377 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
12382 alc_free(codec); in patch_alc861vd()
12392 * 6-channel independent captures.
12394 * In addition, an independent DAC for the multi-playback (not used in this
12402 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
12409 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
12410 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
12411 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
12415 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
12418 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
12423 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
12428 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
12441 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
12445 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
12446 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps; in alc_fixup_bass_chmap()
12451 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
12455 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
12456 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
12461 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
12464 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
12466 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
12468 spec->mute_led_polarity = 1; in alc662_fixup_led_gpio1()
12469 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
12473 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
12476 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
12479 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
12481 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc662_usi_automute_hook()
12483 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
12487 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
12490 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
12492 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc662_fixup_usi_headset_mic()
12493 spec->gen.hp_automute_hook = alc662_usi_automute_hook; in alc662_fixup_usi_headset_mic()
12497 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
12503 * 0x15 - front left/front right in alc662_aspire_ethos_mute_speakers()
12504 * 0x18 - front center/ LFE in alc662_aspire_ethos_mute_speakers()
12506 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
12507 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
12508 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
12510 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12511 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12515 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
12519 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
12524 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
12527 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
12533 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
12538 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
12541 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
12551 spec->gen.mixer_nid = 0; in alc671_fixup_hp_headset_mic2()
12552 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc671_fixup_hp_headset_mic2()
12553 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
12556 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
12561 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
12564 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
12567 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
12568 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; in alc897_hp_automute_hook()
12569 snd_hda_set_pin_ctl(codec, 0x1b, vref); in alc897_hp_automute_hook()
12572 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
12575 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
12577 spec->gen.hp_automute_hook = alc897_hp_automute_hook; in alc897_fixup_lenovo_headset_mic()
12578 spec->no_shutup_pins = 1; in alc897_fixup_lenovo_headset_mic()
12581 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100); in alc897_fixup_lenovo_headset_mic()
12585 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mode() argument
12588 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mode()
12591 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc897_fixup_lenovo_headset_mode()
12592 spec->gen.hp_automute_hook = alc897_hp_automute_hook; in alc897_fixup_lenovo_headset_mode()
12620 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
12622 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
12718 {0x19, 0x90a7013f}, /* int-mic */
12754 { 0x19, 0x99a3092f }, /* int-mic */
12766 { 0x19, 0x99a3092f }, /* int-mic */
12779 { 0x19, 0x99a3094f }, /* int-mic */
12792 { 0x19, 0x99a3094f }, /* int-mic */
12806 { 0x19, 0x99a3094f }, /* int-mic */
12818 { 0x19, 0x99a3094f }, /* int-mic */
12831 { 0x19, 0x99a3094f }, /* int-mic */
12843 { 0x12, 0x99a30970 }, /* int-mic */
13140 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13149 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13196 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13204 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13270 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13271 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13272 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13273 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13274 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13275 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13276 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13277 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13278 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13279 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13280 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13281 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13282 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13283 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13284 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13288 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13289 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13290 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13291 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13292 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13293 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13294 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13295 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13296 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13297 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13298 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13299 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13364 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
13369 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
13373 spec = codec->spec; in patch_alc662()
13375 spec->shutup = alc_eapd_shutup; in patch_alc662()
13378 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in patch_alc662()
13380 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
13382 switch (codec->core.vendor_id) { in patch_alc662()
13384 spec->init_hook = alc668_restore_default_value; in patch_alc662()
13388 alc_pre_init(codec); in patch_alc662()
13390 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
13392 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
13393 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
13395 alc_auto_parse_customize_define(codec); in patch_alc662()
13397 if (has_cdefine_beep(codec)) in patch_alc662()
13398 spec->gen.beep_nid = 0x01; in patch_alc662()
13400 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
13401 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
13402 spec->cdefine.platform_type == 1) { in patch_alc662()
13403 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
13409 err = alc662_parse_auto_config(codec); in patch_alc662()
13413 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc662()
13414 switch (codec->core.vendor_id) { in patch_alc662()
13432 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
13437 alc_free(codec); in patch_alc662()
13445 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
13447 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
13452 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
13456 /* ALC680 has no aa-loopback mixer */ in patch_alc680()
13457 err = alc_alloc_spec(codec, 0); in patch_alc680()
13462 err = alc680_parse_auto_config(codec); in patch_alc680()
13464 alc_free(codec); in patch_alc680()
13518 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13520 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13559 MODULE_DESCRIPTION("Realtek HD-audio codec");