Lines Matching +full:codec +full:- +full:3
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal Interface for Intel High Definition Audio Codec
39 /* extra amp-initialization sequence types */
87 /* codec parameterization */
115 void (*init_hook)(struct hda_codec *codec);
116 void (*power_hook)(struct hda_codec *codec);
117 void (*shutup)(struct hda_codec *codec);
146 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
148 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
150 snd_hda_power_up_pm(codec); in coef_mutex_lock()
151 mutex_lock(&spec->coef_mutex); in coef_mutex_lock()
154 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
156 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
158 mutex_unlock(&spec->coef_mutex); in coef_mutex_unlock()
159 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
162 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
167 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
168 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
172 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
177 coef_mutex_lock(codec); in alc_read_coefex_idx()
178 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
179 coef_mutex_unlock(codec); in alc_read_coefex_idx()
183 #define alc_read_coef_idx(codec, coef_idx) \ argument
184 alc_read_coefex_idx(codec, 0x20, coef_idx)
186 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
190 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
193 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
196 coef_mutex_lock(codec); in alc_write_coefex_idx()
197 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
198 coef_mutex_unlock(codec); in alc_write_coefex_idx()
201 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
202 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
204 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
208 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
210 if (val != -1) in __alc_update_coefex_idx()
211 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
215 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
219 coef_mutex_lock(codec); in alc_update_coefex_idx()
220 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
221 coef_mutex_unlock(codec); in alc_update_coefex_idx()
224 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
225 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
228 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
230 struct alc_spec *spec = codec->spec; in alc_get_coef0()
232 if (!spec->coef0) in alc_get_coef0()
233 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
234 return spec->coef0; in alc_get_coef0()
247 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
251 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
254 coef_mutex_lock(codec); in alc_process_coef_fw()
255 for (; fw->nid; fw++) { in alc_process_coef_fw()
256 if (fw->mask == (unsigned short)-1) in alc_process_coef_fw()
257 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
259 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
260 fw->mask, fw->val); in alc_process_coef_fw()
262 coef_mutex_unlock(codec); in alc_process_coef_fw()
270 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
272 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
274 spec->gpio_mask |= mask; in alc_setup_gpio()
275 spec->gpio_dir |= mask; in alc_setup_gpio()
276 spec->gpio_data |= mask; in alc_setup_gpio()
279 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
281 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
283 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
284 spec->gpio_data); in alc_write_gpio_data()
287 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
290 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
291 unsigned int oldval = spec->gpio_data; in alc_update_gpio_data()
294 spec->gpio_data |= mask; in alc_update_gpio_data()
296 spec->gpio_data &= ~mask; in alc_update_gpio_data()
297 if (oldval != spec->gpio_data) in alc_update_gpio_data()
298 alc_write_gpio_data(codec); in alc_update_gpio_data()
301 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
303 struct alc_spec *spec = codec->spec; in alc_write_gpio()
305 if (!spec->gpio_mask) in alc_write_gpio()
308 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
309 AC_VERB_SET_GPIO_MASK, spec->gpio_mask); in alc_write_gpio()
310 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
311 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir); in alc_write_gpio()
312 if (spec->gpio_write_delay) in alc_write_gpio()
314 alc_write_gpio_data(codec); in alc_write_gpio()
317 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
321 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
324 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
327 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
330 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
333 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
336 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
339 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
342 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
345 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
348 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
352 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
360 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
362 struct alc_spec *spec = codec->spec; in alc_fix_pll()
364 if (spec->pll_nid) in alc_fix_pll()
365 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
366 1 << spec->pll_coef_bit, 0); in alc_fix_pll()
369 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
372 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
373 spec->pll_nid = nid; in alc_fix_pll_init()
374 spec->pll_coef_idx = coef_idx; in alc_fix_pll_init()
375 spec->pll_coef_bit = coef_bit; in alc_fix_pll_init()
376 alc_fix_pll(codec); in alc_fix_pll_init()
379 /* update the master volume per volume-knob's unsol event */
380 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
387 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
393 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
396 uctl->value.integer.value[0] = val; in alc_update_knob_master()
397 uctl->value.integer.value[1] = val; in alc_update_knob_master()
398 kctl->put(kctl, uctl); in alc_update_knob_master()
402 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
406 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
410 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
414 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
416 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
418 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
422 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
426 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
428 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
430 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
436 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
441 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
446 alc_update_coef_idx(codec, 0x36, 1<<13, 0); in alc_fill_eapd_coef()
463 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
466 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
469 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
470 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
473 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
477 alc_write_coef_idx(codec, 0x6e, 0x0c25); in alc_fill_eapd_coef()
484 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
488 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
497 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
501 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
504 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
507 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
511 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
515 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
522 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
528 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
530 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
531 /* alc888-VA */ in alc888_coef_init()
533 /* alc888-VB */ in alc888_coef_init()
535 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
541 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
543 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
545 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
546 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
550 /* turn on/off EAPD controls of the codec */
551 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
559 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
562 static int find_ext_mic_pin(struct hda_codec *codec);
564 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
567 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
573 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
576 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
578 if (pin->nid != mic_pin) in alc_headset_mic_no_shutup()
579 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
583 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
586 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
588 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
590 if (spec->no_shutup_pins) in alc_shutup_pins()
593 switch (codec->core.vendor_id) { in alc_shutup_pins()
605 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
608 snd_hda_shutup_pins(codec); in alc_shutup_pins()
614 * just turning off EAPD and a little pause for avoiding pop-noise
616 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
618 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
620 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
621 if (!spec->no_depop_delay) in alc_eapd_shutup()
623 alc_shutup_pins(codec); in alc_eapd_shutup()
627 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
629 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
630 alc_write_gpio(codec); in alc_auto_init_amp()
633 switch (codec->core.vendor_id) { in alc_auto_init_amp()
635 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
641 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
644 alc888_coef_init(codec); in alc_auto_init_amp()
654 if (spec->gen.autocfg.hp_pins[0]) in alc_get_hp_pin()
655 return spec->gen.autocfg.hp_pins[0]; in alc_get_hp_pin()
656 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) in alc_get_hp_pin()
657 return spec->gen.autocfg.line_out_pins[0]; in alc_get_hp_pin()
665 /* Could be any non-zero and even value. When used as fixup, tells
670 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
673 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
675 spec->cdefine.fixup = 1; in alc_fixup_sku_ignore()
676 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; in alc_fixup_sku_ignore()
680 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
683 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
686 spec->no_depop_delay = 1; in alc_fixup_no_depop_delay()
687 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
691 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
695 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
697 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ in alc_auto_parse_customize_define()
699 if (spec->cdefine.fixup) { in alc_auto_parse_customize_define()
700 ass = spec->cdefine.sku_cfg; in alc_auto_parse_customize_define()
702 return -1; in alc_auto_parse_customize_define()
706 if (!codec->bus->pci) in alc_auto_parse_customize_define()
707 return -1; in alc_auto_parse_customize_define()
708 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
709 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
713 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
715 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
718 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
719 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
720 return -1; in alc_auto_parse_customize_define()
730 return -1; in alc_auto_parse_customize_define()
732 spec->cdefine.port_connectivity = ass >> 30; in alc_auto_parse_customize_define()
733 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; in alc_auto_parse_customize_define()
734 spec->cdefine.check_sum = (ass >> 16) & 0xf; in alc_auto_parse_customize_define()
735 spec->cdefine.customization = ass >> 8; in alc_auto_parse_customize_define()
737 spec->cdefine.sku_cfg = ass; in alc_auto_parse_customize_define()
738 spec->cdefine.external_amp = (ass & 0x38) >> 3; in alc_auto_parse_customize_define()
739 spec->cdefine.platform_type = (ass & 0x4) >> 2; in alc_auto_parse_customize_define()
740 spec->cdefine.swap = (ass & 0x2) >> 1; in alc_auto_parse_customize_define()
741 spec->cdefine.override = ass & 0x1; in alc_auto_parse_customize_define()
743 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
744 nid, spec->cdefine.sku_cfg); in alc_auto_parse_customize_define()
745 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
746 spec->cdefine.port_connectivity); in alc_auto_parse_customize_define()
747 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
748 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
749 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
750 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
751 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
752 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
753 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
758 /* return the position of NID in the list, or -1 if not found */
765 return -1; in find_idx_in_nid_list()
773 /* check subsystem ID and set up device-specific initialization;
776 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
780 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
782 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
786 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
788 if (spec->cdefine.fixup) { in alc_subsystem_id()
789 ass = spec->cdefine.sku_cfg; in alc_subsystem_id()
795 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
796 if (codec->bus->pci && in alc_subsystem_id()
797 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
810 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
812 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
813 codec_dbg(codec, in alc_subsystem_id()
830 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
831 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
835 * 2 : 0 --> Desktop, 1 --> Laptop in alc_subsystem_id()
836 * 3~5 : External Amplifier control in alc_subsystem_id()
839 tmp = (ass & 0x38) >> 3; /* external Amp control */ in alc_subsystem_id()
840 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_subsystem_id()
843 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
845 case 3: in alc_subsystem_id()
846 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
849 alc_setup_gpio(codec, 0x04); in alc_subsystem_id()
853 spec->init_amp = ALC_INIT_DEFAULT; in alc_subsystem_id()
865 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered in alc_subsystem_id()
867 * 15 : 1 --> enable the function "Mute internal speaker in alc_subsystem_id()
874 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, in alc_subsystem_id()
875 spec->gen.autocfg.line_outs)) in alc_subsystem_id()
877 spec->gen.autocfg.hp_pins[0] = nid; in alc_subsystem_id()
882 /* Check the validity of ALC subsystem-id
883 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
884 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
886 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
887 struct alc_spec *spec = codec->spec; in alc_ssid_check()
888 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_ssid_check()
889 codec_dbg(codec, in alc_ssid_check()
891 spec->init_amp = ALC_INIT_DEFAULT; in alc_ssid_check()
896 /* inverted digital-mic */
897 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
900 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
902 spec->gen.inv_dmic_split = 1; in alc_fixup_inv_dmic()
906 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
910 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
914 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
923 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
925 alc_fill_eapd_coef(codec); in alc_pre_init()
928 #define is_s3_resume(codec) \ argument
929 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
930 #define is_s4_resume(codec) \ argument
931 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
932 #define is_s4_suspend(codec) \ argument
933 ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
935 static int alc_init(struct hda_codec *codec) in alc_init() argument
937 struct alc_spec *spec = codec->spec; in alc_init()
940 if (is_s4_resume(codec)) in alc_init()
941 alc_pre_init(codec); in alc_init()
943 if (spec->init_hook) in alc_init()
944 spec->init_hook(codec); in alc_init()
946 spec->gen.skip_verbs = 1; /* applied in below */ in alc_init()
947 snd_hda_gen_init(codec); in alc_init()
948 alc_fix_pll(codec); in alc_init()
949 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
950 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
952 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
960 static void alc_free(struct hda_codec *codec) in alc_free() argument
962 struct alc_spec *spec = codec->spec; in alc_free()
965 hda_component_manager_free(&spec->comps, &comp_master_ops); in alc_free()
967 snd_hda_gen_free(codec); in alc_free()
970 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
972 struct alc_spec *spec = codec->spec; in alc_shutup()
974 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
977 if (spec && spec->shutup) in alc_shutup()
978 spec->shutup(codec); in alc_shutup()
980 alc_shutup_pins(codec); in alc_shutup()
983 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
985 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
988 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
990 struct alc_spec *spec = codec->spec; in alc_suspend()
991 alc_shutup(codec); in alc_suspend()
992 if (spec && spec->power_hook) in alc_suspend()
993 spec->power_hook(codec); in alc_suspend()
997 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
999 struct alc_spec *spec = codec->spec; in alc_resume()
1001 if (!spec->no_depop_delay) in alc_resume()
1003 codec->patch_ops.init(codec); in alc_resume()
1004 snd_hda_regmap_sync(codec); in alc_resume()
1005 hda_call_check_power_status(codec, 0x01); in alc_resume()
1023 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1053 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1054 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1094 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1099 for (p = rename_tbl; p->vendor_id; p++) { in alc_codec_rename_from_preset()
1100 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1102 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1103 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1106 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1108 for (q = rename_pci_tbl; q->codec_vendor_id; q++) { in alc_codec_rename_from_preset()
1109 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1111 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1113 if (!q->pci_subdevice || in alc_codec_rename_from_preset()
1114 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1115 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1123 * Digital-beep handlers
1138 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir); in set_beep_amp()
1142 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, in set_beep_amp()
1145 return -ENOMEM; in set_beep_amp()
1146 knew->private_value = beep_amp; in set_beep_amp()
1159 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1161 /* denylist -- no beep available */
1167 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1169 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1171 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1173 return q->value; in has_cdefine_beep()
1174 return spec->cdefine.enable_pcbeep; in has_cdefine_beep()
1178 #define has_cdefine_beep(codec) 0 argument
1185 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1189 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1190 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_parse_auto_config()
1193 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1194 spec->parse_flags); in alc_parse_auto_config()
1199 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1201 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1209 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1215 return -ENOMEM; in alc_alloc_spec()
1216 codec->spec = spec; in alc_alloc_spec()
1217 snd_hda_gen_spec_init(&spec->gen); in alc_alloc_spec()
1218 spec->gen.mixer_nid = mixer_nid; in alc_alloc_spec()
1219 spec->gen.own_eapd_ctl = 1; in alc_alloc_spec()
1220 codec->single_adc_amp = 1; in alc_alloc_spec()
1221 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1222 codec->spdif_status_reset = 1; in alc_alloc_spec()
1223 codec->forced_resume = 1; in alc_alloc_spec()
1224 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1225 mutex_init(&spec->coef_mutex); in alc_alloc_spec()
1227 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1235 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1239 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1243 * ALC880 fix-ups
1273 /* enable the volume-knob widget support on NID 0x21 */
1274 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1278 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1314 { 0x1a, 0x0181344f }, /* line-in */
1362 { 0x19, 0x01a19950 }, /* mic-in */
1382 { 0x19, 0x01a19950 }, /* mic-in */
1422 { 0x18, 0x01a19950 }, /* mic-in */
1424 { 0x1a, 0x01813031 }, /* line-in */
1455 { 0x14, 0x01014010 }, /* line-out */
1459 { 0x18, 0x01a19c30 }, /* mic-in */
1461 { 0x1a, 0x01813031 }, /* line-in */
1462 { 0x1b, 0x02a19c40 }, /* front-mic */
1495 { 0x18, 0x01a19c30 }, /* mic-in */
1497 { 0x1a, 0x01813031 }, /* line-in */
1498 { 0x1b, 0x02a19c40 }, /* front-mic */
1531 { 0x18, 0x01a19c30 }, /* mic-in */
1532 { 0x19, 0x02a19c40 }, /* front-mic */
1533 { 0x1a, 0x01813031 }, /* line-in */
1597 * It's not quite sure whether BIOS sets the correct pin-config table
1622 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1637 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1643 {.id = ALC880_FIXUP_3ST, .name = "3stack"},
1644 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1646 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1648 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1649 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1657 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1662 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1666 spec = codec->spec; in patch_alc880()
1667 spec->gen.need_dac_fix = 1; in patch_alc880()
1668 spec->gen.beep_nid = 0x01; in patch_alc880()
1670 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1672 alc_pre_init(codec); in patch_alc880()
1674 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1676 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1679 err = alc880_parse_auto_config(codec); in patch_alc880()
1683 if (!spec->gen.no_analog) { in patch_alc880()
1689 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1694 alc_free(codec); in patch_alc880()
1702 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1706 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1726 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1728 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1730 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1733 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1736 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1741 spec->gen.automute_hook = alc260_gpio1_automute; in alc260_fixup_gpio1_toggle()
1742 spec->gen.detect_hp = 1; in alc260_fixup_gpio1_toggle()
1743 spec->gen.automute_speaker = 1; in alc260_fixup_gpio1_toggle()
1744 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ in alc260_fixup_gpio1_toggle()
1745 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1747 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1751 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1754 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1773 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1774 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_kn1()
1779 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1782 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1784 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_fsc_s7020()
1787 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1790 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1792 spec->gen.add_jack_modes = 1; in alc260_fixup_fsc_s7020_jwse()
1793 spec->gen.hp_mic = 1; in alc260_fixup_fsc_s7020_jwse()
1900 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1906 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1911 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1915 spec = codec->spec; in patch_alc260()
1920 spec->gen.prefer_hp_amp = 1; in patch_alc260()
1921 spec->gen.beep_nid = 0x01; in patch_alc260()
1923 spec->shutup = alc_eapd_shutup; in patch_alc260()
1925 alc_pre_init(codec); in patch_alc260()
1927 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1929 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1932 err = alc260_parse_auto_config(codec); in patch_alc260()
1936 if (!spec->gen.no_analog) { in patch_alc260()
1942 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1947 alc_free(codec); in patch_alc260()
1958 * 6-channel independent captures.
1960 * In addition, an independent DAC for the multi-playback (not used in this
2012 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
2017 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2021 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2024 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2026 spec->gpio_write_delay = true; in alc885_fixup_macpro_gpio()
2027 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2034 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2041 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2042 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2043 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2044 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2048 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2049 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2050 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2051 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2056 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2060 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2066 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2069 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2071 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2072 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mbp_vref()
2077 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2080 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2085 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2087 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2089 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mac_pins()
2093 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2099 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2103 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2109 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2113 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2119 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2124 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2126 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2129 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2131 spec->gen.no_primary_hp = 1; in alc882_fixup_no_primary_hp()
2132 spec->gen.no_multi_io = 1; in alc882_fixup_no_primary_hp()
2136 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2139 /* For dual-codec configuration, we need to disable some features to avoid
2142 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2145 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2150 spec->gen.suppress_vmaster = 1; in alc_fixup_dual_codecs()
2151 /* auto-mute and auto-mic switch don't work with multiple codecs */ in alc_fixup_dual_codecs()
2152 spec->gen.suppress_auto_mute = 1; in alc_fixup_dual_codecs()
2153 spec->gen.suppress_auto_mic = 1; in alc_fixup_dual_codecs()
2155 spec->gen.mixer_nid = 0; in alc_fixup_dual_codecs()
2157 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2160 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2165 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2167 snd_ctl_rename(codec->card, kctl, newname); in rename_ctl()
2170 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2174 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2178 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2181 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2182 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2183 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2184 "Rear-Panel Capture Volume" : in alc1220_fixup_gb_dual_codecs()
2185 "Front-Panel Capture Volume"); in alc1220_fixup_gb_dual_codecs()
2186 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2187 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2188 "Rear-Panel Capture Switch" : in alc1220_fixup_gb_dual_codecs()
2189 "Front-Panel Capture Switch"); in alc1220_fixup_gb_dual_codecs()
2194 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2209 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2210 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2213 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2218 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2227 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2231 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2232 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2235 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2238 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2242 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2243 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2246 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2249 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2252 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2254 if (spec->gen.hp_jack_present) in alc887_asus_hp_automute_hook()
2258 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2261 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2264 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2267 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2268 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook; in alc887_fixup_asus_jack()
2422 /* setting bits 1-5 disables DAC nids 0x02-0x06
2438 * codec replicate the sum signal to both channels,
2590 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2607 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2608 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2614 /* All Apple entries are in codec SSIDs */
2615 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2626 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2631 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2640 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2641 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2642 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2646 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2647 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2648 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2649 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2650 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2651 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2652 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2654 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2656 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2662 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2666 SND_PCI_QUIRK(0x1558, 0x66a6, "Clevo PE60SN[CDE]-[GS]", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2669 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2674 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2684 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2686 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2696 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2697 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2698 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2699 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2701 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2702 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2704 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2705 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2709 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2710 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2711 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2712 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2713 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2714 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2715 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2716 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2717 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2718 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2719 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2720 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2721 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2722 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2723 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2724 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2725 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2726 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2727 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2741 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2757 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2761 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2766 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2771 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2775 spec = codec->spec; in patch_alc882()
2777 switch (codec->core.vendor_id) { in patch_alc882()
2786 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2790 alc_pre_init(codec); in patch_alc882()
2792 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2794 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2797 alc_auto_parse_customize_define(codec); in patch_alc882()
2799 if (has_cdefine_beep(codec)) in patch_alc882()
2800 spec->gen.beep_nid = 0x01; in patch_alc882()
2803 err = alc882_parse_auto_config(codec); in patch_alc882()
2807 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc882()
2813 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2818 alc_free(codec); in patch_alc882()
2826 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2830 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2925 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2931 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2932 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2933 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2934 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2936 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2938 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2945 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2950 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2954 spec = codec->spec; in patch_alc262()
2955 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc262()
2957 spec->shutup = alc_eapd_shutup; in patch_alc262()
2961 * under-run in patch_alc262()
2963 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2965 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2967 alc_pre_init(codec); in patch_alc262()
2969 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2971 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2973 alc_auto_parse_customize_define(codec); in patch_alc262()
2975 if (has_cdefine_beep(codec)) in patch_alc262()
2976 spec->gen.beep_nid = 0x01; in patch_alc262()
2979 err = alc262_parse_auto_config(codec); in patch_alc262()
2983 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc262()
2989 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2994 alc_free(codec); in patch_alc262()
3005 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
3009 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
3010 pval = kcontrol->private_value; in alc268_beep_switch_put()
3011 kcontrol->private_value = (pval & ~0xff) | 0x0f; in alc268_beep_switch_put()
3014 kcontrol->private_value = (pval & ~0xff) | 0x10; in alc268_beep_switch_put()
3017 kcontrol->private_value = pval; in alc268_beep_switch_put()
3018 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3031 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3071 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3072 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3080 /* below is codec SSID since multiple Toshiba laptops have the
3090 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3093 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3098 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3103 /* ALC268 has no aa-loopback mixer */ in patch_alc268()
3104 err = alc_alloc_spec(codec, 0); in patch_alc268()
3108 spec = codec->spec; in patch_alc268()
3109 if (has_cdefine_beep(codec)) in patch_alc268()
3110 spec->gen.beep_nid = 0x01; in patch_alc268()
3112 spec->shutup = alc_eapd_shutup; in patch_alc268()
3114 alc_pre_init(codec); in patch_alc268()
3116 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3117 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3120 err = alc268_parse_auto_config(codec); in patch_alc268()
3124 if (err > 0 && !spec->gen.no_analog && in patch_alc268()
3125 spec->gen.autocfg.speaker_pins[0] != 0x1d) { in patch_alc268()
3127 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, in patch_alc268()
3129 err = -ENOMEM; in patch_alc268()
3133 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3134 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3136 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3143 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3148 alc_free(codec); in patch_alc268()
3164 /* different alc269-variants */
3193 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3198 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3201 switch (spec->codec_variant) { in alc269_parse_auto_config()
3233 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3244 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3249 if (jack->unsol_res & (7 << 13)) in alc_headset_btn_callback()
3252 if (jack->unsol_res & (1 << 16 | 3 << 8)) in alc_headset_btn_callback()
3256 if (jack->unsol_res & (7 << 23)) in alc_headset_btn_callback()
3260 if (jack->unsol_res & (7 << 10)) in alc_headset_btn_callback()
3263 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3266 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3268 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3270 if (!spec->has_hs_key) in alc_disable_headset_jack_key()
3273 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3281 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3282 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3283 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3290 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3291 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3296 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3298 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3300 if (!spec->has_hs_key) in alc_enable_headset_jack_key()
3303 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3311 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3312 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3313 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3320 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3321 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3326 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3329 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3334 spec->has_hs_key = 1; in alc_fixup_headset_jack()
3335 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3340 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3343 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3347 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3352 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3354 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3357 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3359 struct alc_spec *spec = codec->spec; in alc269_shutup()
3361 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_shutup()
3362 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3363 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_shutup()
3364 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3367 alc_shutup_pins(codec); in alc269_shutup()
3378 WRITE_COEF(0x0e, 0x6e00), /* LDO1/2/3, DAC/ADC */
3390 WRITE_COEF(0x69, 0x3400), /* capless control 3 */
3394 WRITE_COEF(0x6e, 0x110a), /* class D test 3 */
3403 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3405 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3408 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3410 struct alc_spec *spec = codec->spec; in alc282_init()
3415 alc282_restore_default_value(codec); in alc282_init()
3419 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3420 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3424 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3429 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3435 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3442 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3445 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3447 struct alc_spec *spec = codec->spec; in alc282_shutup()
3453 alc269_shutup(codec); in alc282_shutup()
3457 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3458 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3459 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3464 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3470 if (!spec->no_shutup_pins) in alc282_shutup()
3471 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3477 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3478 alc_shutup_pins(codec); in alc282_shutup()
3479 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3490 WRITE_COEF(0x0e, 0x6fc0), /* LDO1/2/3, DAC/ADC */
3502 WRITE_COEF(0x34, 0x3400), /* capless control 3 */
3506 WRITE_COEF(0x39, 0x110a), /* class D test 3 */
3519 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3521 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3524 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3526 struct alc_spec *spec = codec->spec; in alc283_init()
3530 alc283_restore_default_value(codec); in alc283_init()
3536 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3540 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3542 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3548 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3554 /* 3k pull low control for Headset jack. */ in alc283_init()
3555 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3557 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3560 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3562 struct alc_spec *spec = codec->spec; in alc283_shutup()
3567 alc269_shutup(codec); in alc283_shutup()
3571 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3573 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3576 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3578 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3584 if (!spec->no_shutup_pins) in alc283_shutup()
3585 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3588 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3592 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3593 alc_shutup_pins(codec); in alc283_shutup()
3594 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3597 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3599 struct alc_spec *spec = codec->spec; in alc256_init()
3603 if (spec->ultra_low_power) { in alc256_init()
3604 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3605 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3606 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3607 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3608 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3617 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3621 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3623 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3628 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3632 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3634 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3635 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3636 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3640 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of in alc256_init()
3643 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3646 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3648 struct alc_spec *spec = codec->spec; in alc256_shutup()
3655 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_shutup()
3656 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3661 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3666 /* 3k pull low control for Headset jack. */ in alc256_shutup()
3667 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3668 /* If disable 3k pulldown control for alc257, the Mic detection will not work correctly in alc256_shutup()
3669 * when booting with headset plugged. So skip setting it for the codec alc257 in alc256_shutup()
3671 if (spec->en_3kpull_low) in alc256_shutup()
3672 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3674 if (!spec->no_shutup_pins) in alc256_shutup()
3675 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3681 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3682 alc_shutup_pins(codec); in alc256_shutup()
3683 if (spec->ultra_low_power) { in alc256_shutup()
3685 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3686 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3687 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3688 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3689 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3694 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3696 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3701 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */ in alc285_hp_init()
3702 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3703 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3704 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3705 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3706 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3707 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3709 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3712 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3716 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3717 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3720 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3723 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3724 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3725 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3726 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3728 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3729 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3732 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3735 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3736 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3737 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3738 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3741 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3744 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3746 struct alc_spec *spec = codec->spec; in alc225_init()
3750 if (spec->ultra_low_power) { in alc225_init()
3751 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3752 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3753 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3757 if (spec->codec_variant != ALC269_TYPE_ALC287 && in alc225_init()
3758 spec->codec_variant != ALC269_TYPE_ALC245) in alc225_init()
3760 if (!spec->done_hp_init || in alc225_init()
3761 is_s3_resume(codec) || in alc225_init()
3762 is_s4_resume(codec)) { in alc225_init()
3763 alc285_hp_init(codec); in alc225_init()
3764 spec->done_hp_init = true; in alc225_init()
3771 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3772 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3776 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3779 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3782 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3787 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3790 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3794 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3795 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3799 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3801 struct alc_spec *spec = codec->spec; in alc225_shutup()
3808 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3809 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3812 alc_disable_headset_jack_key(codec); in alc225_shutup()
3813 /* 3k pull low control for Headset jack. */ in alc225_shutup()
3814 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3818 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3821 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3827 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3830 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3834 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3835 alc_enable_headset_jack_key(codec); in alc225_shutup()
3837 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3838 alc_shutup_pins(codec); in alc225_shutup()
3839 if (spec->ultra_low_power) { in alc225_shutup()
3841 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3842 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3843 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3844 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3849 static void alc222_init(struct hda_codec *codec) in alc222_init() argument
3851 struct alc_spec *spec = codec->spec; in alc222_init()
3860 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_init()
3861 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_init()
3867 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3870 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3875 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3878 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3885 static void alc222_shutup(struct hda_codec *codec) in alc222_shutup() argument
3887 struct alc_spec *spec = codec->spec; in alc222_shutup()
3894 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_shutup()
3895 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_shutup()
3901 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3904 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3910 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3913 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3918 alc_auto_setup_eapd(codec, false); in alc222_shutup()
3919 alc_shutup_pins(codec); in alc222_shutup()
3922 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3924 struct alc_spec *spec = codec->spec; in alc_default_init()
3933 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3938 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3943 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3949 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3951 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3956 alc269_shutup(codec); in alc_default_shutup()
3960 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3965 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3970 if (!spec->no_shutup_pins) in alc_default_shutup()
3971 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3976 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3977 alc_shutup_pins(codec); in alc_default_shutup()
3980 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3982 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3989 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3994 if (!spec->no_shutup_pins) in alc294_hp_init()
3995 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3998 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3999 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
4002 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4005 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4008 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
4012 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
4014 struct alc_spec *spec = codec->spec; in alc294_init()
4017 if (!spec->done_hp_init || in alc294_init()
4018 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
4019 alc294_hp_init(codec); in alc294_init()
4020 spec->done_hp_init = true; in alc294_init()
4022 alc_default_init(codec); in alc294_init()
4025 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
4028 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
4029 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
4030 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
4033 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
4037 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
4038 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4040 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4045 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
4049 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
4050 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
4051 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
4052 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
4053 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
4054 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
4055 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
4056 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
4057 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
4060 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
4062 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
4063 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
4064 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
4065 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
4066 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
4067 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
4070 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
4074 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4075 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
4076 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
4077 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
4078 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
4079 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
4080 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
4081 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
4082 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
4083 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
4084 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
4085 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
4086 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
4087 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
4088 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
4090 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
4091 if (val <= 3) in alc5505_dsp_init()
4092 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
4094 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
4096 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
4097 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
4098 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
4099 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
4100 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
4101 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
4102 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
4105 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4110 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
4111 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
4113 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
4114 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
4117 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
4119 struct alc_spec *spec = codec->spec; in alc269_suspend()
4121 if (spec->has_alc5505_dsp) in alc269_suspend()
4122 alc5505_dsp_suspend(codec); in alc269_suspend()
4124 return alc_suspend(codec); in alc269_suspend()
4127 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
4129 struct alc_spec *spec = codec->spec; in alc269_resume()
4131 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
4132 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
4133 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
4134 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
4138 codec->patch_ops.init(codec); in alc269_resume()
4140 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
4141 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
4142 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
4143 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
4147 snd_hda_regmap_sync(codec); in alc269_resume()
4148 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4150 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
4154 if (spec->gpio_data) in alc269_resume()
4155 alc_write_gpio_data(codec); in alc269_resume()
4157 if (spec->has_alc5505_dsp) in alc269_resume()
4158 alc5505_dsp_resume(codec); in alc269_resume()
4163 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4166 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4169 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc269_fixup_pincfg_no_hp_to_lineout()
4172 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4176 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4177 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4180 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4185 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4189 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4192 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4195 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4198 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_headset_mic()
4201 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4211 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4212 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4214 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4216 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4220 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4225 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4228 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4231 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4239 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; in alc269_fixup_pcm_44k()
4240 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; in alc269_fixup_pcm_44k()
4243 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4246 /* The digital-mic unit sends PDM (differential signal) instead of in alc269_fixup_stereo_dmic()
4252 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4255 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4257 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4259 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4260 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4263 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4266 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4269 spec->gen.automute_hook = alc269_quanta_automute; in alc269_fixup_quanta_mute()
4272 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4275 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4278 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4280 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc269_x101_hp_automute_hook()
4282 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4285 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4297 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4301 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4302 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4305 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4307 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4308 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4309 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4311 if (initval->value_0x23 != 0x1e) in alc298_huawei_mbx_stereo_seq()
4312 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4314 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4315 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4318 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4342 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4343 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4344 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4345 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4346 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4347 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4348 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4349 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4351 for (seq = dac_init; seq->value_0x23; seq++) in alc298_fixup_huawei_mbx_stereo()
4352 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4355 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4358 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4360 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_x101_headset_mic()
4361 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook; in alc269_fixup_x101_headset_mic()
4365 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4374 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4378 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4379 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4380 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4383 /* update mute-LED according to the speaker mute state via mic VREF pin */
4387 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4388 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4390 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4391 spec->mute_led_polarity, brightness); in vref_mute_led_set()
4396 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4400 struct alc_spec *spec = codec->spec; in led_power_filter()
4403 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid)) in led_power_filter()
4407 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4408 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4410 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4413 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4416 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4424 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) in alc269_fixup_hp_mute_led()
4428 spec->mute_led_polarity = pol; in alc269_fixup_hp_mute_led()
4429 spec->mute_led_nid = pin - 0x0a + 0x18; in alc269_fixup_hp_mute_led()
4430 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4431 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4432 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4433 "Detected mute LED for %x:%d\n", spec->mute_led_nid, in alc269_fixup_hp_mute_led()
4434 spec->mute_led_polarity); in alc269_fixup_hp_mute_led()
4439 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4443 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4446 spec->mute_led_polarity = 0; in alc269_fixup_hp_mute_led_micx()
4447 spec->mute_led_nid = pin; in alc269_fixup_hp_mute_led_micx()
4448 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4449 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4453 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4456 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4459 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4462 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4465 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4468 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4472 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4477 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4484 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4485 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4487 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4488 spec->mute_led_polarity, !brightness); in gpio_mute_led_set()
4492 /* turn on/off mic-mute LED via GPIO per capture hook */
4496 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4497 struct alc_spec *spec = codec->spec; in micmute_led_set()
4499 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4500 spec->micmute_led_polarity, !brightness); in micmute_led_set()
4504 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4505 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4510 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4512 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4517 spec->gpio_mute_led_mask = mute_mask; in alc_fixup_hp_gpio_led()
4518 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4521 spec->gpio_mic_led_mask = micmute_mask; in alc_fixup_hp_gpio_led()
4522 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4526 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4529 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4532 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4535 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4538 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4541 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4544 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4547 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4550 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4553 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4556 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4559 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4562 spec->micmute_led_polarity = 1; in alc245_fixup_hp_gpio_led()
4563 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4566 /* turn on/off mic-mute LED per capture hook via VREF change */
4570 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4571 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4573 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4574 spec->micmute_led_polarity, brightness); in vref_micmute_led_set()
4578 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4581 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4583 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4588 spec->gpio_mask |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4589 spec->gpio_dir |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4590 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_gpio_mic1_led()
4591 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4592 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4596 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4599 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4601 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4603 spec->cap_mute_led_nid = 0x18; in alc280_fixup_hp_gpio4()
4604 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4605 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4612 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4615 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4619 spec->gpio_mask |= 0x01; in alc245_fixup_hp_x360_amp()
4620 spec->gpio_dir |= 0x01; in alc245_fixup_hp_x360_amp()
4624 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4626 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4633 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4639 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4642 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4647 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4651 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4654 spec->gpio_mask |= 0x04; in alc274_fixup_hp_envy_gpio()
4655 spec->gpio_dir |= 0x04; in alc274_fixup_hp_envy_gpio()
4656 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook; in alc274_fixup_hp_envy_gpio()
4660 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4667 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4668 on ? led->on : led->off); in alc_update_coef_led()
4671 /* update mute-LED according to the speaker mute state via COEF bit */
4675 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4676 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4678 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4679 spec->mute_led_polarity, brightness); in coef_mute_led_set()
4683 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4687 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4690 spec->mute_led_polarity = 0; in alc285_fixup_hp_mute_led_coefbit()
4691 spec->mute_led_coef.idx = 0x0b; in alc285_fixup_hp_mute_led_coefbit()
4692 spec->mute_led_coef.mask = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4693 spec->mute_led_coef.on = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4694 spec->mute_led_coef.off = 0; in alc285_fixup_hp_mute_led_coefbit()
4695 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4699 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4703 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4706 spec->mute_led_polarity = 0; in alc236_fixup_hp_mute_led_coefbit()
4707 spec->mute_led_coef.idx = 0x34; in alc236_fixup_hp_mute_led_coefbit()
4708 spec->mute_led_coef.mask = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4709 spec->mute_led_coef.on = 0; in alc236_fixup_hp_mute_led_coefbit()
4710 spec->mute_led_coef.off = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4711 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4715 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit2() argument
4718 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit2()
4721 spec->mute_led_polarity = 0; in alc236_fixup_hp_mute_led_coefbit2()
4722 spec->mute_led_coef.idx = 0x07; in alc236_fixup_hp_mute_led_coefbit2()
4723 spec->mute_led_coef.mask = 1; in alc236_fixup_hp_mute_led_coefbit2()
4724 spec->mute_led_coef.on = 1; in alc236_fixup_hp_mute_led_coefbit2()
4725 spec->mute_led_coef.off = 0; in alc236_fixup_hp_mute_led_coefbit2()
4726 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit2()
4730 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_coefbit() argument
4734 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_coefbit()
4737 spec->mute_led_polarity = 0; in alc245_fixup_hp_mute_led_coefbit()
4738 spec->mute_led_coef.idx = 0x0b; in alc245_fixup_hp_mute_led_coefbit()
4739 spec->mute_led_coef.mask = 3 << 2; in alc245_fixup_hp_mute_led_coefbit()
4740 spec->mute_led_coef.on = 2 << 2; in alc245_fixup_hp_mute_led_coefbit()
4741 spec->mute_led_coef.off = 1 << 2; in alc245_fixup_hp_mute_led_coefbit()
4742 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_coefbit()
4746 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_v1_coefbit() argument
4750 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_v1_coefbit()
4753 spec->mute_led_polarity = 0; in alc245_fixup_hp_mute_led_v1_coefbit()
4754 spec->mute_led_coef.idx = 0x0b; in alc245_fixup_hp_mute_led_v1_coefbit()
4755 spec->mute_led_coef.mask = 1 << 3; in alc245_fixup_hp_mute_led_v1_coefbit()
4756 spec->mute_led_coef.on = 1 << 3; in alc245_fixup_hp_mute_led_v1_coefbit()
4757 spec->mute_led_coef.off = 0; in alc245_fixup_hp_mute_led_v1_coefbit()
4758 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_v1_coefbit()
4762 /* turn on/off mic-mute LED per capture hook by coef bit */
4766 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4767 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4769 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4770 spec->micmute_led_polarity, brightness); in coef_micmute_led_set()
4774 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4777 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4780 spec->mic_led_coef.idx = 0x19; in alc285_fixup_hp_coef_micmute_led()
4781 spec->mic_led_coef.mask = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4782 spec->mic_led_coef.on = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4783 spec->mic_led_coef.off = 0; in alc285_fixup_hp_coef_micmute_led()
4784 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4788 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_micmute_led() argument
4791 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_gpio_micmute_led()
4794 spec->micmute_led_polarity = 1; in alc285_fixup_hp_gpio_micmute_led()
4795 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc285_fixup_hp_gpio_micmute_led()
4798 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4801 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4804 spec->mic_led_coef.idx = 0x35; in alc236_fixup_hp_coef_micmute_led()
4805 spec->mic_led_coef.mask = 3 << 2; in alc236_fixup_hp_coef_micmute_led()
4806 spec->mic_led_coef.on = 2 << 2; in alc236_fixup_hp_coef_micmute_led()
4807 spec->mic_led_coef.off = 1 << 2; in alc236_fixup_hp_coef_micmute_led()
4808 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4812 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec, in alc295_fixup_hp_mute_led_coefbit11() argument
4815 struct alc_spec *spec = codec->spec; in alc295_fixup_hp_mute_led_coefbit11()
4818 spec->mute_led_polarity = 0; in alc295_fixup_hp_mute_led_coefbit11()
4819 spec->mute_led_coef.idx = 0xb; in alc295_fixup_hp_mute_led_coefbit11()
4820 spec->mute_led_coef.mask = 3 << 3; in alc295_fixup_hp_mute_led_coefbit11()
4821 spec->mute_led_coef.on = 1 << 3; in alc295_fixup_hp_mute_led_coefbit11()
4822 spec->mute_led_coef.off = 1 << 4; in alc295_fixup_hp_mute_led_coefbit11()
4823 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc295_fixup_hp_mute_led_coefbit11()
4827 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4830 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4831 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4834 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_mute_led() argument
4837 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4838 alc285_fixup_hp_gpio_micmute_led(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4841 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4844 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4845 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4848 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4851 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4854 spec->cap_mute_led_nid = 0x1a; in alc236_fixup_hp_micmute_led_vref()
4855 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4856 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4860 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4863 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4864 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4867 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4870 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4871 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4872 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4880 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4899 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4902 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4905 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4949 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec) in alc298_samsung_v2_enable_amps() argument
4951 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_enable_amps()
4957 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_enable_amps()
4958 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_enable_amps()
4960 alc298_samsung_write_coef_pack(codec, enable_seq[j]); in alc298_samsung_v2_enable_amps()
4961 codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n", in alc298_samsung_v2_enable_amps()
4966 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec) in alc298_samsung_v2_disable_amps() argument
4968 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_disable_amps()
4974 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_disable_amps()
4975 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_disable_amps()
4977 alc298_samsung_write_coef_pack(codec, disable_seq[j]); in alc298_samsung_v2_disable_amps()
4978 codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n", in alc298_samsung_v2_disable_amps()
4984 struct hda_codec *codec, in alc298_samsung_v2_playback_hook() argument
4990 alc298_samsung_v2_enable_amps(codec); in alc298_samsung_v2_playback_hook()
4992 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_playback_hook()
4995 static void alc298_samsung_v2_init_amps(struct hda_codec *codec, in alc298_samsung_v2_init_amps() argument
4998 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_init_amps()
5002 spec->num_speaker_amps = num_speaker_amps; in alc298_samsung_v2_init_amps()
5005 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_init_amps()
5008 for (i = 0; i < spec->num_speaker_amps; i++) { in alc298_samsung_v2_init_amps()
5009 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_init_amps()
5011 alc298_samsung_write_coef_pack(codec, in alc298_samsung_v2_init_amps()
5014 alc_write_coef_idx(codec, 0x89, 0x0); in alc298_samsung_v2_init_amps()
5015 codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n", in alc298_samsung_v2_init_amps()
5020 spec->gen.pcm_playback_hook = alc298_samsung_v2_playback_hook; in alc298_samsung_v2_init_amps()
5023 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_2_amps() argument
5027 alc298_samsung_v2_init_amps(codec, 2); in alc298_fixup_samsung_amp_v2_2_amps()
5030 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_4_amps() argument
5034 alc298_samsung_v2_init_amps(codec, 4); in alc298_fixup_samsung_amp_v2_4_amps()
5037 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
5040 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
5044 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1); in gpio2_mic_hotkey_event()
5045 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
5046 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0); in gpio2_mic_hotkey_event()
5047 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
5050 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
5052 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
5055 spec->kb_dev = input_allocate_device(); in alc_register_micmute_input_device()
5056 if (!spec->kb_dev) { in alc_register_micmute_input_device()
5057 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
5058 return -ENOMEM; in alc_register_micmute_input_device()
5061 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE; in alc_register_micmute_input_device()
5063 spec->kb_dev->name = "Microphone Mute Button"; in alc_register_micmute_input_device()
5064 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY); in alc_register_micmute_input_device()
5065 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]); in alc_register_micmute_input_device()
5066 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map); in alc_register_micmute_input_device()
5067 spec->kb_dev->keycode = spec->alc_mute_keycode_map; in alc_register_micmute_input_device()
5068 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++) in alc_register_micmute_input_device()
5069 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit); in alc_register_micmute_input_device()
5071 if (input_register_device(spec->kb_dev)) { in alc_register_micmute_input_device()
5072 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
5073 input_free_device(spec->kb_dev); in alc_register_micmute_input_device()
5074 spec->kb_dev = NULL; in alc_register_micmute_input_device()
5075 return -ENOMEM; in alc_register_micmute_input_device()
5086 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
5089 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
5091 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
5093 spec->init_amp = ALC_INIT_DEFAULT; in alc280_fixup_hp_gpio2_mic_hotkey()
5094 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
5097 spec->gpio_mask |= 0x06; in alc280_fixup_hp_gpio2_mic_hotkey()
5098 spec->gpio_dir |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
5099 spec->gpio_data |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
5100 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
5102 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
5107 if (!spec->kb_dev) in alc280_fixup_hp_gpio2_mic_hotkey()
5112 input_unregister_device(spec->kb_dev); in alc280_fixup_hp_gpio2_mic_hotkey()
5113 spec->kb_dev = NULL; in alc280_fixup_hp_gpio2_mic_hotkey()
5120 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
5123 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
5125 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
5127 spec->init_amp = ALC_INIT_DEFAULT; in alc233_fixup_lenovo_line2_mic_hotkey()
5128 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
5131 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
5136 if (!spec->kb_dev) in alc233_fixup_lenovo_line2_mic_hotkey()
5141 input_unregister_device(spec->kb_dev); in alc233_fixup_lenovo_line2_mic_hotkey()
5142 spec->kb_dev = NULL; in alc233_fixup_lenovo_line2_mic_hotkey()
5146 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
5149 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
5151 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
5153 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_line1_mic1_led()
5154 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
5158 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec, in alc233_fixup_lenovo_low_en_micmute_led() argument
5161 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_low_en_micmute_led()
5164 spec->micmute_led_polarity = 1; in alc233_fixup_lenovo_low_en_micmute_led()
5165 alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action); in alc233_fixup_lenovo_low_en_micmute_led()
5168 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay) in alc_hp_mute_disable() argument
5172 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5175 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5180 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay) in alc_hp_enable_unmute() argument
5184 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5187 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5195 UPDATE_COEF(0x63, 3<<14, 3<<14),
5196 UPDATE_COEF(0x4a, 3<<4, 2<<4),
5197 UPDATE_COEF(0x4a, 3<<10, 3<<10),
5199 UPDATE_COEF(0x4a, 3<<10, 0),
5203 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
5205 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
5255 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */ in alc_headset_mode_unplugged()
5266 UPDATE_COEF(0x63, 3<<14, 0), in alc_headset_mode_unplugged()
5280 if (spec->no_internal_mic_pin) { in alc_headset_mode_unplugged()
5281 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
5285 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
5287 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
5293 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5294 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
5299 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
5303 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
5307 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5310 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
5311 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5314 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
5317 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
5320 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
5328 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5329 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
5330 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
5333 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
5336 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
5340 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5378 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_mic_in()
5389 UPDATE_COEF(0x4a, 3<<4, 2<<4), in alc_headset_mode_mic_in()
5390 UPDATE_COEF(0x63, 3<<14, 0), in alc_headset_mode_mic_in()
5400 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5402 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5403 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5404 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5405 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5411 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5412 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5413 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5414 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5419 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5420 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5421 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5422 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5426 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5427 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5428 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5429 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5434 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5435 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5436 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5439 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5440 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5444 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5445 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5446 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5447 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5450 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5454 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5455 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5458 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5459 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5460 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5461 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5469 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5470 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5471 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5472 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5473 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5476 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5479 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5484 UPDATE_COEF(0x49, 3<<8, 0<<8), in alc_headset_mode_default()
5485 UPDATE_COEF(0x4a, 3<<4, 3<<4), in alc_headset_mode_default()
5486 UPDATE_COEF(0x63, 3<<14, 0), in alc_headset_mode_default()
5528 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_default()
5545 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5552 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5553 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5554 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5557 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5563 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5564 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5566 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5567 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5572 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5576 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5581 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5584 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5587 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5590 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5593 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5596 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5600 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5647 UPDATE_COEF(0x63, 3<<14, 2<<14), in alc_headset_mode_ctia()
5652 UPDATE_COEF(0x63, 3<<14, 1<<14), in alc_headset_mode_ctia()
5656 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5658 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5664 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5665 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5670 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5674 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5677 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5679 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5680 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5683 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5684 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5690 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5692 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5695 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5698 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5701 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5709 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5711 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5713 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5714 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5717 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5720 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5724 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5769 UPDATE_COEF(0x63, 3<<14, 2<<14), in alc_headset_mode_omtp()
5773 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5775 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5781 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5782 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5787 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5791 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5794 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5795 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5800 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5802 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5805 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5808 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5811 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5819 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5820 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5823 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5826 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5830 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5869 if (spec->no_internal_mic_pin) { in alc_determine_headset_type()
5870 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5874 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5876 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5878 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5885 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5886 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5887 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5889 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5891 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5894 alc_write_coef_idx(codec, 0x45, 0xe089); in alc_determine_headset_type()
5896 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5902 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5903 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5908 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5910 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5915 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5917 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5921 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5924 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5928 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5930 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5931 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5933 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5936 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5937 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5939 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5942 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5943 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5946 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5951 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5953 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5957 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5959 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5963 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5965 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5969 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5971 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5980 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5981 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5982 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5984 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5985 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5987 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5990 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5991 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5993 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5997 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10); in alc_determine_headset_type()
5998 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
6000 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
6006 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
6007 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
6008 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
6015 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
6017 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP; in alc_determine_headset_type()
6020 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
6022 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
6024 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in alc_update_headset_mode()
6029 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
6031 else if (mux_pin == spec->headset_mic_pin) in alc_update_headset_mode()
6033 else if (mux_pin == spec->headphone_mic_pin) in alc_update_headset_mode()
6038 if (new_headset_mode == spec->current_headset_mode) { in alc_update_headset_mode()
6039 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6045 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
6046 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_update_headset_mode()
6047 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_update_headset_mode()
6048 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
6051 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) in alc_update_headset_mode()
6052 alc_determine_headset_type(codec); in alc_update_headset_mode()
6053 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) in alc_update_headset_mode()
6054 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
6055 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) in alc_update_headset_mode()
6056 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
6057 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
6060 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
6061 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
6064 alc_headset_mode_default(codec); in alc_update_headset_mode()
6065 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
6069 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
6071 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin) in alc_update_headset_mode()
6072 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
6075 spec->current_headset_mode = new_headset_mode; in alc_update_headset_mode()
6077 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6080 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
6084 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
6087 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
6090 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
6091 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
6094 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
6097 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
6098 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_probe_headset_mode()
6101 for (i = 0; i < cfg->num_inputs; i++) { in alc_probe_headset_mode()
6102 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin) in alc_probe_headset_mode()
6103 spec->headset_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
6104 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin) in alc_probe_headset_mode()
6105 spec->headphone_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
6108 WARN_ON(spec->gen.cap_sync_hook); in alc_probe_headset_mode()
6109 spec->gen.cap_sync_hook = alc_update_headset_mode_hook; in alc_probe_headset_mode()
6110 spec->gen.automute_hook = alc_update_headset_mode; in alc_probe_headset_mode()
6111 spec->gen.hp_automute_hook = alc_update_headset_jack_cb; in alc_probe_headset_mode()
6114 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
6117 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
6121 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC; in alc_fixup_headset_mode()
6124 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
6127 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
6128 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_fixup_headset_mode()
6129 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_fixup_headset_mode()
6131 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
6136 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
6140 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
6141 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_no_hp_mic()
6144 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
6147 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
6166 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
6168 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
6174 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
6180 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
6184 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
6186 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
6189 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
6193 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
6194 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc255_no_hp_mic()
6195 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
6198 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
6201 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
6204 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
6206 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
6208 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
6211 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
6214 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
6216 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
6218 spec->gpio_mask |= 0x40; in alc_fixup_headset_mode_dell_alc288()
6219 spec->gpio_dir |= 0x40; in alc_fixup_headset_mode_dell_alc288()
6220 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb; in alc_fixup_headset_mode_dell_alc288()
6224 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
6228 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
6229 spec->gen.auto_mute_via_amp = 1; in alc_fixup_auto_mute_via_amp()
6233 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
6237 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
6238 spec->no_shutup_pins = 1; in alc_fixup_no_shutup()
6242 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
6246 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
6247 /* Disable AA-loopback as it causes white noise */ in alc_fixup_disable_aamix()
6248 spec->gen.mixer_nid = 0; in alc_fixup_disable_aamix()
6253 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
6261 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
6264 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt440_dock()
6265 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
6266 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
6270 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
6278 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
6281 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt470_dock()
6282 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
6285 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
6288 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
6293 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
6298 * ALC298 codec in alc_fixup_tpt470_dacs()
6304 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
6307 spec->gen.preferred_dacs = preferred_pairs; in alc_fixup_tpt470_dacs()
6310 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
6316 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
6319 spec->gen.preferred_dacs = preferred_pairs; in alc295_fixup_asus_dacs()
6322 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
6324 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
6328 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
6333 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
6336 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
6337 struct hda_input_mux *imux = &spec->gen.input_mux; in alc_fixup_dell_xps13()
6342 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise in alc_fixup_dell_xps13()
6345 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6346 spec->shutup = alc_shutup_dell_xps13; in alc_fixup_dell_xps13()
6350 for (i = 0; i < imux->num_items; i++) { in alc_fixup_dell_xps13()
6351 if (spec->gen.imux_pins[i] == 0x12) { in alc_fixup_dell_xps13()
6352 spec->gen.cur_mux[0] = i; in alc_fixup_dell_xps13()
6360 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6363 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6366 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc662()
6367 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ in alc_fixup_headset_mode_alc662()
6369 /* Disable boost for mic-in permanently. (This code is only called in alc_fixup_headset_mode_alc662()
6371 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6372 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6374 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6377 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6381 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6382 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6383 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6385 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6389 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6391 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6392 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in find_ext_mic_pin()
6397 for (i = 0; i < cfg->num_inputs; i++) { in find_ext_mic_pin()
6398 if (cfg->inputs[i].type != AUTO_PIN_MIC) in find_ext_mic_pin()
6400 nid = cfg->inputs[i].pin; in find_ext_mic_pin()
6401 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6410 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6414 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6417 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6422 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6426 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6430 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6431 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc269_fixup_limit_int_mic_boost()
6434 /* The mic boosts on level 2 and 3 are too noisy in alc269_fixup_limit_int_mic_boost()
6441 for (i = 0; i < cfg->num_inputs; i++) { in alc269_fixup_limit_int_mic_boost()
6442 hda_nid_t nid = cfg->inputs[i].pin; in alc269_fixup_limit_int_mic_boost()
6444 if (cfg->inputs[i].type != AUTO_PIN_MIC) in alc269_fixup_limit_int_mic_boost()
6446 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6450 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6458 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6461 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6465 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6467 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc283_hp_automute_hook()
6470 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6474 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6477 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6481 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6482 /* Disable AA-loopback as it causes white noise */ in alc283_fixup_chromebook()
6483 spec->gen.mixer_nid = 0; in alc283_fixup_chromebook()
6486 /* MIC2-VREF control */ in alc283_fixup_chromebook()
6488 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6490 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6495 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6498 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6502 spec->gen.hp_automute_hook = alc283_hp_automute_hook; in alc283_fixup_sense_combo_jack()
6505 /* MIC2-VREF control */ in alc283_fixup_sense_combo_jack()
6507 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6513 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6515 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6516 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6517 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6518 spec->gen.mute_bits |= (1ULL << 0x14); in asus_tx300_automute()
6521 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6524 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6532 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6534 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6535 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6536 spec->gen.auto_mute_via_amp = 1; in alc282_fixup_asus_tx300()
6537 spec->gen.automute_hook = asus_tx300_automute; in alc282_fixup_asus_tx300()
6538 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6542 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6548 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6550 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6556 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6564 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6565 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6569 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6575 Amp-out capability. we change the speaker's route to: in alc298_fixup_speaker_volume()
6576 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 ( in alc298_fixup_speaker_volume()
6577 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust in alc298_fixup_speaker_volume()
6581 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6586 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6591 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6596 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6601 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6605 /* disable DAC3 (0x06) selection on NID 0x15 - share Speaker/Bass Speaker DAC 0x03 */
6606 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec, in alc294_fixup_bass_speaker_15() argument
6611 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc294_fixup_bass_speaker_15()
6616 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6619 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6621 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6623 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6624 !spec->gen.hp_jack_present); in alc280_hp_gpio4_automute_hook()
6633 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6637 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6639 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6642 spec->gpio_mask |= 0x10; in alc280_fixup_hp_9480m()
6643 spec->gpio_dir |= 0x10; in alc280_fixup_hp_9480m()
6644 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; in alc280_fixup_hp_9480m()
6648 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6652 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6655 spec->gpio_mask |= 0x04; in alc275_fixup_gpio4_off()
6656 spec->gpio_dir |= 0x04; in alc275_fixup_gpio4_off()
6663 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6664 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6665 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6667 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6674 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6678 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6679 spec->gen.preferred_dacs = preferred_pairs; in alc285_fixup_thinkpad_x1_gen7()
6688 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6689 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6694 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6698 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6702 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6705 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
6706 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6707 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6708 "Rear-Panel Capture Volume" : in alc233_alc662_fixup_lenovo_dual_codecs()
6709 "Front-Panel Capture Volume"); in alc233_alc662_fixup_lenovo_dual_codecs()
6710 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6711 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6712 "Rear-Panel Capture Switch" : in alc233_alc662_fixup_lenovo_dual_codecs()
6713 "Front-Panel Capture Switch"); in alc233_alc662_fixup_lenovo_dual_codecs()
6718 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6724 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6728 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6731 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6740 spec->gen.preferred_dacs = preferred_pairs; in alc274_fixup_bind_dacs()
6741 spec->gen.auto_mute_via_amp = 1; in alc274_fixup_bind_dacs()
6742 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6746 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6752 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6755 spec->gen.preferred_dacs = preferred_pairs; in alc289_fixup_asus_ga401()
6759 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6765 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6768 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6770 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6776 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6777 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6786 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6787 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6792 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6795 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6799 spec->ultra_low_power = true; in alc295_fixup_chromebook()
6802 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6807 static void alc256_fixup_chromebook(struct hda_codec *codec, in alc256_fixup_chromebook() argument
6810 struct alc_spec *spec = codec->spec; in alc256_fixup_chromebook()
6814 spec->gen.suppress_auto_mute = 1; in alc256_fixup_chromebook()
6815 spec->gen.suppress_auto_mic = 1; in alc256_fixup_chromebook()
6816 spec->en_3kpull_low = false; in alc256_fixup_chromebook()
6821 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6825 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6829 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6832 /* The Windows driver sets the codec up in a very different way where in alc294_gx502_toggle_output()
6835 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6836 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6838 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6841 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6845 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6850 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6857 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6862 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6868 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6869 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6871 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6874 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6877 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6882 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6886 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6891 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6898 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6901 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6906 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6911 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6914 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6919 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6920 spec->no_internal_mic_pin = true; in alc_fixup_no_int_mic()
6923 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6931 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6936 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6944 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6948 spec->micmute_led_polarity = 1; in alc285_fixup_hp_spectre_x360_eb1()
6950 spec->gpio_mask |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6951 spec->gpio_dir |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6952 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6954 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6955 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6959 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6961 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6966 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6977 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6979 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6984 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec, in alc285_fixup_hp_envy_x360() argument
7010 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_envy_x360()
7013 alc295_fixup_disable_dac3(codec, fix, action); in alc285_fixup_hp_envy_x360()
7016 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0); in alc285_fixup_hp_envy_x360()
7018 /* Auto-enable headset mic when plugged */ in alc285_fixup_hp_envy_x360()
7019 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21); in alc285_fixup_hp_envy_x360()
7022 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50); in alc285_fixup_hp_envy_x360()
7025 alc_process_coef_fw(codec, coefs); in alc285_fixup_hp_envy_x360()
7028 rename_ctl(codec, "Bass Speaker Playback Volume", in alc285_fixup_hp_envy_x360()
7029 "B&O-Tuned Playback Volume"); in alc285_fixup_hp_envy_x360()
7030 rename_ctl(codec, "Front Playback Switch", in alc285_fixup_hp_envy_x360()
7032 rename_ctl(codec, "Bass Speaker Playback Switch", in alc285_fixup_hp_envy_x360()
7038 static void alc285_fixup_hp_beep(struct hda_codec *codec, in alc285_fixup_hp_beep() argument
7042 codec->beep_just_power_on = true; in alc285_fixup_hp_beep()
7050 alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13)); in alc285_fixup_hp_beep()
7052 snd_hda_enable_beep_device(codec, 1); in alc285_fixup_hp_beep()
7055 dev_warn_once(hda_codec_dev(codec), in alc285_fixup_hp_beep()
7065 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
7068 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
7069 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
7075 static void alc_fixup_ideapad_acpi(struct hda_codec *codec, in alc_fixup_ideapad_acpi() argument
7078 hda_fixup_ideapad_acpi(codec, fix, action); in alc_fixup_ideapad_acpi()
7082 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
7086 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
7090 spec->gen.suppress_auto_mute = 1; in alc287_fixup_legion_15imhg05_speakers()
7098 struct alc_spec *spec = cdc->spec; in comp_acpi_device_notify()
7102 hda_component_acpi_device_notify(&spec->comps, handle, event, data); in comp_acpi_device_notify()
7108 struct alc_spec *spec = cdc->spec; in comp_bind()
7111 ret = hda_component_manager_bind(cdc, &spec->comps); in comp_bind()
7116 &spec->comps, in comp_bind()
7123 struct alc_spec *spec = cdc->spec; in comp_unbind()
7125 hda_component_manager_unbind_acpi_notifications(cdc, &spec->comps, comp_acpi_device_notify); in comp_unbind()
7126 hda_component_manager_unbind(cdc, &spec->comps); in comp_unbind()
7137 struct alc_spec *spec = cdc->spec; in comp_generic_playback_hook()
7139 hda_component_manager_playback_hook(&spec->comps, action); in comp_generic_playback_hook()
7145 struct alc_spec *spec = cdc->spec; in comp_generic_fixup()
7150 ret = hda_component_manager_init(cdc, &spec->comps, count, bus, hid, in comp_generic_fixup()
7155 spec->gen.pcm_playback_hook = comp_generic_playback_hook; in comp_generic_fixup()
7158 hda_component_manager_free(&spec->comps, &comp_master_ops); in comp_generic_fixup()
7172 } acpi_ids[] = {{ "CSC3554", "cs35l54-hda" }, in find_cirrus_companion_amps()
7173 { "CSC3556", "cs35l56-hda" }, in find_cirrus_companion_amps()
7174 { "CSC3557", "cs35l57-hda" }}; in find_cirrus_companion_amps()
7179 adev = acpi_dev_get_first_match_dev(acpi_ids[i].hid, NULL, -1); in find_cirrus_companion_amps()
7211 * When available the cirrus,dev-index property is an accurate in find_cirrus_companion_amps()
7216 count_devindex = fwnode_property_count_u32(fwnode, "cirrus,dev-index"); in find_cirrus_companion_amps()
7220 match = devm_kasprintf(dev, GFP_KERNEL, "-%%s:00-%s.%%d", acpi_ids[i].name); in find_cirrus_companion_amps()
7229 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 2); in cs35l41_fixup_i2c_two()
7234 comp_generic_fixup(cdc, action, "i2c", "CSC3551", "-%s:00-cs35l41-hda.%d", 4); in cs35l41_fixup_i2c_four()
7237 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_two() argument
7239 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2); in cs35l41_fixup_spi_two()
7242 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_four() argument
7244 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4); in cs35l41_fixup_spi_four()
7250 comp_generic_fixup(cdc, action, "i2c", "CLSA0100", "-%s:00-cs35l41-hda.%d", 2); in alc287_fixup_legion_16achg6_speakers()
7256 comp_generic_fixup(cdc, action, "i2c", "CLSA0101", "-%s:00-cs35l41-hda.%d", 2); in alc287_fixup_legion_16ithg6_speakers()
7262 * The same SSID has been re-used in different hardware, they have in alc285_fixup_asus_ga403u()
7265 if (cdc->core.vendor_id != 0x10ec0285) in alc285_fixup_asus_ga403u()
7272 comp_generic_fixup(cdc, action, "i2c", "TIAS2781", "-%s:00", 1); in tas2781_fixup_i2c()
7277 comp_generic_fixup(cdc, action, "spi", "TXNW2781", "-%s:00-tas2781-hda.%d", 2); in tas2781_fixup_spi()
7283 comp_generic_fixup(cdc, action, "i2c", "INT8866", "-%s:00", 1); in yoga7_14arb7_fixup_i2c()
7286 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec, in alc256_fixup_acer_sfg16_micmute_led() argument
7289 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc256_fixup_acer_sfg16_micmute_led()
7306 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
7315 * plugged-in state, while the internal microphone is always in an in alc256_fixup_set_coef_defaults()
7318 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
7328 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
7339 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
7342 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
7347 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, in alc256_fixup_mic_no_presence_and_resume()
7348 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec in alc256_fixup_mic_no_presence_and_resume()
7351 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
7352 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
7353 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
7355 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
7359 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec, in alc256_decrease_headphone_amp_val() argument
7368 caps = query_amp_caps(codec, 0x3, HDA_OUTPUT); in alc256_decrease_headphone_amp_val()
7369 nsteps = ((caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT) - 10; in alc256_decrease_headphone_amp_val()
7370 offs = ((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT) - 10; in alc256_decrease_headphone_amp_val()
7374 if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps)) in alc256_decrease_headphone_amp_val()
7375 codec_warn(codec, "failed to override amp caps for NID 0x3\n"); in alc256_decrease_headphone_amp_val()
7378 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, in alc_fixup_dell4_mic_no_presence_quiet() argument
7382 struct alc_spec *spec = codec->spec; in alc_fixup_dell4_mic_no_presence_quiet()
7383 struct hda_input_mux *imux = &spec->gen.input_mux; in alc_fixup_dell4_mic_no_presence_quiet()
7386 alc269_fixup_limit_int_mic_boost(codec, fix, action); in alc_fixup_dell4_mic_no_presence_quiet()
7392 * to Hi-Z to avoid pop noises at startup and when plugging and in alc_fixup_dell4_mic_no_presence_quiet()
7395 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7396 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7403 for (i = 0; i < imux->num_items; i++) { in alc_fixup_dell4_mic_no_presence_quiet()
7404 if (spec->gen.imux_pins[i] == 0x12) { in alc_fixup_dell4_mic_no_presence_quiet()
7405 spec->gen.cur_mux[0] = i; in alc_fixup_dell4_mic_no_presence_quiet()
7413 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, in alc287_fixup_yoga9_14iap7_bass_spk_pin() argument
7439 struct alc_spec *spec = codec->spec; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7443 snd_hda_apply_pincfgs(codec, pincfgs); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7444 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7445 spec->gen.preferred_dacs = preferred_pairs; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7450 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec, in alc295_fixup_dell_inspiron_top_speakers() argument
7465 struct alc_spec *spec = codec->spec; in alc295_fixup_dell_inspiron_top_speakers()
7467 alc_fixup_no_shutup(codec, fix, action); in alc295_fixup_dell_inspiron_top_speakers()
7471 snd_hda_apply_pincfgs(codec, pincfgs); in alc295_fixup_dell_inspiron_top_speakers()
7472 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_dell_inspiron_top_speakers()
7473 spec->gen.preferred_dacs = preferred_pairs; in alc295_fixup_dell_inspiron_top_speakers()
7479 static void alc287_fixup_bind_dacs(struct hda_codec *codec, in alc287_fixup_bind_dacs() argument
7482 struct alc_spec *spec = codec->spec; in alc287_fixup_bind_dacs()
7491 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_bind_dacs()
7492 spec->gen.preferred_dacs = preferred_pairs; in alc287_fixup_bind_dacs()
7493 spec->gen.auto_mute_via_amp = 1; in alc287_fixup_bind_dacs()
7494 if (spec->gen.autocfg.speaker_pins[0] != 0x14) { in alc287_fixup_bind_dacs()
7495 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc287_fixup_bind_dacs()
7500 static void alc_fixup_headset_mic(struct hda_codec *codec, in alc_fixup_headset_mic() argument
7503 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mic()
7511 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_headset_mic()
7512 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_headset_mic()
7513 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mic()
7518 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_eu0xxx() argument
7540 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_eu0xxx()
7541 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_eu0xxx()
7545 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7546 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7547 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7551 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_16_aa0xxx() argument
7560 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7575 spec->gpio_mask |= 0x01; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7576 spec->gpio_dir |= 0x01; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7577 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7578 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7582 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7584 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7588 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7589 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7590 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7593 static void alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec *codec, in alc245_fixup_hp_zbook_firefly_g12a() argument
7596 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_zbook_firefly_g12a()
7601 spec->gen.auto_mute_via_amp = 1; in alc245_fixup_hp_zbook_firefly_g12a()
7602 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_zbook_firefly_g12a()
7606 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7607 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7608 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7615 struct hda_codec *codec, in alc287_alc1318_playback_pcm_hook() argument
7621 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */ in alc287_alc1318_playback_pcm_hook()
7624 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_alc1318_playback_pcm_hook()
7629 static void alc287_s4_power_gpio3_default(struct hda_codec *codec) in alc287_s4_power_gpio3_default() argument
7631 if (is_s4_suspend(codec)) { in alc287_s4_power_gpio3_default()
7632 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_s4_power_gpio3_default()
7636 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, in alc287_fixup_lenovo_thinkpad_with_alc1318() argument
7639 struct alc_spec *spec = codec->spec; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7649 alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7650 alc_process_coef_fw(codec, coefs); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7651 spec->power_hook = alc287_s4_power_gpio3_default; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7652 spec->gen.pcm_playback_hook = alc287_alc1318_playback_pcm_hook; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7659 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec, in alc283_fixup_dell_hp_resume() argument
7663 alc_write_coef_idx(codec, 0xd, 0x2800); in alc283_fixup_dell_hp_resume()
7976 * depending on the codec ID
7978 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
7984 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
7988 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
8096 { 0x1a, 0x2101103f }, /* dock line-out */
8097 { 0x1b, 0x23a11040 }, /* dock mic-in */
8158 { 0x19, 0x99a3092f }, /* int-mic */
8165 { 0x12, 0x99a3092f }, /* int-mic */
8177 { 0x19, 0x99a3092f }, /* int-mic */
8185 { 0x12, 0x99a3092f }, /* int-mic */
8379 { 0x1b, 0x99a7012f }, /* int-mic */
8399 { 0x12, 0x99a3092f }, /* int-mic */
8424 /* class-D output amp +5dB */
8450 { 0x12, 0x99a3092f }, /* int-mic */
8647 { 0x1b, 0x21011020 }, /* line-out */
8649 { 0x18, 0x2181103f }, /* line-in */
8658 { 0x1b, 0x21011020 }, /* line-out */
8659 { 0x18, 0x2181103f }, /* line-in */
8806 /* Disable pass-through path for FRONT 14h */
9162 /* Disable PCBEEP-IN passthrough */
9375 /* set 0x15 to HP-OUT ctrl */
9402 /* set 0x15 to HP-OUT ctrl */
9406 /* set 0x1b to HP-OUT */
10343 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10346 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10347 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
10348 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
10349 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10351 SND_PCI_QUIRK(0x1025, 0x100c, "Acer Aspire E5-574G", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10353 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
10354 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
10356 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
10357 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10358 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10361 SND_PCI_QUIRK(0x1025, 0x1177, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10362 SND_PCI_QUIRK(0x1025, 0x1178, "Acer Predator G9-593", ALC255_FIXUP_PREDATOR_SUBWOOFER),
10366 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
10367 SND_PCI_QUIRK(0x1025, 0x126a, "Acer Swift SF114-32", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10371 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
10372 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10373 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10374 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
10375 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
10376 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
10378 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10379 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10380 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
10381 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
10382 SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
10383 SND_PCI_QUIRK(0x1025, 0x159c, "Acer Nitro 5 AN515-58", ALC2XX_FIXUP_HEADSET_MIC),
10447 …SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_…
10451 SND_PCI_QUIRK(0x1028, 0x0c0b, "Dell Oasis 14 RPL-P", ALC289_FIXUP_RTK_AMP_DUAL_SPK),
10462 SND_PCI_QUIRK(0x1028, 0x0c94, "Dell Polaris 3 metal", ALC287_FIXUP_TAS2781_I2C),
10464 SND_PCI_QUIRK(0x1028, 0x0cbd, "Dell Oasis 13 CS MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10465 SND_PCI_QUIRK(0x1028, 0x0cbe, "Dell Oasis 13 2-IN-1 MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10466 SND_PCI_QUIRK(0x1028, 0x0cbf, "Dell Oasis 13 Low Weight MTU-L", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10468 SND_PCI_QUIRK(0x1028, 0x0cc1, "Dell Oasis 14 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10469 SND_PCI_QUIRK(0x1028, 0x0cc2, "Dell Oasis 14 2-in-1 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10470 SND_PCI_QUIRK(0x1028, 0x0cc3, "Dell Oasis 14 Low Weight MTL-U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10471 SND_PCI_QUIRK(0x1028, 0x0cc4, "Dell Oasis 16 MTL-H/U", ALC289_FIXUP_DELL_CS35L41_SPI_2),
10544 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
10547 SND_PCI_QUIRK(0x103c, 0x84ae, "HP 15-db0403ng", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10548 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
10550 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
10552 …SND_PCI_QUIRK(0x103c, 0x85c6, "HP Pavilion x360 Convertible 14-dy1xxx", ALC295_FIXUP_HP_MUTE_LED_C…
10553 SND_PCI_QUIRK(0x103c, 0x85de, "HP Envy x360 13-ar0xxx", ALC285_FIXUP_HP_ENVY_X360),
10557 SND_PCI_QUIRK(0x103c, 0x86c1, "HP Laptop 15-da3001TU", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10559 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10560 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10561 SND_PCI_QUIRK(0x103c, 0x86f9, "HP Spectre x360 13-aw0xxx", ALC285_FIXUP_HP_SPECTRE_X360_MUTE_LED),
10571 …SND_PCI_QUIRK(0x103c, 0x876e, "HP ENVY x360 Convertible 13-ay0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS…
10581 SND_PCI_QUIRK(0x103c, 0x87b7, "HP Laptop 14-fq0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10583 SND_PCI_QUIRK(0x103c, 0x87d3, "HP Laptop 15-gw0xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10593 SND_PCI_QUIRK(0x103c, 0x87fd, "HP Laptop 14-dq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10594 SND_PCI_QUIRK(0x103c, 0x87fe, "HP Laptop 15s-fq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10597 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10598 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
10600 SND_PCI_QUIRK(0x103c, 0x881e, "HP Laptop 15s-du3xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10610 SND_PCI_QUIRK(0x103c, 0x887a, "HP Laptop 15s-eq2xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10611 SND_PCI_QUIRK(0x103c, 0x887c, "HP Laptop 14s-fq1xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10612 …SND_PCI_QUIRK(0x103c, 0x888a, "HP ENVY x360 Convertible 15-eu0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS…
10617 SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
10618 SND_PCI_QUIRK(0x103c, 0x88dd, "HP Pavilion 15z-ec200", ALC285_FIXUP_HP_MUTE_LED),
10621 SND_PCI_QUIRK(0x103c, 0x8919, "HP Pavilion Aero Laptop 13-be0xxx", ALC287_FIXUP_HP_GPIO_LED),
10648 SND_PCI_QUIRK(0x103c, 0x8a0f, "HP Pavilion 14-ec1xxx", ALC287_FIXUP_HP_GPIO_LED),
10649 SND_PCI_QUIRK(0x103c, 0x8a20, "HP Laptop 15s-fq5xxx", ALC236_FIXUP_HP_MUTE_LED_COEFBIT2),
10650 SND_PCI_QUIRK(0x103c, 0x8a25, "HP Victus 16-d1xxx (MB 8A25)", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10705 SND_PCI_QUIRK(0x103c, 0x8bcd, "HP Omen 16-xd0xxx", ALC245_FIXUP_HP_MUTE_LED_V1_COEFBIT),
10719 …SND_PCI_QUIRK(0x103c, 0x8c15, "HP Spectre x360 2-in-1 Laptop 14-eu0xxx", ALC245_FIXUP_HP_SPECTRE_X…
10720 …SND_PCI_QUIRK(0x103c, 0x8c16, "HP Spectre x360 2-in-1 Laptop 16-aa0xxx", ALC245_FIXUP_HP_SPECTRE_X…
10722 SND_PCI_QUIRK(0x103c, 0x8c21, "HP Pavilion Plus Laptop 14-ey0XXX", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10723 SND_PCI_QUIRK(0x103c, 0x8c30, "HP Victus 15-fb1xxx", ALC245_FIXUP_HP_MUTE_LED_COEFBIT),
10727 …SND_PCI_QUIRK(0x103c, 0x8c49, "HP Elite x360 830 2-in-1 G11", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_L…
10734 SND_PCI_QUIRK(0x103c, 0x8c53, "HP Elite x360 1040 2-in-1 G11", ALC285_FIXUP_HP_GPIO_LED),
10763 SND_PCI_QUIRK(0x103c, 0x8cbd, "HP Pavilion Aero Laptop 13-bg0xxx", ALC245_FIXUP_HP_X360_MUTE_LEDS),
10974 SND_PCI_QUIRK(0x10ec, 0x11bc, "VAIO VJFE-IL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
10981 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
10983 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
10984 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
10985 …SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP…
10986 …SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP…
10987 …SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP…
10991 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
10992 …SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP…
11002 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
11003 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
11004 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
11006 SND_PCI_QUIRK(0x152d, 0x1262, "Huawei NBLB-WAX9N", ALC2XX_FIXUP_HEADSET_MIC),
11048 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11058 …SND_PCI_QUIRK(0x1558, 0x8550, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENC…
11059 …SND_PCI_QUIRK(0x1558, 0x8551, "Clevo NH[57][0-9][ER][ACDH]Q", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENC…
11060 SND_PCI_QUIRK(0x1558, 0x8560, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11061 SND_PCI_QUIRK(0x1558, 0x8561, "Clevo NH[57][0-9][ER][ACDH]Q", ALC269_FIXUP_HEADSET_MIC),
11062 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[57][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
11069 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11070 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11071 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
11116 SND_PCI_QUIRK(0x17aa, 0x2234, "Thinkpad ICE-1", ALC287_FIXUP_TAS2781_I2C),
11127 SND_PCI_QUIRK(0x17aa, 0x22c1, "Thinkpad P1 Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADSET_JACK),
11128 …SND_PCI_QUIRK(0x17aa, 0x22c2, "Thinkpad X1 Extreme Gen 3", ALC285_FIXUP_THINKPAD_NO_BASS_SPK_HEADS…
11161 HDA_CODEC_QUIRK(0x17aa, 0x3820, "IdeaPad 330-17IKB 81DM", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
11183 SND_PCI_QUIRK(0x17aa, 0x387d, "Yoga S780-16 pro Quad AAC", ALC287_FIXUP_TAS2781_I2C),
11184 SND_PCI_QUIRK(0x17aa, 0x387e, "Yoga S780-16 pro Quad YC", ALC287_FIXUP_TAS2781_I2C),
11185 SND_PCI_QUIRK(0x17aa, 0x387f, "Yoga S780-16 pro dual LX", ALC287_FIXUP_TAS2781_I2C),
11186 SND_PCI_QUIRK(0x17aa, 0x3880, "Yoga S780-16 pro dual YC", ALC287_FIXUP_TAS2781_I2C),
11201 SND_PCI_QUIRK(0x17aa, 0x38b8, "Yoga S780-14.5 proX AMD YC Dual", ALC287_FIXUP_TAS2781_I2C),
11202 SND_PCI_QUIRK(0x17aa, 0x38b9, "Yoga S780-14.5 proX AMD LX Dual", ALC287_FIXUP_TAS2781_I2C),
11203 SND_PCI_QUIRK(0x17aa, 0x38ba, "Yoga S780-14.5 Air AMD quad YC", ALC287_FIXUP_TAS2781_I2C),
11204 SND_PCI_QUIRK(0x17aa, 0x38bb, "Yoga S780-14.5 Air AMD quad AAC", ALC287_FIXUP_TAS2781_I2C),
11205 SND_PCI_QUIRK(0x17aa, 0x38be, "Yoga S980-14.5 proX YC Dual", ALC287_FIXUP_TAS2781_I2C),
11206 SND_PCI_QUIRK(0x17aa, 0x38bf, "Yoga S980-14.5 proX LX Dual", ALC287_FIXUP_TAS2781_I2C),
11213 SND_PCI_QUIRK(0x17aa, 0x38d3, "Yoga S990-16 Pro IMH YC Dual", ALC287_FIXUP_TAS2781_I2C),
11214 SND_PCI_QUIRK(0x17aa, 0x38d4, "Yoga S990-16 Pro IMH VECO Dual", ALC287_FIXUP_TAS2781_I2C),
11215 SND_PCI_QUIRK(0x17aa, 0x38d5, "Yoga S990-16 Pro IMH YC Quad", ALC287_FIXUP_TAS2781_I2C),
11216 SND_PCI_QUIRK(0x17aa, 0x38d6, "Yoga S990-16 Pro IMH VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11225 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11227 SND_PCI_QUIRK(0x17aa, 0x391f, "Yoga S990-16 pro Quad YC Quad", ALC287_FIXUP_TAS2781_I2C),
11228 SND_PCI_QUIRK(0x17aa, 0x3920, "Yoga S990-16 pro Quad VECO Quad", ALC287_FIXUP_TAS2781_I2C),
11230 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
11260 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
11261 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
11262 SND_PCI_QUIRK(0x19e5, 0x3212, "Huawei KLV-WX9 ", ALC256_FIXUP_ACER_HEADSET_MIC),
11266 …b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
11270 SND_PCI_QUIRK(0x1c6c, 0x1251, "Positivo N14KP6-TG", ALC288_FIXUP_DELL1_MIC_NO_PRESENCE),
11290 SND_PCI_QUIRK(0x2782, 0x0214, "VAIO VJFE-CL", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
11295 SND_PCI_QUIRK(0x2782, 0x1707, "Vaio VJFE-ADL", ALC298_FIXUP_SPK_VOLUME),
11367 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
11368 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
11369 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
11370 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
11371 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
11372 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
11373 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
11374 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
11375 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
11376 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
11377 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11378 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
11379 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11380 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
11381 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
11382 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
11383 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE_QUIET, .name = "dell-headset4-quiet"},
11384 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
11385 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
11386 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
11389 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
11390 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
11391 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11392 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
11394 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
11395 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
11396 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
11397 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
11400 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
11401 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
11402 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
11403 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
11404 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
11405 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
11406 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
11407 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
11408 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
11409 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
11411 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
11412 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
11413 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
11414 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
11415 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
11416 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
11417 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
11418 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
11419 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
11421 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
11422 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
11423 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
11424 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
11426 {.id = ALC269_FIXUP_LENOVO_XPAD_ACPI, .name = "lenovo-xpad-led"},
11427 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
11428 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
11429 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
11430 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
11431 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
11432 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
11433 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
11434 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
11435 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
11436 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
11437 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
11438 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
11439 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
11440 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
11441 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
11442 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
11443 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
11444 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
11445 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
11446 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
11447 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
11448 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
11449 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
11450 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
11451 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
11452 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
11453 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
11454 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
11455 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
11456 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
11457 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
11458 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
11459 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
11460 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
11461 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
11462 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
11463 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
11464 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
11465 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
11466 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
11467 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
11468 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
11469 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
11470 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
11471 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
11472 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
11473 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
11474 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
11475 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
11476 {.id = ALC256_FIXUP_CHROME_BOOK, .name = "alc-2024y-chromebook"},
11477 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
11478 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
11479 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
11480 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
11481 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_2_AMPS, .name = "alc298-samsung-amp-v2-2-amps"},
11482 {.id = ALC298_FIXUP_SAMSUNG_AMP_V2_4_AMPS, .name = "alc298-samsung-amp-v2-4-amps"},
11483 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
11484 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
11485 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
11486 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
11487 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
11488 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
11489 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
11490 {.id = ALC285_FIXUP_HP_ENVY_X360, .name = "alc285-hp-envy-x360"},
11491 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
11492 {.id = ALC287_FIXUP_YOGA9_14IAP7_BASS_SPK_PIN, .name = "alc287-yoga9-bass-spk-pin"},
11493 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
11494 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
11495 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
11496 {.id = ALC236_FIXUP_LENOVO_INV_DMIC, .name = "alc236-fixup-lenovo-inv-mic"},
11497 {.id = ALC2XX_FIXUP_HEADSET_MIC, .name = "alc2xx-fixup-headset-mic"},
11932 * at most one tbl is allowed to define for the same vendor and same codec
11959 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
11961 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
11964 if (spec->codec_variant != ALC269_TYPE_ALC269VB) in alc269_fill_coef()
11967 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
11968 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11969 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
11972 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
11973 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11974 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
11977 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
11979 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
11982 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
11983 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
11984 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { in alc269_fill_coef()
11986 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
11988 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
11989 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { in alc269_fill_coef()
11991 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
11996 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
12001 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
12006 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
12010 spec = codec->spec; in patch_alc269()
12011 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc269()
12012 codec->power_save_node = 0; in patch_alc269()
12013 spec->en_3kpull_low = true; in patch_alc269()
12015 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
12016 codec->patch_ops.resume = alc269_resume; in patch_alc269()
12017 spec->shutup = alc_default_shutup; in patch_alc269()
12018 spec->init_hook = alc_default_init; in patch_alc269()
12020 switch (codec->core.vendor_id) { in patch_alc269()
12022 spec->codec_variant = ALC269_TYPE_ALC269VA; in patch_alc269()
12023 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
12025 if (codec->bus->pci && in patch_alc269()
12026 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
12027 spec->cdefine.platform_type == 1) in patch_alc269()
12028 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
12029 spec->codec_variant = ALC269_TYPE_ALC269VB; in patch_alc269()
12032 if (codec->bus->pci && in patch_alc269()
12033 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
12034 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
12035 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
12036 spec->codec_variant = ALC269_TYPE_ALC269VC; in patch_alc269()
12039 spec->codec_variant = ALC269_TYPE_ALC269VD; in patch_alc269()
12042 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
12046 spec->shutup = alc269_shutup; in patch_alc269()
12047 spec->init_hook = alc269_fill_coef; in patch_alc269()
12048 alc269_fill_coef(codec); in patch_alc269()
12053 spec->codec_variant = ALC269_TYPE_ALC280; in patch_alc269()
12056 spec->codec_variant = ALC269_TYPE_ALC282; in patch_alc269()
12057 spec->shutup = alc282_shutup; in patch_alc269()
12058 spec->init_hook = alc282_init; in patch_alc269()
12062 spec->codec_variant = ALC269_TYPE_ALC283; in patch_alc269()
12063 spec->shutup = alc283_shutup; in patch_alc269()
12064 spec->init_hook = alc283_init; in patch_alc269()
12068 spec->codec_variant = ALC269_TYPE_ALC284; in patch_alc269()
12071 spec->codec_variant = ALC269_TYPE_ALC293; in patch_alc269()
12075 spec->codec_variant = ALC269_TYPE_ALC286; in patch_alc269()
12078 spec->codec_variant = ALC269_TYPE_ALC298; in patch_alc269()
12082 spec->codec_variant = ALC269_TYPE_ALC255; in patch_alc269()
12083 spec->shutup = alc256_shutup; in patch_alc269()
12084 spec->init_hook = alc256_init; in patch_alc269()
12090 spec->codec_variant = ALC269_TYPE_ALC256; in patch_alc269()
12091 spec->shutup = alc256_shutup; in patch_alc269()
12092 spec->init_hook = alc256_init; in patch_alc269()
12093 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */ in patch_alc269()
12094 if (codec->core.vendor_id == 0x10ec0236 && in patch_alc269()
12095 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD) in patch_alc269()
12096 spec->en_3kpull_low = false; in patch_alc269()
12099 spec->codec_variant = ALC269_TYPE_ALC257; in patch_alc269()
12100 spec->shutup = alc256_shutup; in patch_alc269()
12101 spec->init_hook = alc256_init; in patch_alc269()
12102 spec->gen.mixer_nid = 0; in patch_alc269()
12103 spec->en_3kpull_low = false; in patch_alc269()
12109 if (alc_get_coef0(codec) & 0x0010) in patch_alc269()
12110 spec->codec_variant = ALC269_TYPE_ALC245; in patch_alc269()
12112 spec->codec_variant = ALC269_TYPE_ALC215; in patch_alc269()
12113 spec->shutup = alc225_shutup; in patch_alc269()
12114 spec->init_hook = alc225_init; in patch_alc269()
12115 spec->gen.mixer_nid = 0; in patch_alc269()
12120 spec->codec_variant = ALC269_TYPE_ALC225; in patch_alc269()
12121 spec->shutup = alc225_shutup; in patch_alc269()
12122 spec->init_hook = alc225_init; in patch_alc269()
12123 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */ in patch_alc269()
12126 spec->codec_variant = ALC269_TYPE_ALC287; in patch_alc269()
12127 spec->shutup = alc225_shutup; in patch_alc269()
12128 spec->init_hook = alc225_init; in patch_alc269()
12129 spec->gen.mixer_nid = 0; /* no loopback on ALC287 */ in patch_alc269()
12134 spec->codec_variant = ALC269_TYPE_ALC294; in patch_alc269()
12135 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ in patch_alc269()
12136 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
12137 spec->init_hook = alc294_init; in patch_alc269()
12140 spec->codec_variant = ALC269_TYPE_ALC300; in patch_alc269()
12141 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */ in patch_alc269()
12145 spec->codec_variant = ALC269_TYPE_ALC623; in patch_alc269()
12146 spec->shutup = alc222_shutup; in patch_alc269()
12147 spec->init_hook = alc222_init; in patch_alc269()
12153 spec->codec_variant = ALC269_TYPE_ALC700; in patch_alc269()
12154 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ in patch_alc269()
12155 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
12156 spec->init_hook = alc294_init; in patch_alc269()
12161 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
12162 spec->has_alc5505_dsp = 1; in patch_alc269()
12163 spec->init_hook = alc5505_dsp_init; in patch_alc269()
12166 alc_pre_init(codec); in patch_alc269()
12168 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
12174 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
12175 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
12176 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
12177 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
12180 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
12181 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
12182 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
12189 find_cirrus_companion_amps(codec); in patch_alc269()
12191 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
12193 alc_auto_parse_customize_define(codec); in patch_alc269()
12195 if (has_cdefine_beep(codec)) in patch_alc269()
12196 spec->gen.beep_nid = 0x01; in patch_alc269()
12199 err = alc269_parse_auto_config(codec); in patch_alc269()
12203 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) { in patch_alc269()
12204 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT); in patch_alc269()
12209 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
12214 alc_free(codec); in patch_alc269()
12222 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
12226 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
12239 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
12242 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
12247 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
12251 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
12252 spec->gen.keep_vref_in_automute = 1; in alc861_fixup_asus_amp_vref_0f()
12255 /* suppress the jack-detection */
12256 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
12260 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
12311 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
12316 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
12320 spec = codec->spec; in patch_alc861()
12321 if (has_cdefine_beep(codec)) in patch_alc861()
12322 spec->gen.beep_nid = 0x23; in patch_alc861()
12324 spec->power_hook = alc_power_eapd; in patch_alc861()
12326 alc_pre_init(codec); in patch_alc861()
12328 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
12329 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
12332 err = alc861_parse_auto_config(codec); in patch_alc861()
12336 if (!spec->gen.no_analog) { in patch_alc861()
12342 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
12347 alc_free(codec); in patch_alc861()
12352 * ALC861-VD support
12358 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
12362 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
12371 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
12375 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
12376 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
12381 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
12384 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
12387 spec->gpio_mask |= 0x02; in alc660vd_fixup_asus_gpio1()
12388 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
12404 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
12405 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
12411 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
12416 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
12420 spec = codec->spec; in patch_alc861vd()
12421 if (has_cdefine_beep(codec)) in patch_alc861vd()
12422 spec->gen.beep_nid = 0x23; in patch_alc861vd()
12424 spec->shutup = alc_eapd_shutup; in patch_alc861vd()
12426 alc_pre_init(codec); in patch_alc861vd()
12428 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
12429 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
12432 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
12436 if (!spec->gen.no_analog) { in patch_alc861vd()
12442 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
12447 alc_free(codec); in patch_alc861vd()
12457 * 6-channel independent captures.
12459 * In addition, an independent DAC for the multi-playback (not used in this
12467 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
12474 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
12475 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
12476 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
12480 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
12483 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
12488 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
12493 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
12506 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
12510 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
12511 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps; in alc_fixup_bass_chmap()
12516 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
12520 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
12521 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
12526 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
12529 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
12531 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
12533 spec->mute_led_polarity = 1; in alc662_fixup_led_gpio1()
12534 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
12538 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
12541 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
12544 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
12546 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc662_usi_automute_hook()
12548 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
12552 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
12555 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
12557 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc662_fixup_usi_headset_mic()
12558 spec->gen.hp_automute_hook = alc662_usi_automute_hook; in alc662_fixup_usi_headset_mic()
12562 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
12568 * 0x15 - front left/front right in alc662_aspire_ethos_mute_speakers()
12569 * 0x18 - front center/ LFE in alc662_aspire_ethos_mute_speakers()
12571 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
12572 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
12573 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
12575 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12576 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12580 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
12584 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
12589 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
12592 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
12598 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
12603 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
12606 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
12616 spec->gen.mixer_nid = 0; in alc671_fixup_hp_headset_mic2()
12617 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc671_fixup_hp_headset_mic2()
12618 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
12621 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
12626 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
12629 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
12632 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
12633 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; in alc897_hp_automute_hook()
12634 snd_hda_set_pin_ctl(codec, 0x1b, vref); in alc897_hp_automute_hook()
12637 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
12640 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
12642 spec->gen.hp_automute_hook = alc897_hp_automute_hook; in alc897_fixup_lenovo_headset_mic()
12643 spec->no_shutup_pins = 1; in alc897_fixup_lenovo_headset_mic()
12646 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100); in alc897_fixup_lenovo_headset_mic()
12650 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mode() argument
12653 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mode()
12656 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc897_fixup_lenovo_headset_mode()
12657 spec->gen.hp_automute_hook = alc897_hp_automute_hook; in alc897_fixup_lenovo_headset_mode()
12685 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
12687 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
12783 {0x19, 0x90a7013f}, /* int-mic */
12819 { 0x19, 0x99a3092f }, /* int-mic */
12831 { 0x19, 0x99a3092f }, /* int-mic */
12844 { 0x19, 0x99a3094f }, /* int-mic */
12857 { 0x19, 0x99a3094f }, /* int-mic */
12871 { 0x19, 0x99a3094f }, /* int-mic */
12883 { 0x19, 0x99a3094f }, /* int-mic */
12896 { 0x19, 0x99a3094f }, /* int-mic */
12908 { 0x12, 0x99a30970 }, /* int-mic */
13205 SND_PCI_QUIRK(0x1019, 0x9859, "JP-IK LEAP W502", ALC897_FIXUP_HEADSET_MIC_PIN3),
13214 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
13261 SND_PCI_QUIRK(0x17aa, 0x3742, "Lenovo TianYi510Pro-14IOB", ALC897_FIXUP_HEADSET_MIC_PIN2),
13269 SND_PCI_QUIRK(0x1c6c, 0x1239, "Compaq N14JP6-V2", ALC897_FIXUP_HP_HSMIC_VERB),
13335 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
13336 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
13337 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
13338 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
13339 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
13340 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
13341 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
13342 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
13343 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
13344 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
13345 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
13346 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
13347 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
13348 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
13349 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
13353 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
13354 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
13355 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
13356 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
13357 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
13358 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
13359 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
13360 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
13361 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
13362 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
13363 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
13364 {.id = ALC897_FIXUP_UNIS_H3C_X500S, .name = "unis-h3c-x500s"},
13429 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
13434 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
13438 spec = codec->spec; in patch_alc662()
13440 spec->shutup = alc_eapd_shutup; in patch_alc662()
13443 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in patch_alc662()
13445 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
13447 switch (codec->core.vendor_id) { in patch_alc662()
13449 spec->init_hook = alc668_restore_default_value; in patch_alc662()
13453 alc_pre_init(codec); in patch_alc662()
13455 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
13457 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
13458 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
13460 alc_auto_parse_customize_define(codec); in patch_alc662()
13462 if (has_cdefine_beep(codec)) in patch_alc662()
13463 spec->gen.beep_nid = 0x01; in patch_alc662()
13465 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
13466 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
13467 spec->cdefine.platform_type == 1) { in patch_alc662()
13468 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
13474 err = alc662_parse_auto_config(codec); in patch_alc662()
13478 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc662()
13479 switch (codec->core.vendor_id) { in patch_alc662()
13497 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
13502 alc_free(codec); in patch_alc662()
13510 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
13512 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
13517 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
13521 /* ALC680 has no aa-loopback mixer */ in patch_alc680()
13522 err = alc_alloc_spec(codec, 0); in patch_alc680()
13527 err = alc680_parse_auto_config(codec); in patch_alc680()
13529 alc_free(codec); in patch_alc680()
13583 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
13585 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
13624 MODULE_DESCRIPTION("Realtek HD-audio codec");