Lines Matching +full:codec +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal Interface for Intel High Definition Audio Codec
32 /* extra amp-initialization sequence types */
63 unsigned int enable_pcbeep:1;
64 unsigned int platform_type:1;
65 unsigned int swap:1;
66 unsigned int override:1;
67 unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
80 /* codec parameterization */
108 void (*init_hook)(struct hda_codec *codec);
110 void (*power_hook)(struct hda_codec *codec);
112 void (*shutup)(struct hda_codec *codec);
113 void (*reboot_notify)(struct hda_codec *codec);
117 unsigned int has_alc5505_dsp:1;
118 unsigned int no_depop_delay:1;
119 unsigned int done_hp_init:1;
120 unsigned int no_shutup_pins:1;
121 unsigned int ultra_low_power:1;
122 unsigned int has_hs_key:1;
123 unsigned int no_internal_mic_pin:1;
130 u8 alc_mute_keycode_map[1];
137 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
139 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
141 snd_hda_power_up_pm(codec); in coef_mutex_lock()
142 mutex_lock(&spec->coef_mutex); in coef_mutex_lock()
145 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
147 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
149 mutex_unlock(&spec->coef_mutex); in coef_mutex_unlock()
150 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
153 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
158 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
159 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
163 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
168 coef_mutex_lock(codec); in alc_read_coefex_idx()
169 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
170 coef_mutex_unlock(codec); in alc_read_coefex_idx()
174 #define alc_read_coef_idx(codec, coef_idx) \ argument
175 alc_read_coefex_idx(codec, 0x20, coef_idx)
177 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
180 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
181 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
184 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
187 coef_mutex_lock(codec); in alc_write_coefex_idx()
188 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
189 coef_mutex_unlock(codec); in alc_write_coefex_idx()
192 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
193 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
195 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
199 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
201 if (val != -1) in __alc_update_coefex_idx()
202 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
206 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
210 coef_mutex_lock(codec); in alc_update_coefex_idx()
211 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
212 coef_mutex_unlock(codec); in alc_update_coefex_idx()
215 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
216 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
219 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
221 struct alc_spec *spec = codec->spec; in alc_get_coef0()
223 if (!spec->coef0) in alc_get_coef0()
224 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
225 return spec->coef0; in alc_get_coef0()
238 #define WRITE_COEFEX(_nid, _idx, _val) UPDATE_COEFEX(_nid, _idx, -1, _val)
242 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
245 coef_mutex_lock(codec); in alc_process_coef_fw()
246 for (; fw->nid; fw++) { in alc_process_coef_fw()
247 if (fw->mask == (unsigned short)-1) in alc_process_coef_fw()
248 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
250 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
251 fw->mask, fw->val); in alc_process_coef_fw()
253 coef_mutex_unlock(codec); in alc_process_coef_fw()
261 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
263 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
265 spec->gpio_mask |= mask; in alc_setup_gpio()
266 spec->gpio_dir |= mask; in alc_setup_gpio()
267 spec->gpio_data |= mask; in alc_setup_gpio()
270 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
272 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
274 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
275 spec->gpio_data); in alc_write_gpio_data()
278 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
281 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
282 unsigned int oldval = spec->gpio_data; in alc_update_gpio_data()
285 spec->gpio_data |= mask; in alc_update_gpio_data()
287 spec->gpio_data &= ~mask; in alc_update_gpio_data()
288 if (oldval != spec->gpio_data) in alc_update_gpio_data()
289 alc_write_gpio_data(codec); in alc_update_gpio_data()
292 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
294 struct alc_spec *spec = codec->spec; in alc_write_gpio()
296 if (!spec->gpio_mask) in alc_write_gpio()
299 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
300 AC_VERB_SET_GPIO_MASK, spec->gpio_mask); in alc_write_gpio()
301 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
302 AC_VERB_SET_GPIO_DIRECTION, spec->gpio_dir); in alc_write_gpio()
303 if (spec->gpio_write_delay) in alc_write_gpio()
304 msleep(1); in alc_write_gpio()
305 alc_write_gpio_data(codec); in alc_write_gpio()
308 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
312 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
315 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
318 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
321 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
324 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
327 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
330 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
333 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
336 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
339 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
343 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
349 * the default value is 1.
351 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
353 struct alc_spec *spec = codec->spec; in alc_fix_pll()
355 if (spec->pll_nid) in alc_fix_pll()
356 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
357 1 << spec->pll_coef_bit, 0); in alc_fix_pll()
360 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
363 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
364 spec->pll_nid = nid; in alc_fix_pll_init()
365 spec->pll_coef_idx = coef_idx; in alc_fix_pll_init()
366 spec->pll_coef_bit = coef_bit; in alc_fix_pll_init()
367 alc_fix_pll(codec); in alc_fix_pll_init()
370 /* update the master volume per volume-knob's unsol event */
371 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
378 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
384 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
387 uctl->value.integer.value[0] = val; in alc_update_knob_master()
388 uctl->value.integer.value[1] = val; in alc_update_knob_master()
389 kctl->put(kctl, uctl); in alc_update_knob_master()
393 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
397 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
401 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
405 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
407 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
409 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
413 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
417 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
419 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
421 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
427 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
432 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
452 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
455 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
458 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
459 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
462 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
471 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
475 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
484 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
488 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
491 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
494 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
498 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
502 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
509 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
515 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
517 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
518 /* alc888-VA */ in alc888_coef_init()
520 /* alc888-VB */ in alc888_coef_init()
522 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
528 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
530 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
532 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
533 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
537 /* turn on/off EAPD controls of the codec */
538 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
546 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
549 static int find_ext_mic_pin(struct hda_codec *codec);
551 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
554 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
560 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
563 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
565 if (pin->nid != mic_pin) in alc_headset_mic_no_shutup()
566 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
570 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
573 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
575 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
577 switch (codec->core.vendor_id) { in alc_shutup_pins()
585 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
588 if (!spec->no_shutup_pins) in alc_shutup_pins()
589 snd_hda_shutup_pins(codec); in alc_shutup_pins()
595 * just turning off EAPD and a little pause for avoiding pop-noise
597 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
599 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
601 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
602 if (!spec->no_depop_delay) in alc_eapd_shutup()
604 alc_shutup_pins(codec); in alc_eapd_shutup()
608 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
610 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
611 alc_write_gpio(codec); in alc_auto_init_amp()
614 switch (codec->core.vendor_id) { in alc_auto_init_amp()
616 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
622 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
625 alc888_coef_init(codec); in alc_auto_init_amp()
635 if (spec->gen.autocfg.hp_pins[0]) in alc_get_hp_pin()
636 return spec->gen.autocfg.hp_pins[0]; in alc_get_hp_pin()
637 if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) in alc_get_hp_pin()
638 return spec->gen.autocfg.line_out_pins[0]; in alc_get_hp_pin()
646 /* Could be any non-zero and even value. When used as fixup, tells
651 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
654 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
656 spec->cdefine.fixup = 1; in alc_fixup_sku_ignore()
657 spec->cdefine.sku_cfg = ALC_FIXUP_SKU_IGNORE; in alc_fixup_sku_ignore()
661 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
664 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
667 spec->no_depop_delay = 1; in alc_fixup_no_depop_delay()
668 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
672 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
676 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
678 spec->cdefine.enable_pcbeep = 1; /* assume always enabled */ in alc_auto_parse_customize_define()
680 if (spec->cdefine.fixup) { in alc_auto_parse_customize_define()
681 ass = spec->cdefine.sku_cfg; in alc_auto_parse_customize_define()
683 return -1; in alc_auto_parse_customize_define()
687 if (!codec->bus->pci) in alc_auto_parse_customize_define()
688 return -1; in alc_auto_parse_customize_define()
689 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
690 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
694 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
696 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
698 if (!(ass & 1)) { in alc_auto_parse_customize_define()
699 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
700 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
701 return -1; in alc_auto_parse_customize_define()
706 for (i = 1; i < 16; i++) { in alc_auto_parse_customize_define()
707 if ((ass >> i) & 1) in alc_auto_parse_customize_define()
711 return -1; in alc_auto_parse_customize_define()
713 spec->cdefine.port_connectivity = ass >> 30; in alc_auto_parse_customize_define()
714 spec->cdefine.enable_pcbeep = (ass & 0x100000) >> 20; in alc_auto_parse_customize_define()
715 spec->cdefine.check_sum = (ass >> 16) & 0xf; in alc_auto_parse_customize_define()
716 spec->cdefine.customization = ass >> 8; in alc_auto_parse_customize_define()
718 spec->cdefine.sku_cfg = ass; in alc_auto_parse_customize_define()
719 spec->cdefine.external_amp = (ass & 0x38) >> 3; in alc_auto_parse_customize_define()
720 spec->cdefine.platform_type = (ass & 0x4) >> 2; in alc_auto_parse_customize_define()
721 spec->cdefine.swap = (ass & 0x2) >> 1; in alc_auto_parse_customize_define()
722 spec->cdefine.override = ass & 0x1; in alc_auto_parse_customize_define()
724 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
725 nid, spec->cdefine.sku_cfg); in alc_auto_parse_customize_define()
726 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
727 spec->cdefine.port_connectivity); in alc_auto_parse_customize_define()
728 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
729 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
730 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
731 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
732 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
733 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
734 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
739 /* return the position of NID in the list, or -1 if not found */
746 return -1; in find_idx_in_nid_list()
754 /* check subsystem ID and set up device-specific initialization;
755 * return 1 if initialized, 0 if invalid SSID
757 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
761 * port-A --> pin 39/41, port-E --> pin 14/15, port-D --> pin 35/36
763 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
767 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
769 if (spec->cdefine.fixup) { in alc_subsystem_id()
770 ass = spec->cdefine.sku_cfg; in alc_subsystem_id()
776 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
777 if (codec->bus->pci && in alc_subsystem_id()
778 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
786 * 19~16 : Check sum (15:1) in alc_subsystem_id()
787 * 15~1 : Custom in alc_subsystem_id()
791 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
793 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
794 codec_dbg(codec, in alc_subsystem_id()
797 if (!(ass & 1)) in alc_subsystem_id()
799 if ((ass >> 30) != 1) /* no physical connection */ in alc_subsystem_id()
804 for (i = 1; i < 16; i++) { in alc_subsystem_id()
805 if ((ass >> i) & 1) in alc_subsystem_id()
811 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
812 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
815 * 1 : Swap Jack in alc_subsystem_id()
816 * 2 : 0 --> Desktop, 1 --> Laptop in alc_subsystem_id()
821 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_subsystem_id()
823 case 1: in alc_subsystem_id()
824 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
827 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
830 alc_setup_gpio(codec, 0x03); in alc_subsystem_id()
834 spec->init_amp = ALC_INIT_DEFAULT; in alc_subsystem_id()
843 return 1; in alc_subsystem_id()
846 * 12~11: Headphone out -> 00: PortA, 01: PortE, 02: PortD, 03: Resvered in alc_subsystem_id()
848 * 15 : 1 --> enable the function "Mute internal speaker in alc_subsystem_id()
855 if (found_in_nid_list(nid, spec->gen.autocfg.line_out_pins, in alc_subsystem_id()
856 spec->gen.autocfg.line_outs)) in alc_subsystem_id()
857 return 1; in alc_subsystem_id()
858 spec->gen.autocfg.hp_pins[0] = nid; in alc_subsystem_id()
860 return 1; in alc_subsystem_id()
863 /* Check the validity of ALC subsystem-id
864 * ports contains an array of 4 pin NIDs for port-A, E, D and I */
865 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
867 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
868 struct alc_spec *spec = codec->spec; in alc_ssid_check()
869 if (spec->init_amp == ALC_INIT_UNDEFINED) { in alc_ssid_check()
870 codec_dbg(codec, in alc_ssid_check()
872 spec->init_amp = ALC_INIT_DEFAULT; in alc_ssid_check()
880 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
883 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
885 spec->gen.inv_dmic_split = 1; in alc_fixup_inv_dmic()
889 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
893 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
897 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
906 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
908 alc_fill_eapd_coef(codec); in alc_pre_init()
911 #define is_s3_resume(codec) \ argument
912 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
913 #define is_s4_resume(codec) \ argument
914 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
916 static int alc_init(struct hda_codec *codec) in alc_init() argument
918 struct alc_spec *spec = codec->spec; in alc_init()
921 if (is_s4_resume(codec)) in alc_init()
922 alc_pre_init(codec); in alc_init()
924 if (spec->init_hook) in alc_init()
925 spec->init_hook(codec); in alc_init()
927 spec->gen.skip_verbs = 1; /* applied in below */ in alc_init()
928 snd_hda_gen_init(codec); in alc_init()
929 alc_fix_pll(codec); in alc_init()
930 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
931 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
938 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
940 struct alc_spec *spec = codec->spec; in alc_shutup()
942 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
945 if (spec && spec->shutup) in alc_shutup()
946 spec->shutup(codec); in alc_shutup()
948 alc_shutup_pins(codec); in alc_shutup()
951 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
953 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
955 if (spec && spec->reboot_notify) in alc_reboot_notify()
956 spec->reboot_notify(codec); in alc_reboot_notify()
958 alc_shutup(codec); in alc_reboot_notify()
964 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
966 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
969 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
971 struct alc_spec *spec = codec->spec; in alc_suspend()
972 alc_shutup(codec); in alc_suspend()
973 if (spec && spec->power_hook) in alc_suspend()
974 spec->power_hook(codec); in alc_suspend()
980 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
982 struct alc_spec *spec = codec->spec; in alc_resume()
984 if (!spec->no_depop_delay) in alc_resume()
986 codec->patch_ops.init(codec); in alc_resume()
987 snd_hda_regmap_sync(codec); in alc_resume()
988 hda_call_check_power_status(codec, 0x01); in alc_resume()
1010 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1040 { 0x10ec0887, 0x00f0, 0x0030, "ALC887-VD" },
1041 { 0x10ec0888, 0x00f0, 0x0030, "ALC888-VD" },
1081 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1086 for (p = rename_tbl; p->vendor_id; p++) { in alc_codec_rename_from_preset()
1087 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1089 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1090 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1093 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1095 for (q = rename_pci_tbl; q->codec_vendor_id; q++) { in alc_codec_rename_from_preset()
1096 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1098 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1100 if (!q->pci_subdevice || in alc_codec_rename_from_preset()
1101 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1102 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1110 * Digital-beep handlers
1129 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, in set_beep_amp()
1132 return -ENOMEM; in set_beep_amp()
1133 knew->private_value = beep_amp; in set_beep_amp()
1139 SND_PCI_QUIRK(0x1043, 0x103c, "ASUS", 1),
1140 SND_PCI_QUIRK(0x1043, 0x115d, "ASUS", 1),
1141 SND_PCI_QUIRK(0x1043, 0x829f, "ASUS", 1),
1142 SND_PCI_QUIRK(0x1043, 0x8376, "EeePC", 1),
1143 SND_PCI_QUIRK(0x1043, 0x83ce, "EeePC", 1),
1144 SND_PCI_QUIRK(0x1043, 0x831a, "EeePC", 1),
1145 SND_PCI_QUIRK(0x1043, 0x834a, "EeePC", 1),
1146 SND_PCI_QUIRK(0x1458, 0xa002, "GA-MA790X", 1),
1147 SND_PCI_QUIRK(0x8086, 0xd613, "Intel", 1),
1148 /* denylist -- no beep available */
1154 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1156 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1158 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1160 return q->value; in has_cdefine_beep()
1161 return spec->cdefine.enable_pcbeep; in has_cdefine_beep()
1165 #define has_cdefine_beep(codec) 0 argument
1169 /* return 1 if successful, 0 if the proper config is not found,
1172 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1176 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1177 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_parse_auto_config()
1180 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1181 spec->parse_flags); in alc_parse_auto_config()
1186 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1188 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1192 return 1; in alc_parse_auto_config()
1196 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1202 return -ENOMEM; in alc_alloc_spec()
1203 codec->spec = spec; in alc_alloc_spec()
1204 snd_hda_gen_spec_init(&spec->gen); in alc_alloc_spec()
1205 spec->gen.mixer_nid = mixer_nid; in alc_alloc_spec()
1206 spec->gen.own_eapd_ctl = 1; in alc_alloc_spec()
1207 codec->single_adc_amp = 1; in alc_alloc_spec()
1208 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1209 codec->spdif_status_reset = 1; in alc_alloc_spec()
1210 codec->forced_resume = 1; in alc_alloc_spec()
1211 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1212 mutex_init(&spec->coef_mutex); in alc_alloc_spec()
1214 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1222 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1226 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1230 * ALC880 fix-ups
1260 /* enable the volume-knob widget support on NID 0x21 */
1261 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1265 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1301 { 0x1a, 0x0181344f }, /* line-in */
1349 { 0x19, 0x01a19950 }, /* mic-in */
1369 { 0x19, 0x01a19950 }, /* mic-in */
1409 { 0x18, 0x01a19950 }, /* mic-in */
1411 { 0x1a, 0x01813031 }, /* line-in */
1442 { 0x14, 0x01014010 }, /* line-out */
1446 { 0x18, 0x01a19c30 }, /* mic-in */
1448 { 0x1a, 0x01813031 }, /* line-in */
1449 { 0x1b, 0x02a19c40 }, /* front-mic */
1482 { 0x18, 0x01a19c30 }, /* mic-in */
1484 { 0x1a, 0x01813031 }, /* line-in */
1485 { 0x1b, 0x02a19c40 }, /* front-mic */
1518 { 0x18, 0x01a19c30 }, /* mic-in */
1519 { 0x19, 0x02a19c40 }, /* front-mic */
1520 { 0x1a, 0x01813031 }, /* line-in */
1584 * It's not quite sure whether BIOS sets the correct pin-config table
1609 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_FIXUP_5ST_DIG),
1624 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_FIXUP_5ST_DIG),
1631 {.id = ALC880_FIXUP_3ST_DIG, .name = "3stack-digout"},
1633 {.id = ALC880_FIXUP_5ST_DIG, .name = "5stack-digout"},
1635 {.id = ALC880_FIXUP_6ST_DIG, .name = "6stack-digout"},
1636 {.id = ALC880_FIXUP_6ST_AUTOMUTE, .name = "6stack-automute"},
1644 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1649 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1653 spec = codec->spec; in patch_alc880()
1654 spec->gen.need_dac_fix = 1; in patch_alc880()
1655 spec->gen.beep_nid = 0x01; in patch_alc880()
1657 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1659 alc_pre_init(codec); in patch_alc880()
1661 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1663 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1666 err = alc880_parse_auto_config(codec); in patch_alc880()
1670 if (!spec->gen.no_analog) { in patch_alc880()
1676 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1681 alc_free(codec); in patch_alc880()
1689 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1693 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1713 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1715 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1717 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1720 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1723 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1728 spec->gen.automute_hook = alc260_gpio1_automute; in alc260_fixup_gpio1_toggle()
1729 spec->gen.detect_hp = 1; in alc260_fixup_gpio1_toggle()
1730 spec->gen.automute_speaker = 1; in alc260_fixup_gpio1_toggle()
1731 spec->gen.autocfg.hp_pins[0] = 0x0f; /* copy it for automute */ in alc260_fixup_gpio1_toggle()
1732 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1734 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1738 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1741 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1760 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1761 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_kn1()
1766 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1769 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1771 spec->init_amp = ALC_INIT_NONE; in alc260_fixup_fsc_s7020()
1774 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1777 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1779 spec->gen.add_jack_modes = 1; in alc260_fixup_fsc_s7020_jwse()
1780 spec->gen.hp_mic = 1; in alc260_fixup_fsc_s7020_jwse()
1887 {.id = ALC260_FIXUP_FSC_S7020_JWSE, .name = "fujitsu-jwse"},
1893 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1898 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1902 spec = codec->spec; in patch_alc260()
1907 spec->gen.prefer_hp_amp = 1; in patch_alc260()
1908 spec->gen.beep_nid = 0x01; in patch_alc260()
1910 spec->shutup = alc_eapd_shutup; in patch_alc260()
1912 alc_pre_init(codec); in patch_alc260()
1914 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1916 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1919 err = alc260_parse_auto_config(codec); in patch_alc260()
1923 if (!spec->gen.no_analog) { in patch_alc260()
1929 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1934 alc_free(codec); in patch_alc260()
1945 * 6-channel independent captures.
1947 * In addition, an independent DAC for the multi-playback (not used in this
1998 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
2003 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2007 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2010 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2012 spec->gpio_write_delay = true; in alc885_fixup_macpro_gpio()
2013 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2020 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2027 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2028 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2029 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2030 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2034 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2035 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2036 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2037 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2042 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2046 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2052 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2055 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2057 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2058 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mbp_vref()
2063 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2066 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2071 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2073 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2075 spec->gen.keep_vref_in_automute = 1; in alc889_fixup_mac_pins()
2079 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2085 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2089 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2095 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2099 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2105 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2110 * all-in-one desktop PCs (for example VGC-LN51JGB) through DAC 0x05
2112 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2115 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2117 spec->gen.no_primary_hp = 1; in alc882_fixup_no_primary_hp()
2118 spec->gen.no_multi_io = 1; in alc882_fixup_no_primary_hp()
2122 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2125 /* For dual-codec configuration, we need to disable some features to avoid
2128 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2131 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2136 spec->gen.suppress_vmaster = 1; in alc_fixup_dual_codecs()
2137 /* auto-mute and auto-mic switch don't work with multiple codecs */ in alc_fixup_dual_codecs()
2138 spec->gen.suppress_auto_mute = 1; in alc_fixup_dual_codecs()
2139 spec->gen.suppress_auto_mic = 1; in alc_fixup_dual_codecs()
2141 spec->gen.mixer_nid = 0; in alc_fixup_dual_codecs()
2143 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2146 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2151 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2153 strcpy(kctl->id.name, newname); in rename_ctl()
2156 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2160 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2164 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2167 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2168 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2169 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2170 "Rear-Panel Capture Volume" : in alc1220_fixup_gb_dual_codecs()
2171 "Front-Panel Capture Volume"); in alc1220_fixup_gb_dual_codecs()
2172 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2173 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2174 "Rear-Panel Capture Switch" : in alc1220_fixup_gb_dual_codecs()
2175 "Front-Panel Capture Switch"); in alc1220_fixup_gb_dual_codecs()
2180 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2195 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2196 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2199 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2204 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2213 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2217 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2218 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2221 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2224 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2228 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2229 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2232 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2235 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2238 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2240 if (spec->gen.hp_jack_present) in alc887_asus_hp_automute_hook()
2244 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2247 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2250 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2253 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2254 spec->gen.hp_automute_hook = alc887_asus_hp_automute_hook; in alc887_fixup_asus_jack()
2407 /* DAC DISABLE/MUTE 1? */
2408 /* setting bits 1-5 disables DAC nids 0x02-0x06
2419 * The mics are only 1cm apart which makes the stereo
2424 * codec replicate the sum signal to both channels,
2569 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
2586 SND_PCI_QUIRK(0x1043, 0x8797, "ASUS TUF B550M-PLUS", ALCS1200A_FIXUP_MIC_VREF),
2587 SND_PCI_QUIRK(0x104d, 0x9043, "Sony Vaio VGC-LN51JGB", ALC882_FIXUP_NO_PRIMARY_HP),
2593 /* All Apple entries are in codec SSIDs */
2594 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
2596 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2602 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2603 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
2604 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
2605 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
2606 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
2608 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC889_FIXUP_IMAC91_VREF),
2609 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
2610 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
2611 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 4,1/5,1", ALC889_FIXUP_MP41_VREF),
2612 SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
2614 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
2618 SND_PCI_QUIRK(0x13fe, 0x1009, "Advantech MIT-W101", ALC886_FIXUP_EAPD),
2619 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2620 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2624 SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
2625 SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2626 SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
2627 SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
2628 SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
2629 SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
2630 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2632 SND_PCI_QUIRK(0x1462, 0xda57, "MSI Z270-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2634 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2639 SND_PCI_QUIRK(0x1558, 0x65e5, "Clevo PC50D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2644 SND_PCI_QUIRK(0x1558, 0x67e5, "Clevo PC70D[PRS](?:-D|-G)?", ALC1220_FIXUP_CLEVO_PB51ED_PINS),
2649 SND_PCI_QUIRK(0x1558, 0x7715, "Clevo X170KM-G", ALC1220_FIXUP_CLEVO_PB51ED),
2659 SND_PCI_QUIRK(0x1558, 0x96e1, "Clevo P960[ER][CDFN]-K", ALC1220_FIXUP_CLEVO_P950),
2661 SND_PCI_QUIRK(0x1558, 0x97e2, "Clevo P970RC-M", ALC1220_FIXUP_CLEVO_P950),
2670 {.id = ALC882_FIXUP_ABIT_AW9D_MAX, .name = "abit-aw9d"},
2671 {.id = ALC882_FIXUP_LENOVO_Y530, .name = "lenovo-y530"},
2672 {.id = ALC882_FIXUP_ACER_ASPIRE_7736, .name = "acer-aspire-7736"},
2673 {.id = ALC882_FIXUP_ASUS_W90V, .name = "asus-w90v"},
2675 {.id = ALC889_FIXUP_FRONT_HP_NO_PRESENCE, .name = "no-front-hp"},
2676 {.id = ALC889_FIXUP_VAIO_TT, .name = "vaio-tt"},
2678 {.id = ALC882_FIXUP_EAPD, .name = "alc882-eapd"},
2679 {.id = ALC883_FIXUP_EAPD, .name = "alc883-eapd"},
2683 {.id = ALC889_FIXUP_COEF, .name = "alc889-coef"},
2684 {.id = ALC882_FIXUP_ASUS_W2JC, .name = "asus-w2jc"},
2685 {.id = ALC882_FIXUP_ACER_ASPIRE_4930G, .name = "acer-aspire-4930g"},
2686 {.id = ALC882_FIXUP_ACER_ASPIRE_8930G, .name = "acer-aspire-8930g"},
2687 {.id = ALC883_FIXUP_ACER_EAPD, .name = "acer-aspire"},
2688 {.id = ALC885_FIXUP_MACPRO_GPIO, .name = "macpro-gpio"},
2689 {.id = ALC889_FIXUP_DAC_ROUTE, .name = "dac-route"},
2690 {.id = ALC889_FIXUP_MBP_VREF, .name = "mbp-vref"},
2691 {.id = ALC889_FIXUP_IMAC91_VREF, .name = "imac91-vref"},
2692 {.id = ALC889_FIXUP_MBA11_VREF, .name = "mba11-vref"},
2693 {.id = ALC889_FIXUP_MBA21_VREF, .name = "mba21-vref"},
2694 {.id = ALC889_FIXUP_MP11_VREF, .name = "mp11-vref"},
2695 {.id = ALC889_FIXUP_MP41_VREF, .name = "mp41-vref"},
2696 {.id = ALC882_FIXUP_INV_DMIC, .name = "inv-dmic"},
2697 {.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
2698 {.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
2699 {.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2700 {.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
2701 {.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
2715 SND_HDA_PIN_QUIRK(0x10ec1220, 0x1462, "MS-7C35", ALC1220_FIXUP_CLEVO_P950,
2731 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2735 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2740 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2745 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2749 spec = codec->spec; in patch_alc882()
2751 switch (codec->core.vendor_id) { in patch_alc882()
2760 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2764 alc_pre_init(codec); in patch_alc882()
2766 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2768 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2769 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2771 alc_auto_parse_customize_define(codec); in patch_alc882()
2773 if (has_cdefine_beep(codec)) in patch_alc882()
2774 spec->gen.beep_nid = 0x01; in patch_alc882()
2777 err = alc882_parse_auto_config(codec); in patch_alc882()
2781 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc882()
2787 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2792 alc_free(codec); in patch_alc882()
2800 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2804 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2899 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
2905 {.id = ALC262_FIXUP_INV_DMIC, .name = "inv-dmic"},
2906 {.id = ALC262_FIXUP_FSC_H270, .name = "fsc-h270"},
2907 {.id = ALC262_FIXUP_FSC_S7110, .name = "fsc-s7110"},
2908 {.id = ALC262_FIXUP_HP_Z200, .name = "hp-z200"},
2910 {.id = ALC262_FIXUP_LENOVO_3000, .name = "lenovo-3000"},
2912 {.id = ALC262_FIXUP_BENQ_T31, .name = "benq-t31"},
2919 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2924 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2928 spec = codec->spec; in patch_alc262()
2929 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc262()
2931 spec->shutup = alc_eapd_shutup; in patch_alc262()
2935 * under-run in patch_alc262()
2937 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2939 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2941 alc_pre_init(codec); in patch_alc262()
2943 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2945 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2947 alc_auto_parse_customize_define(codec); in patch_alc262()
2949 if (has_cdefine_beep(codec)) in patch_alc262()
2950 spec->gen.beep_nid = 0x01; in patch_alc262()
2953 err = alc262_parse_auto_config(codec); in patch_alc262()
2957 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc262()
2963 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2968 alc_free(codec); in patch_alc262()
2979 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2983 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2984 pval = kcontrol->private_value; in alc268_beep_switch_put()
2985 kcontrol->private_value = (pval & ~0xff) | 0x0f; in alc268_beep_switch_put()
2988 kcontrol->private_value = (pval & ~0xff) | 0x10; in alc268_beep_switch_put()
2991 kcontrol->private_value = pval; in alc268_beep_switch_put()
2992 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3005 .private_value = HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT)
3012 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3013 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
3045 {.id = ALC268_FIXUP_INV_DMIC, .name = "inv-dmic"},
3046 {.id = ALC268_FIXUP_HP_EAPD, .name = "hp-eapd"},
3054 /* below is codec SSID since multiple Toshiba laptops have the
3064 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3067 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3072 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3077 /* ALC268 has no aa-loopback mixer */ in patch_alc268()
3078 err = alc_alloc_spec(codec, 0); in patch_alc268()
3082 spec = codec->spec; in patch_alc268()
3083 if (has_cdefine_beep(codec)) in patch_alc268()
3084 spec->gen.beep_nid = 0x01; in patch_alc268()
3086 spec->shutup = alc_eapd_shutup; in patch_alc268()
3088 alc_pre_init(codec); in patch_alc268()
3090 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3091 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3094 err = alc268_parse_auto_config(codec); in patch_alc268()
3098 if (err > 0 && !spec->gen.no_analog && in patch_alc268()
3099 spec->gen.autocfg.speaker_pins[0] != 0x1d) { in patch_alc268()
3101 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, in patch_alc268()
3103 err = -ENOMEM; in patch_alc268()
3107 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3108 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3110 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3117 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3122 alc_free(codec); in patch_alc268()
3138 /* different alc269-variants */
3165 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3170 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3173 switch (spec->codec_variant) { in alc269_parse_auto_config()
3203 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3214 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3219 if (jack->unsol_res & (7 << 13)) in alc_headset_btn_callback()
3222 if (jack->unsol_res & (1 << 16 | 3 << 8)) in alc_headset_btn_callback()
3226 if (jack->unsol_res & (7 << 23)) in alc_headset_btn_callback()
3230 if (jack->unsol_res & (7 << 10)) in alc_headset_btn_callback()
3233 jack->jack->button_state = report; in alc_headset_btn_callback()
3236 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3238 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3240 if (!spec->has_hs_key) in alc_disable_headset_jack_key()
3243 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3251 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3252 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3253 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3259 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3260 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3265 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3267 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3269 if (!spec->has_hs_key) in alc_enable_headset_jack_key()
3272 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3280 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3281 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3282 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3288 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3289 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3294 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3297 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3301 spec->has_hs_key = 1; in alc_fixup_headset_jack()
3302 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3304 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, in alc_fixup_headset_jack()
3308 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3313 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3315 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3318 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3320 struct alc_spec *spec = codec->spec; in alc269_shutup()
3322 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_shutup()
3323 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3324 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_shutup()
3325 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3328 alc_shutup_pins(codec); in alc269_shutup()
3364 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3366 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3369 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3371 struct alc_spec *spec = codec->spec; in alc282_init()
3376 alc282_restore_default_value(codec); in alc282_init()
3380 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3381 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3383 /* Index 0x78 Direct Drive HP AMP LPM Control 1 */ in alc282_init()
3385 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3390 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3396 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3403 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3406 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3408 struct alc_spec *spec = codec->spec; in alc282_shutup()
3414 alc269_shutup(codec); in alc282_shutup()
3418 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3419 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3420 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3425 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3431 if (!spec->no_shutup_pins) in alc282_shutup()
3432 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3438 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3439 alc_shutup_pins(codec); in alc282_shutup()
3440 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3480 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3482 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3485 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3487 struct alc_spec *spec = codec->spec; in alc283_init()
3491 alc283_restore_default_value(codec); in alc283_init()
3497 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3499 /* Index 0x43 Direct Drive HP AMP LPM Control 1 */ in alc283_init()
3501 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3503 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3509 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3516 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3518 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3521 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3523 struct alc_spec *spec = codec->spec; in alc283_shutup()
3528 alc269_shutup(codec); in alc283_shutup()
3532 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3534 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3537 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3539 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3545 if (!spec->no_shutup_pins) in alc283_shutup()
3546 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3549 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3553 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3554 alc_shutup_pins(codec); in alc283_shutup()
3555 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3558 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3560 struct alc_spec *spec = codec->spec; in alc256_init()
3569 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3574 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3575 if (spec->ultra_low_power) { in alc256_init()
3576 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3577 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3578 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3579 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3580 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3584 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3587 if (hp_pin_sense || spec->ultra_low_power) in alc256_init()
3590 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3593 if (hp_pin_sense || spec->ultra_low_power) in alc256_init()
3596 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3597 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3598 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3599 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3602 * of PC Beep on 1Ah, and disable 1Ah loopback for all outputs. See in alc256_init()
3603 * Documentation/sound/hd-audio/realtek-pc-beep.rst for details of in alc256_init()
3606 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3609 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3611 struct alc_spec *spec = codec->spec; in alc256_shutup()
3618 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3623 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3626 if (hp_pin_sense || spec->ultra_low_power) in alc256_shutup()
3630 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3632 * when booting with headset plugged. So skip setting it for the codec alc257 in alc256_shutup()
3634 if (codec->core.vendor_id != 0x10ec0236 && in alc256_shutup()
3635 codec->core.vendor_id != 0x10ec0257) in alc256_shutup()
3636 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3638 if (!spec->no_shutup_pins) in alc256_shutup()
3639 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3642 if (hp_pin_sense || spec->ultra_low_power) in alc256_shutup()
3645 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3646 alc_shutup_pins(codec); in alc256_shutup()
3647 if (spec->ultra_low_power) { in alc256_shutup()
3649 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3650 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3651 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3652 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3653 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3658 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3660 struct alc_spec *spec = codec->spec; in alc225_init()
3668 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3669 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3674 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3675 if (spec->ultra_low_power) { in alc225_init()
3676 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3677 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3678 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3682 if (hp1_pin_sense || spec->ultra_low_power) in alc225_init()
3683 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3686 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3689 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) in alc225_init()
3692 if (hp1_pin_sense || spec->ultra_low_power) in alc225_init()
3693 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3696 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3699 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) in alc225_init()
3702 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3703 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3706 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3708 struct alc_spec *spec = codec->spec; in alc225_shutup()
3715 alc_disable_headset_jack_key(codec); in alc225_shutup()
3717 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3719 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3720 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3725 if (hp1_pin_sense || spec->ultra_low_power) in alc225_shutup()
3726 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3729 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3732 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) in alc225_shutup()
3735 if (hp1_pin_sense || spec->ultra_low_power) in alc225_shutup()
3736 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3739 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3742 if (hp1_pin_sense || hp2_pin_sense || spec->ultra_low_power) in alc225_shutup()
3745 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3746 alc_shutup_pins(codec); in alc225_shutup()
3747 if (spec->ultra_low_power) { in alc225_shutup()
3749 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3750 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3751 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3752 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3756 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3757 alc_enable_headset_jack_key(codec); in alc225_shutup()
3760 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3762 struct alc_spec *spec = codec->spec; in alc_default_init()
3771 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3776 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3782 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3789 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3791 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3796 alc269_shutup(codec); in alc_default_shutup()
3800 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3805 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3811 if (!spec->no_shutup_pins) in alc_default_shutup()
3812 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3818 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3819 alc_shutup_pins(codec); in alc_default_shutup()
3822 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3824 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3831 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3836 if (!spec->no_shutup_pins) in alc294_hp_init()
3837 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3840 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3841 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3844 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3847 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3850 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3854 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3856 struct alc_spec *spec = codec->spec; in alc294_init()
3859 if (!spec->done_hp_init || in alc294_init()
3860 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3861 alc294_hp_init(codec); in alc294_init()
3862 spec->done_hp_init = true; in alc294_init()
3864 alc_default_init(codec); in alc294_init()
3867 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3870 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3871 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3872 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3875 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3879 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3880 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3882 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3887 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3891 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3892 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3893 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3894 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3895 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3896 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3897 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3898 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3899 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3902 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3904 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3905 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3906 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3907 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3908 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3909 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3912 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3916 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3917 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3918 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3919 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3920 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3921 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3922 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3923 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3924 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3925 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3926 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3927 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3928 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3929 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3930 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3932 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3934 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3936 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3938 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3939 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3940 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3941 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3942 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3943 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3944 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3947 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3952 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
3953 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
3955 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3956 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3960 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3962 struct alc_spec *spec = codec->spec; in alc269_suspend()
3964 if (spec->has_alc5505_dsp) in alc269_suspend()
3965 alc5505_dsp_suspend(codec); in alc269_suspend()
3966 return alc_suspend(codec); in alc269_suspend()
3969 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3971 struct alc_spec *spec = codec->spec; in alc269_resume()
3973 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
3974 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3975 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
3976 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3980 codec->patch_ops.init(codec); in alc269_resume()
3982 if (spec->codec_variant == ALC269_TYPE_ALC269VB) in alc269_resume()
3983 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3984 if (spec->codec_variant == ALC269_TYPE_ALC269VB && in alc269_resume()
3985 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3989 snd_hda_regmap_sync(codec); in alc269_resume()
3990 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3992 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
3996 if (spec->gpio_data) in alc269_resume()
3997 alc_write_gpio_data(codec); in alc269_resume()
3999 if (spec->has_alc5505_dsp) in alc269_resume()
4000 alc5505_dsp_resume(codec); in alc269_resume()
4006 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4009 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4012 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc269_fixup_pincfg_no_hp_to_lineout()
4015 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4019 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4020 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4023 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4028 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4032 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4035 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4038 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4041 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_headset_mic()
4044 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4054 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4055 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4057 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4059 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4063 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4068 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4071 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4074 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4082 spec->gen.stream_analog_playback = &alc269_44k_pcm_analog_playback; in alc269_fixup_pcm_44k()
4083 spec->gen.stream_analog_capture = &alc269_44k_pcm_analog_capture; in alc269_fixup_pcm_44k()
4086 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4089 /* The digital-mic unit sends PDM (differential signal) instead of in alc269_fixup_stereo_dmic()
4095 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4098 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4100 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4102 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4103 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4106 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4109 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4112 spec->gen.automute_hook = alc269_quanta_automute; in alc269_fixup_quanta_mute()
4115 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4118 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4121 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4123 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc269_x101_hp_automute_hook()
4125 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4128 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4140 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4144 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4145 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4148 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4150 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4151 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4152 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4154 if (initval->value_0x23 != 0x1e) in alc298_huawei_mbx_stereo_seq()
4155 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4157 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4158 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4161 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4185 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4186 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4187 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4188 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4189 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4190 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4191 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4192 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4194 for (seq = dac_init; seq->value_0x23; seq++) in alc298_fixup_huawei_mbx_stereo()
4195 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4198 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4201 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4203 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc269_fixup_x101_headset_mic()
4204 spec->gen.hp_automute_hook = alc269_x101_hp_automute_hook; in alc269_fixup_x101_headset_mic()
4208 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4217 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4221 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4222 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4223 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4226 /* update mute-LED according to the speaker mute state via mic VREF pin */
4230 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4231 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4233 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4234 spec->mute_led_polarity, brightness); in vref_mute_led_set()
4239 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4243 struct alc_spec *spec = codec->spec; in led_power_filter()
4246 (nid != spec->mute_led_nid && nid != spec->cap_mute_led_nid)) in led_power_filter()
4250 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4251 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4253 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4256 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4259 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4267 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", &pol, &pin) != 2) in alc269_fixup_hp_mute_led()
4271 spec->mute_led_polarity = pol; in alc269_fixup_hp_mute_led()
4272 spec->mute_led_nid = pin - 0x0a + 0x18; in alc269_fixup_hp_mute_led()
4273 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4274 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4275 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4276 "Detected mute LED for %x:%d\n", spec->mute_led_nid, in alc269_fixup_hp_mute_led()
4277 spec->mute_led_polarity); in alc269_fixup_hp_mute_led()
4282 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4286 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4289 spec->mute_led_polarity = 0; in alc269_fixup_hp_mute_led_micx()
4290 spec->mute_led_nid = pin; in alc269_fixup_hp_mute_led_micx()
4291 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4292 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4296 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4299 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4302 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4305 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4308 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4311 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4315 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4320 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4327 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4328 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4330 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4331 spec->mute_led_polarity, !brightness); in gpio_mute_led_set()
4335 /* turn on/off mic-mute LED via GPIO per capture hook */
4339 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4340 struct alc_spec *spec = codec->spec; in micmute_led_set()
4342 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4343 spec->micmute_led_polarity, !brightness); in micmute_led_set()
4347 /* setup mute and mic-mute GPIO bits, add hooks appropriately */
4348 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4353 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4355 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4360 spec->gpio_mute_led_mask = mute_mask; in alc_fixup_hp_gpio_led()
4361 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4364 spec->gpio_mic_led_mask = micmute_mask; in alc_fixup_hp_gpio_led()
4365 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4369 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4372 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4375 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4378 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4381 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4384 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4387 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4390 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4393 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4396 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4399 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4402 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4405 spec->micmute_led_polarity = 1; in alc245_fixup_hp_gpio_led()
4406 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4409 /* turn on/off mic-mute LED per capture hook via VREF change */
4413 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4414 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4416 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4417 spec->micmute_led_polarity, brightness); in vref_micmute_led_set()
4421 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4424 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4426 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4431 spec->gpio_mask |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4432 spec->gpio_dir |= 0x10; in alc269_fixup_hp_gpio_mic1_led()
4433 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_gpio_mic1_led()
4434 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4435 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4439 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4442 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4444 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4446 spec->cap_mute_led_nid = 0x18; in alc280_fixup_hp_gpio4()
4447 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4448 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4455 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4458 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4462 spec->gpio_mask |= 0x01; in alc245_fixup_hp_x360_amp()
4463 spec->gpio_dir |= 0x01; in alc245_fixup_hp_x360_amp()
4467 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4469 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4476 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4482 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4485 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4490 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4494 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4497 spec->gpio_mask |= 0x04; in alc274_fixup_hp_envy_gpio()
4498 spec->gpio_dir |= 0x04; in alc274_fixup_hp_envy_gpio()
4499 spec->gen.pcm_playback_hook = alc274_hp_envy_pcm_hook; in alc274_fixup_hp_envy_gpio()
4503 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4510 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4511 on ? led->on : led->off); in alc_update_coef_led()
4514 /* update mute-LED according to the speaker mute state via COEF bit */
4518 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4519 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4521 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4522 spec->mute_led_polarity, brightness); in coef_mute_led_set()
4526 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4530 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4533 spec->mute_led_polarity = 0; in alc285_fixup_hp_mute_led_coefbit()
4534 spec->mute_led_coef.idx = 0x0b; in alc285_fixup_hp_mute_led_coefbit()
4535 spec->mute_led_coef.mask = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4536 spec->mute_led_coef.on = 1 << 3; in alc285_fixup_hp_mute_led_coefbit()
4537 spec->mute_led_coef.off = 0; in alc285_fixup_hp_mute_led_coefbit()
4538 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4542 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4546 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4549 spec->mute_led_polarity = 0; in alc236_fixup_hp_mute_led_coefbit()
4550 spec->mute_led_coef.idx = 0x34; in alc236_fixup_hp_mute_led_coefbit()
4551 spec->mute_led_coef.mask = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4552 spec->mute_led_coef.on = 0; in alc236_fixup_hp_mute_led_coefbit()
4553 spec->mute_led_coef.off = 1 << 5; in alc236_fixup_hp_mute_led_coefbit()
4554 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4558 /* turn on/off mic-mute LED per capture hook by coef bit */
4562 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4563 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4565 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4566 spec->micmute_led_polarity, brightness); in coef_micmute_led_set()
4570 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4573 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4576 spec->mic_led_coef.idx = 0x19; in alc285_fixup_hp_coef_micmute_led()
4577 spec->mic_led_coef.mask = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4578 spec->mic_led_coef.on = 1 << 13; in alc285_fixup_hp_coef_micmute_led()
4579 spec->mic_led_coef.off = 0; in alc285_fixup_hp_coef_micmute_led()
4580 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4584 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4587 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4590 spec->mic_led_coef.idx = 0x35; in alc236_fixup_hp_coef_micmute_led()
4591 spec->mic_led_coef.mask = 3 << 2; in alc236_fixup_hp_coef_micmute_led()
4592 spec->mic_led_coef.on = 2 << 2; in alc236_fixup_hp_coef_micmute_led()
4593 spec->mic_led_coef.off = 1 << 2; in alc236_fixup_hp_coef_micmute_led()
4594 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4598 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4601 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4602 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4605 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4608 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4609 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4612 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4615 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4618 spec->cap_mute_led_nid = 0x1a; in alc236_fixup_hp_micmute_led_vref()
4619 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4620 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4624 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4627 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4628 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4631 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4634 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4635 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4636 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4644 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4663 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4666 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4669 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4674 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4677 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4681 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 1); in gpio2_mic_hotkey_event()
4682 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
4683 input_report_key(spec->kb_dev, spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX], 0); in gpio2_mic_hotkey_event()
4684 input_sync(spec->kb_dev); in gpio2_mic_hotkey_event()
4687 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4689 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4692 spec->kb_dev = input_allocate_device(); in alc_register_micmute_input_device()
4693 if (!spec->kb_dev) { in alc_register_micmute_input_device()
4694 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4695 return -ENOMEM; in alc_register_micmute_input_device()
4698 spec->alc_mute_keycode_map[ALC_KEY_MICMUTE_INDEX] = KEY_MICMUTE; in alc_register_micmute_input_device()
4700 spec->kb_dev->name = "Microphone Mute Button"; in alc_register_micmute_input_device()
4701 spec->kb_dev->evbit[0] = BIT_MASK(EV_KEY); in alc_register_micmute_input_device()
4702 spec->kb_dev->keycodesize = sizeof(spec->alc_mute_keycode_map[0]); in alc_register_micmute_input_device()
4703 spec->kb_dev->keycodemax = ARRAY_SIZE(spec->alc_mute_keycode_map); in alc_register_micmute_input_device()
4704 spec->kb_dev->keycode = spec->alc_mute_keycode_map; in alc_register_micmute_input_device()
4705 for (i = 0; i < ARRAY_SIZE(spec->alc_mute_keycode_map); i++) in alc_register_micmute_input_device()
4706 set_bit(spec->alc_mute_keycode_map[i], spec->kb_dev->keybit); in alc_register_micmute_input_device()
4708 if (input_register_device(spec->kb_dev)) { in alc_register_micmute_input_device()
4709 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4710 input_free_device(spec->kb_dev); in alc_register_micmute_input_device()
4711 spec->kb_dev = NULL; in alc_register_micmute_input_device()
4712 return -ENOMEM; in alc_register_micmute_input_device()
4723 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4726 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4728 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4730 spec->init_amp = ALC_INIT_DEFAULT; in alc280_fixup_hp_gpio2_mic_hotkey()
4731 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4734 spec->gpio_mask |= 0x06; in alc280_fixup_hp_gpio2_mic_hotkey()
4735 spec->gpio_dir |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
4736 spec->gpio_data |= 0x02; in alc280_fixup_hp_gpio2_mic_hotkey()
4737 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4739 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4744 if (!spec->kb_dev) in alc280_fixup_hp_gpio2_mic_hotkey()
4749 input_unregister_device(spec->kb_dev); in alc280_fixup_hp_gpio2_mic_hotkey()
4750 spec->kb_dev = NULL; in alc280_fixup_hp_gpio2_mic_hotkey()
4757 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4760 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4762 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4764 spec->init_amp = ALC_INIT_DEFAULT; in alc233_fixup_lenovo_line2_mic_hotkey()
4765 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4768 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4773 if (!spec->kb_dev) in alc233_fixup_lenovo_line2_mic_hotkey()
4778 input_unregister_device(spec->kb_dev); in alc233_fixup_lenovo_line2_mic_hotkey()
4779 spec->kb_dev = NULL; in alc233_fixup_lenovo_line2_mic_hotkey()
4787 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4790 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4792 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4794 spec->cap_mute_led_nid = 0x18; in alc269_fixup_hp_line1_mic1_led()
4795 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4800 UPDATE_COEF(0x4a, 1<<8, 0),
4801 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0),
4810 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4812 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4816 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_unplugged()
4826 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_unplugged()
4860 UPDATE_COEFEX(0x57, 0x05, 1<<15|1<<13, 0x0), /* SET charge pump by verb */ in alc_headset_mode_unplugged()
4861 UPDATE_COEFEX(0x57, 0x03, 1<<10, 1<<10), /* SET EN_OSW to 1 */ in alc_headset_mode_unplugged()
4862 UPDATE_COEF(0x1a, 1<<3, 1<<3), /* Combo JD gating with LINE1-VREFO */ in alc_headset_mode_unplugged()
4887 if (spec->no_internal_mic_pin) { in alc_headset_mode_unplugged()
4888 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4892 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4894 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4900 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4905 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4909 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4913 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4916 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4917 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4920 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4923 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4926 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4934 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4935 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4938 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4941 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4945 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
4954 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_mic_in()
4960 UPDATE_COEF(0x35, 0, 1<<14), in alc_headset_mode_mic_in()
4981 UPDATE_COEFEX(0x57, 0x05, 0, 1<<15|1<<13), /* SET charge pump by verb */ in alc_headset_mode_mic_in()
4982 UPDATE_COEFEX(0x57, 0x03, 1<<10, 0), /* SET EN_OSW to 0 */ in alc_headset_mode_mic_in()
4983 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_mic_in()
4989 UPDATE_COEF(0xc3, 0, 1<<12), in alc_headset_mode_mic_in()
4993 UPDATE_COEFEX(0x57, 0x05, 1<<14, 1<<14), in alc_headset_mode_mic_in()
5005 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5007 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5008 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5009 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5010 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5016 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5017 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5018 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5019 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5024 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5025 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5026 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5027 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5031 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5032 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5033 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5034 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5039 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5040 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5041 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5044 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5045 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5049 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5050 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5051 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5052 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5055 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5059 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5060 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5063 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5064 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5065 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5066 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5074 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5075 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5076 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5077 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5078 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5081 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5084 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5106 UPDATE_COEFEX(0x57, 0x05, 1<<14, 0), /* Direct Drive HP Amp control(Set to verb control)*/ in alc_headset_mode_default()
5133 UPDATE_COEF(0x1a, 1<<3, 0), /* Combo JD gating without LINE1-VREFO */ in alc_headset_mode_default()
5150 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5157 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5158 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5161 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5167 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5168 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5170 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5175 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5179 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5184 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5187 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5190 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5193 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5196 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5199 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5203 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5239 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ in alc_headset_mode_ctia()
5255 UPDATE_COEF(0x63, 3<<14, 1<<14), in alc_headset_mode_ctia()
5259 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5261 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5267 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5272 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5276 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5279 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5280 if (val & (1 << 12)) { in alc_headset_mode_ctia()
5281 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5282 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5285 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5286 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5292 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5294 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5297 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5300 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5303 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5311 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5312 if (val & (1 << 9)) in alc_headset_mode_ctia()
5313 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5315 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5318 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5321 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5325 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5359 UPDATE_COEF(0x10, 7<<8, 7<<8), /* SET Line1 JD to 1 */ in alc_headset_mode_omtp()
5374 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5376 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5382 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5387 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5391 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5394 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5395 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5400 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5402 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5405 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5408 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5411 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5419 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5422 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5425 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5429 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5468 if (spec->no_internal_mic_pin) { in alc_determine_headset_type()
5469 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5473 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5475 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5477 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5484 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5485 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5486 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5488 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5491 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5494 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5496 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5499 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5500 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5502 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5505 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5511 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5513 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5518 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5520 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5524 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5527 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5531 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5532 if (val & (1 << 12)) { in alc_determine_headset_type()
5533 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5534 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5536 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5539 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5540 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5542 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5545 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5546 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5549 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5554 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5556 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5560 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5562 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5566 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5568 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5572 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5574 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5583 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5586 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5589 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5590 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5591 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5592 if (val & (1 << 9)) { in alc_determine_headset_type()
5593 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5594 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5596 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5599 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5600 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5602 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5605 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5606 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5607 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5609 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5612 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5620 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5622 spec->current_headset_type = is_ctia ? ALC_HEADSET_TYPE_CTIA : ALC_HEADSET_TYPE_OMTP; in alc_determine_headset_type()
5625 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5627 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5629 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in alc_update_headset_mode()
5634 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5636 else if (mux_pin == spec->headset_mic_pin) in alc_update_headset_mode()
5638 else if (mux_pin == spec->headphone_mic_pin) in alc_update_headset_mode()
5643 if (new_headset_mode == spec->current_headset_mode) { in alc_update_headset_mode()
5644 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5650 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5651 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_update_headset_mode()
5652 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_update_headset_mode()
5653 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
5656 if (spec->current_headset_type == ALC_HEADSET_TYPE_UNKNOWN) in alc_update_headset_mode()
5657 alc_determine_headset_type(codec); in alc_update_headset_mode()
5658 if (spec->current_headset_type == ALC_HEADSET_TYPE_CTIA) in alc_update_headset_mode()
5659 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5660 else if (spec->current_headset_type == ALC_HEADSET_TYPE_OMTP) in alc_update_headset_mode()
5661 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5662 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
5665 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5666 spec->gen.hp_jack_present = false; in alc_update_headset_mode()
5669 alc_headset_mode_default(codec); in alc_update_headset_mode()
5670 spec->gen.hp_jack_present = true; in alc_update_headset_mode()
5674 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5676 if (spec->headphone_mic_pin && spec->headphone_mic_pin != hp_pin) in alc_update_headset_mode()
5677 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5680 spec->current_headset_mode = new_headset_mode; in alc_update_headset_mode()
5682 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5685 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5689 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5692 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5695 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5696 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5699 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5702 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5703 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc_probe_headset_mode()
5706 for (i = 0; i < cfg->num_inputs; i++) { in alc_probe_headset_mode()
5707 if (cfg->inputs[i].is_headset_mic && !spec->headset_mic_pin) in alc_probe_headset_mode()
5708 spec->headset_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
5709 if (cfg->inputs[i].is_headphone_mic && !spec->headphone_mic_pin) in alc_probe_headset_mode()
5710 spec->headphone_mic_pin = cfg->inputs[i].pin; in alc_probe_headset_mode()
5713 WARN_ON(spec->gen.cap_sync_hook); in alc_probe_headset_mode()
5714 spec->gen.cap_sync_hook = alc_update_headset_mode_hook; in alc_probe_headset_mode()
5715 spec->gen.automute_hook = alc_update_headset_mode; in alc_probe_headset_mode()
5716 spec->gen.hp_automute_hook = alc_update_headset_jack_cb; in alc_probe_headset_mode()
5719 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5722 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5726 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC | HDA_PINCFG_HEADPHONE_MIC; in alc_fixup_headset_mode()
5729 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5732 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5733 spec->current_headset_mode = ALC_HEADSET_MODE_UNKNOWN; in alc_fixup_headset_mode()
5734 spec->current_headset_type = ALC_HEADSET_TYPE_UNKNOWN; in alc_fixup_headset_mode()
5736 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5741 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5745 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5746 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_no_hp_mic()
5749 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5752 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5771 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5773 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5779 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5785 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5789 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5791 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5794 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5798 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5799 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc255_no_hp_mic()
5800 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5803 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5806 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5809 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5811 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5813 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5816 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5819 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5821 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5823 spec->gpio_mask |= 0x40; in alc_fixup_headset_mode_dell_alc288()
5824 spec->gpio_dir |= 0x40; in alc_fixup_headset_mode_dell_alc288()
5825 spec->gen.hp_automute_hook = alc288_update_headset_jack_cb; in alc_fixup_headset_mode_dell_alc288()
5829 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5833 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5834 spec->gen.auto_mute_via_amp = 1; in alc_fixup_auto_mute_via_amp()
5838 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5842 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5843 spec->no_shutup_pins = 1; in alc_fixup_no_shutup()
5847 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5851 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5852 /* Disable AA-loopback as it causes white noise */ in alc_fixup_disable_aamix()
5853 spec->gen.mixer_nid = 0; in alc_fixup_disable_aamix()
5858 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5866 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5869 spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */ in alc_fixup_tpt440_dock()
5870 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt440_dock()
5871 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5872 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5876 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5884 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5887 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in alc_fixup_tpt470_dock()
5888 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5891 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5894 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5899 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5904 * ALC298 codec in alc_fixup_tpt470_dacs()
5910 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5913 spec->gen.preferred_dacs = preferred_pairs; in alc_fixup_tpt470_dacs()
5916 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
5922 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
5925 spec->gen.preferred_dacs = preferred_pairs; in alc295_fixup_asus_dacs()
5928 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5930 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5934 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5939 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5942 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5943 struct hda_input_mux *imux = &spec->gen.input_mux; in alc_fixup_dell_xps13()
5948 /* mic pin 0x19 must be initialized with Vref Hi-Z, otherwise in alc_fixup_dell_xps13()
5951 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
5952 spec->shutup = alc_shutup_dell_xps13; in alc_fixup_dell_xps13()
5956 for (i = 0; i < imux->num_items; i++) { in alc_fixup_dell_xps13()
5957 if (spec->gen.imux_pins[i] == 0x12) { in alc_fixup_dell_xps13()
5958 spec->gen.cur_mux[0] = i; in alc_fixup_dell_xps13()
5966 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
5969 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
5972 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc_fixup_headset_mode_alc662()
5973 spec->gen.hp_mic = 1; /* Mic-in is same pin as headphone */ in alc_fixup_headset_mode_alc662()
5975 /* Disable boost for mic-in permanently. (This code is only called in alc_fixup_headset_mode_alc662()
5977 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
5978 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
5980 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
5983 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
5987 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
5988 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
5989 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
5991 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
5995 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
5997 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
5998 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in find_ext_mic_pin()
6003 for (i = 0; i < cfg->num_inputs; i++) { in find_ext_mic_pin()
6004 if (cfg->inputs[i].type != AUTO_PIN_MIC) in find_ext_mic_pin()
6006 nid = cfg->inputs[i].pin; in find_ext_mic_pin()
6007 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6016 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6020 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6023 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6028 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6032 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6036 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6037 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in alc269_fixup_limit_int_mic_boost()
6042 Therefore limit the boost to 0 or 1. */ in alc269_fixup_limit_int_mic_boost()
6047 for (i = 0; i < cfg->num_inputs; i++) { in alc269_fixup_limit_int_mic_boost()
6048 hda_nid_t nid = cfg->inputs[i].pin; in alc269_fixup_limit_int_mic_boost()
6050 if (cfg->inputs[i].type != AUTO_PIN_MIC) in alc269_fixup_limit_int_mic_boost()
6052 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6056 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6064 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6067 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6071 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6073 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc283_hp_automute_hook()
6076 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6080 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6083 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6087 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6088 /* Disable AA-loopback as it causes white noise */ in alc283_fixup_chromebook()
6089 spec->gen.mixer_nid = 0; in alc283_fixup_chromebook()
6092 /* MIC2-VREF control */ in alc283_fixup_chromebook()
6094 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6096 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6101 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6104 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6108 spec->gen.hp_automute_hook = alc283_hp_automute_hook; in alc283_fixup_sense_combo_jack()
6111 /* MIC2-VREF control */ in alc283_fixup_sense_combo_jack()
6113 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6119 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6121 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6122 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6123 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6124 spec->gen.mute_bits |= (1ULL << 0x14); in asus_tx300_automute()
6127 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6130 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6138 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6140 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6141 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6142 spec->gen.auto_mute_via_amp = 1; in alc282_fixup_asus_tx300()
6143 spec->gen.automute_hook = asus_tx300_automute; in alc282_fixup_asus_tx300()
6144 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6148 spec->init_amp = ALC_INIT_DEFAULT; in alc282_fixup_asus_tx300()
6154 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6156 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6162 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6170 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6171 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6175 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6181 Amp-out capability. we change the speaker's route to: in alc298_fixup_speaker_volume()
6182 Node 0x02 (Audio Output) -> Node 0x0c (Audio Mixer) -> Node 0x17 ( in alc298_fixup_speaker_volume()
6183 Pin Complex), since Node 0x02 has Amp-out caps, we can adjust in alc298_fixup_speaker_volume()
6187 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6192 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6197 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6202 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6207 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6212 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6215 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6217 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6219 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6220 !spec->gen.hp_jack_present); in alc280_hp_gpio4_automute_hook()
6229 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6233 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6235 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6238 spec->gpio_mask |= 0x10; in alc280_fixup_hp_9480m()
6239 spec->gpio_dir |= 0x10; in alc280_fixup_hp_9480m()
6240 spec->gen.hp_automute_hook = alc280_hp_gpio4_automute_hook; in alc280_fixup_hp_9480m()
6244 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6248 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6251 spec->gpio_mask |= 0x04; in alc275_fixup_gpio4_off()
6252 spec->gpio_dir |= 0x04; in alc275_fixup_gpio4_off()
6259 * DAC1 (NID 0x02) -> Speaker (NID 0x14); some eq applied secretly
6260 * DAC2 (NID 0x03) -> Bass (NID 0x17) & Headphone (NID 0x21); sharing a DAC
6261 * DAC3 (NID 0x06) -> Unused, due to the lack of volume amp
6263 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6270 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6274 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6275 spec->gen.preferred_dacs = preferred_pairs; in alc285_fixup_thinkpad_x1_gen7()
6284 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6285 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6290 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6294 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6298 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6301 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
6302 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6303 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6304 "Rear-Panel Capture Volume" : in alc233_alc662_fixup_lenovo_dual_codecs()
6305 "Front-Panel Capture Volume"); in alc233_alc662_fixup_lenovo_dual_codecs()
6306 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6307 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6308 "Rear-Panel Capture Switch" : in alc233_alc662_fixup_lenovo_dual_codecs()
6309 "Front-Panel Capture Switch"); in alc233_alc662_fixup_lenovo_dual_codecs()
6314 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6320 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6324 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6327 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6336 spec->gen.preferred_dacs = preferred_pairs; in alc274_fixup_bind_dacs()
6337 spec->gen.auto_mute_via_amp = 1; in alc274_fixup_bind_dacs()
6338 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6342 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6348 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6351 spec->gen.preferred_dacs = preferred_pairs; in alc289_fixup_asus_ga401()
6352 spec->gen.obey_preferred_dacs = 1; in alc289_fixup_asus_ga401()
6357 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6363 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6366 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6368 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6374 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6375 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6383 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6384 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6389 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6392 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6396 spec->ultra_low_power = true; in alc295_fixup_chromebook()
6399 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6404 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6408 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6412 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6415 /* The Windows driver sets the codec up in a very different way where in alc294_gx502_toggle_output()
6418 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6419 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6421 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6424 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6428 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6433 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6440 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6445 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6451 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6452 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6454 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6457 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6460 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6465 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6469 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6474 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6481 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6484 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6489 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6494 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6497 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6502 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6503 spec->no_internal_mic_pin = true; in alc_fixup_no_int_mic()
6506 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6514 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6519 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6527 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6531 spec->micmute_led_polarity = 1; in alc285_fixup_hp_spectre_x360_eb1()
6533 spec->gpio_mask |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6534 spec->gpio_dir |= 0x01; in alc285_fixup_hp_spectre_x360_eb1()
6535 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6537 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6538 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6542 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6544 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6549 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6560 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6562 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6570 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6573 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6574 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6578 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6582 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6586 spec->gen.suppress_auto_mute = 1; in alc287_fixup_legion_15imhg05_speakers()
6604 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
6613 * plugged-in state, while the internal microphone is always in an in alc256_fixup_set_coef_defaults()
6616 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
6626 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
6637 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
6640 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
6645 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, in alc256_fixup_mic_no_presence_and_resume()
6646 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec in alc256_fixup_mic_no_presence_and_resume()
6649 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
6650 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
6651 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
6653 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
6891 * depending on the codec ID
6893 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
6899 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
6903 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
6988 { 0x1a, 0x2101103f }, /* dock line-out */
6989 { 0x1b, 0x23a11040 }, /* dock mic-in */
7023 { 0x19, 0x99a3092f }, /* int-mic */
7030 { 0x12, 0x99a3092f }, /* int-mic */
7042 { 0x19, 0x99a3092f }, /* int-mic */
7050 { 0x12, 0x99a3092f }, /* int-mic */
7238 { 0x1b, 0x99a7012f }, /* int-mic */
7258 { 0x12, 0x99a3092f }, /* int-mic */
7283 /* class-D output amp +5dB */
7309 { 0x12, 0x99a3092f }, /* int-mic */
7494 { 0x1b, 0x21011020 }, /* line-out */
7496 { 0x18, 0x2181103f }, /* line-in */
7505 { 0x1b, 0x21011020 }, /* line-out */
7506 { 0x18, 0x2181103f }, /* line-in */
7649 /* Disable pass-through path for FRONT 14h */
7964 /* Disable PCBEEP-IN passthrough */
8114 /* set 0x15 to HP-OUT ctrl */
8141 /* set 0x15 to HP-OUT ctrl */
8145 /* set 0x1b to HP-OUT */
8714 SND_PCI_QUIRK(0x1025, 0x072d, "Acer Aspire V5-571G", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8717 SND_PCI_QUIRK(0x1025, 0x0762, "Acer Aspire E1-472", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8718 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
8719 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
8720 SND_PCI_QUIRK(0x1025, 0x080d, "Acer Aspire V5-122P", ALC269_FIXUP_ASPIRE_HEADSET_MIC),
8723 SND_PCI_QUIRK(0x1025, 0x102b, "Acer Aspire C24-860", ALC286_FIXUP_ACER_AIO_MIC_NO_PRESENCE),
8724 SND_PCI_QUIRK(0x1025, 0x1065, "Acer Aspire C20-820", ALC269VC_FIXUP_ACER_HEADSET_MIC),
8726 SND_PCI_QUIRK(0x1025, 0x1094, "Acer Aspire E5-575T", ALC255_FIXUP_ACER_LIMIT_INT_MIC_BOOST),
8727 SND_PCI_QUIRK(0x1025, 0x1099, "Acer Aspire E5-523G", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8728 SND_PCI_QUIRK(0x1025, 0x110e, "Acer Aspire ES1-432", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8734 SND_PCI_QUIRK(0x1025, 0x1269, "Acer SWIFT SF314-54", ALC256_FIXUP_ACER_HEADSET_MIC),
8738 SND_PCI_QUIRK(0x1025, 0x129c, "Acer SWIFT SF314-55", ALC256_FIXUP_ACER_HEADSET_MIC),
8739 SND_PCI_QUIRK(0x1025, 0x129d, "Acer SWIFT SF313-51", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8740 SND_PCI_QUIRK(0x1025, 0x1300, "Acer SWIFT SF314-56", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8741 SND_PCI_QUIRK(0x1025, 0x1308, "Acer Aspire Z24-890", ALC286_FIXUP_ACER_AIO_HEADSET_MIC),
8742 SND_PCI_QUIRK(0x1025, 0x132a, "Acer TravelMate B114-21", ALC233_FIXUP_ACER_HEADSET_MIC),
8743 SND_PCI_QUIRK(0x1025, 0x1330, "Acer TravelMate X514-51T", ALC255_FIXUP_ACER_HEADSET_MIC),
8744 SND_PCI_QUIRK(0x1025, 0x141f, "Acer Spin SP513-54N", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8745 SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
8746 SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
8747 SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
8877 SND_PCI_QUIRK(0x103c, 0x841c, "HP Pavilion 15-CK0xx", ALC269_FIXUP_HP_MUTE_LED_MIC3),
8879 SND_PCI_QUIRK(0x103c, 0x84da, "HP OMEN dc0019-ur", ALC295_FIXUP_HP_OMEN),
8881 SND_PCI_QUIRK(0x103c, 0x8519, "HP Spectre x360 15-df0xxx", ALC285_FIXUP_HP_SPECTRE_X360),
8886 SND_PCI_QUIRK(0x103c, 0x86e7, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8887 SND_PCI_QUIRK(0x103c, 0x86e8, "HP Spectre x360 15-eb0xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8917 SND_PCI_QUIRK(0x103c, 0x8811, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
8918 SND_PCI_QUIRK(0x103c, 0x8812, "HP Spectre x360 15-eb1xxx", ALC285_FIXUP_HP_SPECTRE_X360_EB1),
9004 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-SZ6", ALC269_FIXUP_HEADSET_MODE),
9006 SND_PCI_QUIRK(0x144d, 0xc169, "Samsung Notebook 9 Pen (NP930SBE-K01US)", ALC298_FIXUP_SAMSUNG_AMP),
9007 SND_PCI_QUIRK(0x144d, 0xc176, "Samsung Notebook 9 Pro (NP930MBE-K04US)", ALC298_FIXUP_SAMSUNG_AMP),
9008 …SND_PCI_QUIRK(0x144d, 0xc189, "Samsung Galaxy Flex Book (NT950QCG-X716)", ALC298_FIXUP_SAMSUNG_AMP…
9009 …SND_PCI_QUIRK(0x144d, 0xc18a, "Samsung Galaxy Book Ion (NP930XCJ-K01US)", ALC298_FIXUP_SAMSUNG_AMP…
9010 …SND_PCI_QUIRK(0x144d, 0xc1a3, "Samsung Galaxy Book Pro (NP935XDB-KC1SE)", ALC298_FIXUP_SAMSUNG_AMP…
9013 SND_PCI_QUIRK(0x144d, 0xc812, "Samsung Notebook Pen S (NT950SBE-X58)", ALC298_FIXUP_SAMSUNG_AMP),
9014 …SND_PCI_QUIRK(0x144d, 0xc830, "Samsung Galaxy Book Ion (NT950XCJ-X716A)", ALC298_FIXUP_SAMSUNG_AMP…
9016 SND_PCI_QUIRK(0x1458, 0xfa53, "Gigabyte BXBT-2807", ALC283_FIXUP_HEADSET_MIC),
9017 SND_PCI_QUIRK(0x1462, 0xb120, "MSI Cubi MS-B120", ALC283_FIXUP_HEADSET_MIC),
9018 SND_PCI_QUIRK(0x1462, 0xb171, "Cubi N 8GL (MS-B171)", ALC283_FIXUP_HEADSET_MIC),
9055 SND_PCI_QUIRK(0x1558, 0x70f6, "Clevo NH77DPQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9068 SND_PCI_QUIRK(0x1558, 0x8562, "Clevo NH[5|7][0-9]RZ[Q]", ALC269_FIXUP_DMIC),
9075 SND_PCI_QUIRK(0x1558, 0x8a20, "Clevo NH55DCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9076 SND_PCI_QUIRK(0x1558, 0x8a51, "Clevo NH70RCQ-Y", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9077 SND_PCI_QUIRK(0x1558, 0x8d50, "Clevo NH55RCQ-M", ALC293_FIXUP_SYSTEM76_MIC_NO_PRESENCE),
9153 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9155 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
9172 SND_PCI_QUIRK(0x17aa, 0x508b, "Thinkpad X12 Gen 1", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),
9179 SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9180 SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
9184 …b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
9266 {.id = ALC269_FIXUP_AMIC, .name = "laptop-amic"},
9267 {.id = ALC269_FIXUP_DMIC, .name = "laptop-dmic"},
9268 {.id = ALC269_FIXUP_STEREO_DMIC, .name = "alc269-dmic"},
9269 {.id = ALC271_FIXUP_DMIC, .name = "alc271-dmic"},
9270 {.id = ALC269_FIXUP_INV_DMIC, .name = "inv-dmic"},
9271 {.id = ALC269_FIXUP_HEADSET_MIC, .name = "headset-mic"},
9272 {.id = ALC269_FIXUP_HEADSET_MODE, .name = "headset-mode"},
9273 {.id = ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC, .name = "headset-mode-no-hp-mic"},
9274 {.id = ALC269_FIXUP_LENOVO_DOCK, .name = "lenovo-dock"},
9275 {.id = ALC269_FIXUP_LENOVO_DOCK_LIMIT_BOOST, .name = "lenovo-dock-limit-boost"},
9276 {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9277 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic1-led"},
9278 {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
9279 {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
9280 {.id = ALC269_FIXUP_DELL3_MIC_NO_PRESENCE, .name = "dell-headset3"},
9281 {.id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE, .name = "dell-headset4"},
9282 {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
9283 {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
9284 {.id = ALC292_FIXUP_TPT440_DOCK, .name = "tpt440-dock"},
9287 {.id = ALC298_FIXUP_TPT470_DOCK_FIX, .name = "tpt470-dock-fix"},
9288 {.id = ALC298_FIXUP_TPT470_DOCK, .name = "tpt470-dock"},
9289 {.id = ALC233_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
9290 {.id = ALC700_FIXUP_INTEL_REFERENCE, .name = "alc700-ref"},
9292 {.id = ALC269_FIXUP_DELL_M101Z, .name = "dell-m101z"},
9293 {.id = ALC269_FIXUP_ASUS_G73JW, .name = "asus-g73jw"},
9294 {.id = ALC269_FIXUP_LENOVO_EAPD, .name = "lenovo-eapd"},
9295 {.id = ALC275_FIXUP_SONY_HWEQ, .name = "sony-hweq"},
9298 {.id = ALC269_FIXUP_LIFEBOOK_EXTMIC, .name = "lifebook-extmic"},
9299 {.id = ALC269_FIXUP_LIFEBOOK_HP_PIN, .name = "lifebook-hp-pin"},
9300 {.id = ALC255_FIXUP_LIFEBOOK_U7x7_HEADSET_MIC, .name = "lifebook-u7x7"},
9301 {.id = ALC269VB_FIXUP_AMIC, .name = "alc269vb-amic"},
9302 {.id = ALC269VB_FIXUP_DMIC, .name = "alc269vb-dmic"},
9303 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC1, .name = "hp-mute-led-mic1"},
9304 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC2, .name = "hp-mute-led-mic2"},
9305 {.id = ALC269_FIXUP_HP_MUTE_LED_MIC3, .name = "hp-mute-led-mic3"},
9306 {.id = ALC269_FIXUP_HP_GPIO_MIC1_LED, .name = "hp-gpio-mic1"},
9307 {.id = ALC269_FIXUP_HP_LINE1_MIC1_LED, .name = "hp-line1-mic1"},
9309 {.id = ALC286_FIXUP_SONY_MIC_NO_PRESENCE, .name = "sony-nomic"},
9310 {.id = ALC269_FIXUP_ASPIRE_HEADSET_MIC, .name = "aspire-headset-mic"},
9311 {.id = ALC269_FIXUP_ASUS_X101, .name = "asus-x101"},
9312 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK, .name = "acer-ao7xx"},
9313 {.id = ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572, .name = "acer-aspire-e1"},
9314 {.id = ALC269_FIXUP_ACER_AC700, .name = "acer-ac700"},
9315 {.id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST, .name = "limit-mic-boost"},
9316 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK, .name = "asus-zenbook"},
9317 {.id = ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A, .name = "asus-zenbook-ux31a"},
9319 {.id = ALC282_FIXUP_ASUS_TX300, .name = "asus-tx300"},
9320 {.id = ALC283_FIXUP_INT_MIC, .name = "alc283-int-mic"},
9321 {.id = ALC290_FIXUP_MONO_SPEAKERS_HSJACK, .name = "mono-speakers"},
9322 {.id = ALC290_FIXUP_SUBWOOFER_HSJACK, .name = "alc290-subwoofer"},
9324 {.id = ALC269_FIXUP_DMIC_THINKPAD_ACPI, .name = "dmic-thinkpad"},
9325 {.id = ALC255_FIXUP_ACER_MIC_NO_PRESENCE, .name = "alc255-acer"},
9326 {.id = ALC255_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc255-asus"},
9327 {.id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc255-dell1"},
9328 {.id = ALC255_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "alc255-dell2"},
9329 {.id = ALC293_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc293-dell1"},
9330 {.id = ALC283_FIXUP_HEADSET_MIC, .name = "alc283-headset"},
9331 {.id = ALC255_FIXUP_MIC_MUTE_LED, .name = "alc255-dell-mute"},
9332 {.id = ALC282_FIXUP_ASPIRE_V5_PINS, .name = "aspire-v5"},
9333 {.id = ALC269VB_FIXUP_ASPIRE_E1_COEF, .name = "aspire-e1-coef"},
9334 {.id = ALC280_FIXUP_HP_GPIO4, .name = "hp-gpio4"},
9335 {.id = ALC286_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
9336 {.id = ALC280_FIXUP_HP_GPIO2_MIC_HOTKEY, .name = "hp-gpio2-hotkey"},
9337 {.id = ALC280_FIXUP_HP_DOCK_PINS, .name = "hp-dock-pins"},
9338 {.id = ALC269_FIXUP_HP_DOCK_GPIO_MIC1_LED, .name = "hp-dock-gpio-mic"},
9339 {.id = ALC280_FIXUP_HP_9480M, .name = "hp-9480m"},
9340 {.id = ALC288_FIXUP_DELL_HEADSET_MODE, .name = "alc288-dell-headset"},
9341 {.id = ALC288_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc288-dell1"},
9342 {.id = ALC288_FIXUP_DELL_XPS_13, .name = "alc288-dell-xps13"},
9343 {.id = ALC292_FIXUP_DELL_E7X, .name = "dell-e7x"},
9344 {.id = ALC293_FIXUP_DISABLE_AAMIX_MULTIJACK, .name = "alc293-dell"},
9345 {.id = ALC298_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc298-dell1"},
9346 {.id = ALC298_FIXUP_DELL_AIO_MIC_NO_PRESENCE, .name = "alc298-dell-aio"},
9347 {.id = ALC275_FIXUP_DELL_XPS, .name = "alc275-dell-xps"},
9348 {.id = ALC293_FIXUP_LENOVO_SPK_NOISE, .name = "lenovo-spk-noise"},
9349 {.id = ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY, .name = "lenovo-hotkey"},
9350 {.id = ALC255_FIXUP_DELL_SPK_NOISE, .name = "dell-spk-noise"},
9351 {.id = ALC225_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "alc225-dell1"},
9352 {.id = ALC295_FIXUP_DISABLE_DAC3, .name = "alc295-disable-dac3"},
9353 {.id = ALC285_FIXUP_SPEAKER2_TO_DAC1, .name = "alc285-speaker2-to-dac1"},
9354 {.id = ALC280_FIXUP_HP_HEADSET_MIC, .name = "alc280-hp-headset"},
9355 {.id = ALC221_FIXUP_HP_FRONT_MIC, .name = "alc221-hp-mic"},
9356 {.id = ALC298_FIXUP_SPK_VOLUME, .name = "alc298-spk-volume"},
9357 {.id = ALC256_FIXUP_DELL_INSPIRON_7559_SUBWOOFER, .name = "dell-inspiron-7559"},
9358 {.id = ALC269_FIXUP_ATIV_BOOK_8, .name = "ativ-book"},
9359 {.id = ALC221_FIXUP_HP_MIC_NO_PRESENCE, .name = "alc221-hp-mic"},
9360 {.id = ALC256_FIXUP_ASUS_HEADSET_MODE, .name = "alc256-asus-headset"},
9361 {.id = ALC256_FIXUP_ASUS_MIC, .name = "alc256-asus-mic"},
9362 {.id = ALC256_FIXUP_ASUS_AIO_GPIO2, .name = "alc256-asus-aio"},
9363 {.id = ALC233_FIXUP_ASUS_MIC_NO_PRESENCE, .name = "alc233-asus"},
9364 {.id = ALC233_FIXUP_EAPD_COEF_AND_MIC_NO_PRESENCE, .name = "alc233-eapd"},
9365 {.id = ALC294_FIXUP_LENOVO_MIC_LOCATION, .name = "alc294-lenovo-mic"},
9366 {.id = ALC225_FIXUP_DELL_WYSE_MIC_NO_PRESENCE, .name = "alc225-wyse"},
9367 {.id = ALC274_FIXUP_DELL_AIO_LINEOUT_VERB, .name = "alc274-dell-aio"},
9368 {.id = ALC255_FIXUP_DUMMY_LINEOUT_VERB, .name = "alc255-dummy-lineout"},
9369 {.id = ALC255_FIXUP_DELL_HEADSET_MIC, .name = "alc255-dell-headset"},
9370 {.id = ALC295_FIXUP_HP_X360, .name = "alc295-hp-x360"},
9371 {.id = ALC225_FIXUP_HEADSET_JACK, .name = "alc-headset-jack"},
9372 {.id = ALC295_FIXUP_CHROME_BOOK, .name = "alc-chrome-book"},
9373 {.id = ALC299_FIXUP_PREDATOR_SPK, .name = "predator-spk"},
9374 {.id = ALC298_FIXUP_HUAWEI_MBX_STEREO, .name = "huawei-mbx-stereo"},
9375 {.id = ALC256_FIXUP_MEDION_HEADSET_NO_PRESENCE, .name = "alc256-medion-headset"},
9376 {.id = ALC298_FIXUP_SAMSUNG_AMP, .name = "alc298-samsung-amp"},
9377 {.id = ALC256_FIXUP_SAMSUNG_HEADPHONE_VERY_QUIET, .name = "alc256-samsung-headphone"},
9378 {.id = ALC255_FIXUP_XIAOMI_HEADSET_MIC, .name = "alc255-xiaomi-headset"},
9379 {.id = ALC274_FIXUP_HP_MIC, .name = "alc274-hp-mic-detect"},
9380 {.id = ALC245_FIXUP_HP_X360_AMP, .name = "alc245-hp-x360-amp"},
9381 {.id = ALC295_FIXUP_HP_OMEN, .name = "alc295-hp-omen"},
9382 {.id = ALC285_FIXUP_HP_SPECTRE_X360, .name = "alc285-hp-spectre-x360"},
9383 {.id = ALC285_FIXUP_HP_SPECTRE_X360_EB1, .name = "alc285-hp-spectre-x360-eb1"},
9384 {.id = ALC287_FIXUP_IDEAPAD_BASS_SPK_AMP, .name = "alc287-ideapad-bass-spk-amp"},
9385 {.id = ALC623_FIXUP_LENOVO_THINKSTATION_P340, .name = "alc623-lenovo-thinkstation-p340"},
9386 {.id = ALC255_FIXUP_ACER_HEADPHONE_AND_MIC, .name = "alc255-acer-headphone-and-mic"},
9387 {.id = ALC285_FIXUP_HP_GPIO_AMP_INIT, .name = "alc285-hp-amp-init"},
9830 * at most one tbl is allowed to define for the same vendor and same codec
9848 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
9850 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
9853 if (spec->codec_variant != ALC269_TYPE_ALC269VB) in alc269_fill_coef()
9856 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
9857 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9858 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
9861 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
9862 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9863 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
9866 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
9868 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
9871 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
9872 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
9873 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) { in alc269_fill_coef()
9875 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
9877 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
9878 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) { in alc269_fill_coef()
9880 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
9885 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
9890 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
9895 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
9899 spec = codec->spec; in patch_alc269()
9900 spec->gen.shared_mic_vref_pin = 0x18; in patch_alc269()
9901 codec->power_save_node = 0; in patch_alc269()
9904 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
9905 codec->patch_ops.resume = alc269_resume; in patch_alc269()
9907 spec->shutup = alc_default_shutup; in patch_alc269()
9908 spec->init_hook = alc_default_init; in patch_alc269()
9910 switch (codec->core.vendor_id) { in patch_alc269()
9912 spec->codec_variant = ALC269_TYPE_ALC269VA; in patch_alc269()
9913 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
9915 if (codec->bus->pci && in patch_alc269()
9916 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
9917 spec->cdefine.platform_type == 1) in patch_alc269()
9918 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
9919 spec->codec_variant = ALC269_TYPE_ALC269VB; in patch_alc269()
9922 if (codec->bus->pci && in patch_alc269()
9923 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
9924 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
9925 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
9926 spec->codec_variant = ALC269_TYPE_ALC269VC; in patch_alc269()
9929 spec->codec_variant = ALC269_TYPE_ALC269VD; in patch_alc269()
9932 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
9936 spec->shutup = alc269_shutup; in patch_alc269()
9937 spec->init_hook = alc269_fill_coef; in patch_alc269()
9938 alc269_fill_coef(codec); in patch_alc269()
9943 spec->codec_variant = ALC269_TYPE_ALC280; in patch_alc269()
9946 spec->codec_variant = ALC269_TYPE_ALC282; in patch_alc269()
9947 spec->shutup = alc282_shutup; in patch_alc269()
9948 spec->init_hook = alc282_init; in patch_alc269()
9952 spec->codec_variant = ALC269_TYPE_ALC283; in patch_alc269()
9953 spec->shutup = alc283_shutup; in patch_alc269()
9954 spec->init_hook = alc283_init; in patch_alc269()
9958 spec->codec_variant = ALC269_TYPE_ALC284; in patch_alc269()
9961 spec->codec_variant = ALC269_TYPE_ALC293; in patch_alc269()
9965 spec->codec_variant = ALC269_TYPE_ALC286; in patch_alc269()
9968 spec->codec_variant = ALC269_TYPE_ALC298; in patch_alc269()
9972 spec->codec_variant = ALC269_TYPE_ALC255; in patch_alc269()
9973 spec->shutup = alc256_shutup; in patch_alc269()
9974 spec->init_hook = alc256_init; in patch_alc269()
9980 spec->codec_variant = ALC269_TYPE_ALC256; in patch_alc269()
9981 spec->shutup = alc256_shutup; in patch_alc269()
9982 spec->init_hook = alc256_init; in patch_alc269()
9983 spec->gen.mixer_nid = 0; /* ALC256 does not have any loopback mixer path */ in patch_alc269()
9986 spec->codec_variant = ALC269_TYPE_ALC257; in patch_alc269()
9987 spec->shutup = alc256_shutup; in patch_alc269()
9988 spec->init_hook = alc256_init; in patch_alc269()
9989 spec->gen.mixer_nid = 0; in patch_alc269()
9996 spec->codec_variant = ALC269_TYPE_ALC215; in patch_alc269()
9997 spec->shutup = alc225_shutup; in patch_alc269()
9998 spec->init_hook = alc225_init; in patch_alc269()
9999 spec->gen.mixer_nid = 0; in patch_alc269()
10004 spec->codec_variant = ALC269_TYPE_ALC225; in patch_alc269()
10005 spec->shutup = alc225_shutup; in patch_alc269()
10006 spec->init_hook = alc225_init; in patch_alc269()
10007 spec->gen.mixer_nid = 0; /* no loopback on ALC225, ALC295 and ALC299 */ in patch_alc269()
10012 spec->codec_variant = ALC269_TYPE_ALC294; in patch_alc269()
10013 spec->gen.mixer_nid = 0; /* ALC2x4 does not have any loopback mixer path */ in patch_alc269()
10014 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
10015 spec->init_hook = alc294_init; in patch_alc269()
10018 spec->codec_variant = ALC269_TYPE_ALC300; in patch_alc269()
10019 spec->gen.mixer_nid = 0; /* no loopback on ALC300 */ in patch_alc269()
10022 spec->codec_variant = ALC269_TYPE_ALC623; in patch_alc269()
10028 spec->codec_variant = ALC269_TYPE_ALC700; in patch_alc269()
10029 spec->gen.mixer_nid = 0; /* ALC700 does not have any loopback mixer path */ in patch_alc269()
10030 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
10031 spec->init_hook = alc294_init; in patch_alc269()
10036 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
10037 spec->has_alc5505_dsp = 1; in patch_alc269()
10038 spec->init_hook = alc5505_dsp_init; in patch_alc269()
10041 alc_pre_init(codec); in patch_alc269()
10043 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
10049 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
10050 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
10051 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
10052 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
10055 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
10056 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
10057 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
10059 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
10061 alc_auto_parse_customize_define(codec); in patch_alc269()
10063 if (has_cdefine_beep(codec)) in patch_alc269()
10064 spec->gen.beep_nid = 0x01; in patch_alc269()
10067 err = alc269_parse_auto_config(codec); in patch_alc269()
10071 if (!spec->gen.no_analog && spec->gen.beep_nid && spec->gen.mixer_nid) { in patch_alc269()
10072 err = set_beep_amp(spec, spec->gen.mixer_nid, 0x04, HDA_INPUT); in patch_alc269()
10077 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
10082 alc_free(codec); in patch_alc269()
10090 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
10094 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
10107 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
10110 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
10115 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
10119 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
10120 spec->gen.keep_vref_in_automute = 1; in alc861_fixup_asus_amp_vref_0f()
10123 /* suppress the jack-detection */
10124 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
10128 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
10179 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
10184 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
10188 spec = codec->spec; in patch_alc861()
10189 if (has_cdefine_beep(codec)) in patch_alc861()
10190 spec->gen.beep_nid = 0x23; in patch_alc861()
10193 spec->power_hook = alc_power_eapd; in patch_alc861()
10196 alc_pre_init(codec); in patch_alc861()
10198 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
10199 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
10202 err = alc861_parse_auto_config(codec); in patch_alc861()
10206 if (!spec->gen.no_analog) { in patch_alc861()
10212 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
10217 alc_free(codec); in patch_alc861()
10222 * ALC861-VD support
10228 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
10232 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
10241 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
10245 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
10246 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
10251 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
10254 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
10257 spec->gpio_mask |= 0x02; in alc660vd_fixup_asus_gpio1()
10258 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
10274 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
10275 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_FIX_DALLAS),
10281 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
10286 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
10290 spec = codec->spec; in patch_alc861vd()
10291 if (has_cdefine_beep(codec)) in patch_alc861vd()
10292 spec->gen.beep_nid = 0x23; in patch_alc861vd()
10294 spec->shutup = alc_eapd_shutup; in patch_alc861vd()
10296 alc_pre_init(codec); in patch_alc861vd()
10298 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
10299 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
10302 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
10306 if (!spec->gen.no_analog) { in patch_alc861vd()
10312 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
10317 alc_free(codec); in patch_alc861vd()
10327 * 6-channel independent captures.
10329 * In addition, an independent DAC for the multi-playback (not used in this
10337 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
10344 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
10345 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
10346 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
10350 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
10353 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
10358 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
10363 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
10376 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
10380 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
10381 spec->gen.pcm_rec[0]->stream[0].chmap = asus_pcm_2_1_chmaps; in alc_fixup_bass_chmap()
10386 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
10390 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
10391 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
10396 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
10399 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
10401 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
10403 spec->mute_led_polarity = 1; in alc662_fixup_led_gpio1()
10404 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
10408 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
10411 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
10414 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
10416 vref = spec->gen.hp_jack_present ? PIN_VREF80 : 0; in alc662_usi_automute_hook()
10418 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
10422 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
10425 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
10427 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc662_fixup_usi_headset_mic()
10428 spec->gen.hp_automute_hook = alc662_usi_automute_hook; in alc662_fixup_usi_headset_mic()
10432 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
10438 * 0x15 - front left/front right in alc662_aspire_ethos_mute_speakers()
10439 * 0x18 - front center/ LFE in alc662_aspire_ethos_mute_speakers()
10441 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
10442 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
10443 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
10445 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10446 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10450 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
10454 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
10459 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
10462 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
10468 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
10473 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
10476 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
10486 spec->gen.mixer_nid = 0; in alc671_fixup_hp_headset_mic2()
10487 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in alc671_fixup_hp_headset_mic2()
10488 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
10491 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
10496 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
10499 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
10502 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
10503 vref = spec->gen.hp_jack_present ? (PIN_HP | AC_PINCTL_VREF_100) : PIN_HP; in alc897_hp_automute_hook()
10504 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc897_hp_automute_hook()
10508 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
10511 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
10513 spec->gen.hp_automute_hook = alc897_hp_automute_hook; in alc897_fixup_lenovo_headset_mic()
10541 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
10543 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
10635 {0x19, 0x90a7013f}, /* int-mic */
10671 { 0x19, 0x99a3092f }, /* int-mic */
10683 { 0x19, 0x99a3092f }, /* int-mic */
10696 { 0x19, 0x99a3094f }, /* int-mic */
10709 { 0x19, 0x99a3094f }, /* int-mic */
10723 { 0x19, 0x99a3094f }, /* int-mic */
10735 { 0x19, 0x99a3094f }, /* int-mic */
10748 { 0x19, 0x99a3094f }, /* int-mic */
10760 { 0x12, 0x99a30970 }, /* int-mic */
11038 SND_PCI_QUIRK(0x1025, 0x123c, "Acer Nitro N50-600", ALC662_FIXUP_ACER_NITRO_HEADSET_MODE),
11150 {.id = ALC662_FIXUP_HP_RP5800, .name = "hp-rp5800"},
11151 {.id = ALC662_FIXUP_ASUS_MODE1, .name = "asus-mode1"},
11152 {.id = ALC662_FIXUP_ASUS_MODE2, .name = "asus-mode2"},
11153 {.id = ALC662_FIXUP_ASUS_MODE3, .name = "asus-mode3"},
11154 {.id = ALC662_FIXUP_ASUS_MODE4, .name = "asus-mode4"},
11155 {.id = ALC662_FIXUP_ASUS_MODE5, .name = "asus-mode5"},
11156 {.id = ALC662_FIXUP_ASUS_MODE6, .name = "asus-mode6"},
11157 {.id = ALC662_FIXUP_ASUS_MODE7, .name = "asus-mode7"},
11158 {.id = ALC662_FIXUP_ASUS_MODE8, .name = "asus-mode8"},
11159 {.id = ALC662_FIXUP_ZOTAC_Z68, .name = "zotac-z68"},
11160 {.id = ALC662_FIXUP_INV_DMIC, .name = "inv-dmic"},
11161 {.id = ALC662_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc662-headset-multi"},
11162 {.id = ALC668_FIXUP_DELL_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
11163 {.id = ALC662_FIXUP_HEADSET_MODE, .name = "alc662-headset"},
11164 {.id = ALC668_FIXUP_HEADSET_MODE, .name = "alc668-headset"},
11168 {.id = ALC668_FIXUP_DELL_XPS13, .name = "dell-xps13"},
11169 {.id = ALC662_FIXUP_ASUS_Nx50, .name = "asus-nx50"},
11170 {.id = ALC668_FIXUP_ASUS_Nx51, .name = "asus-nx51"},
11171 {.id = ALC668_FIXUP_ASUS_G751, .name = "asus-g751"},
11172 {.id = ALC891_FIXUP_HEADSET_MODE, .name = "alc891-headset"},
11173 {.id = ALC891_FIXUP_DELL_MIC_NO_PRESENCE, .name = "alc891-headset-multi"},
11174 {.id = ALC662_FIXUP_ACER_VERITON, .name = "acer-veriton"},
11175 {.id = ALC892_FIXUP_ASROCK_MOBO, .name = "asrock-mobo"},
11176 {.id = ALC662_FIXUP_USI_HEADSET_MODE, .name = "usi-headset"},
11177 {.id = ALC662_FIXUP_LENOVO_MULTI_CODECS, .name = "dual-codecs"},
11178 {.id = ALC669_FIXUP_ACER_ASPIRE_ETHOS, .name = "aspire-ethos"},
11243 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
11248 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
11252 spec = codec->spec; in patch_alc662()
11254 spec->shutup = alc_eapd_shutup; in patch_alc662()
11257 spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP; in patch_alc662()
11259 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
11261 switch (codec->core.vendor_id) { in patch_alc662()
11263 spec->init_hook = alc668_restore_default_value; in patch_alc662()
11267 alc_pre_init(codec); in patch_alc662()
11269 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
11271 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
11272 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
11274 alc_auto_parse_customize_define(codec); in patch_alc662()
11276 if (has_cdefine_beep(codec)) in patch_alc662()
11277 spec->gen.beep_nid = 0x01; in patch_alc662()
11279 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
11280 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
11281 spec->cdefine.platform_type == 1) { in patch_alc662()
11282 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
11288 err = alc662_parse_auto_config(codec); in patch_alc662()
11292 if (!spec->gen.no_analog && spec->gen.beep_nid) { in patch_alc662()
11293 switch (codec->core.vendor_id) { in patch_alc662()
11311 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
11316 alc_free(codec); in patch_alc662()
11324 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
11326 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
11331 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
11335 /* ALC680 has no aa-loopback mixer */ in patch_alc680()
11336 err = alc_alloc_spec(codec, 0); in patch_alc680()
11341 err = alc680_parse_auto_config(codec); in patch_alc680()
11343 alc_free(codec); in patch_alc680()
11397 HDA_CODEC_ENTRY(0x10ec0660, "ALC660-VD", patch_alc861vd),
11399 HDA_CODEC_ENTRY(0x10ec0862, "ALC861-VD", patch_alc861vd),
11438 MODULE_DESCRIPTION("Realtek HD-audio codec");