Lines Matching refs:codec
110 void (*init_hook)(struct hda_codec *codec);
112 void (*power_hook)(struct hda_codec *codec);
114 void (*shutup)(struct hda_codec *codec);
142 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
144 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
146 snd_hda_power_up_pm(codec); in coef_mutex_lock()
150 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
152 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
155 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
158 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
163 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
164 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
168 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
173 coef_mutex_lock(codec); in alc_read_coefex_idx()
174 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
175 coef_mutex_unlock(codec); in alc_read_coefex_idx()
179 #define alc_read_coef_idx(codec, coef_idx) \ argument
180 alc_read_coefex_idx(codec, 0x20, coef_idx)
182 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
185 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
186 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
189 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
192 coef_mutex_lock(codec); in alc_write_coefex_idx()
193 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
194 coef_mutex_unlock(codec); in alc_write_coefex_idx()
197 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
198 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
200 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
204 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
207 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
211 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
215 coef_mutex_lock(codec); in alc_update_coefex_idx()
216 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
217 coef_mutex_unlock(codec); in alc_update_coefex_idx()
220 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
221 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
224 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
226 struct alc_spec *spec = codec->spec; in alc_get_coef0()
229 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
247 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
250 coef_mutex_lock(codec); in alc_process_coef_fw()
253 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
255 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
258 coef_mutex_unlock(codec); in alc_process_coef_fw()
266 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
268 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
275 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
277 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
279 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
283 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
286 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
294 alc_write_gpio_data(codec); in alc_update_gpio_data()
297 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
299 struct alc_spec *spec = codec->spec; in alc_write_gpio()
304 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
306 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
310 alc_write_gpio_data(codec); in alc_write_gpio()
313 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
317 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
320 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
323 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
326 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
329 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
332 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
335 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
338 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
341 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
344 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
348 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
356 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
358 struct alc_spec *spec = codec->spec; in alc_fix_pll()
361 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
365 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
368 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
372 alc_fix_pll(codec); in alc_fix_pll_init()
376 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
383 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
389 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
398 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
402 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
406 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
410 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
412 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
414 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
418 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
422 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
424 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
426 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
432 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
437 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
457 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
460 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
463 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
464 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
467 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
476 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
480 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
489 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
493 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
496 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
499 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
503 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
507 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
514 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
520 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
522 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
527 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
533 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
535 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
537 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
538 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
543 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
551 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
554 static int find_ext_mic_pin(struct hda_codec *codec);
556 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
559 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
565 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
568 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
571 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
575 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
578 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
580 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
582 switch (codec->core.vendor_id) { in alc_shutup_pins()
590 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
594 snd_hda_shutup_pins(codec); in alc_shutup_pins()
602 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
604 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
606 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
609 alc_shutup_pins(codec); in alc_eapd_shutup()
613 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
615 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
616 alc_write_gpio(codec); in alc_auto_init_amp()
619 switch (codec->core.vendor_id) { in alc_auto_init_amp()
621 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
627 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
630 alc888_coef_init(codec); in alc_auto_init_amp()
656 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
659 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
666 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
669 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
673 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
677 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
681 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
692 if (!codec->bus->pci) in alc_auto_parse_customize_define()
694 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
695 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
699 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
701 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
704 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
705 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
729 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
731 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
733 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
734 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
735 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
736 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
737 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
738 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
739 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
768 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
772 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
781 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
782 if (codec->bus->pci && in alc_subsystem_id()
783 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
796 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
798 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
799 codec_dbg(codec, in alc_subsystem_id()
816 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
817 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
829 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
832 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
835 alc_setup_gpio(codec, 0x03); in alc_subsystem_id()
870 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
872 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
873 struct alc_spec *spec = codec->spec; in alc_ssid_check()
875 codec_dbg(codec, in alc_ssid_check()
885 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
888 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
894 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
898 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
902 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
911 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
913 alc_fill_eapd_coef(codec); in alc_pre_init()
916 #define is_s3_resume(codec) \ argument
917 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
918 #define is_s4_resume(codec) \ argument
919 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
921 static int alc_init(struct hda_codec *codec) in alc_init() argument
923 struct alc_spec *spec = codec->spec; in alc_init()
926 if (is_s4_resume(codec)) in alc_init()
927 alc_pre_init(codec); in alc_init()
930 spec->init_hook(codec); in alc_init()
933 snd_hda_gen_init(codec); in alc_init()
934 alc_fix_pll(codec); in alc_init()
935 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
936 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
938 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
946 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
948 struct alc_spec *spec = codec->spec; in alc_shutup()
950 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
954 spec->shutup(codec); in alc_shutup()
956 alc_shutup_pins(codec); in alc_shutup()
959 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
961 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
964 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
966 struct alc_spec *spec = codec->spec; in alc_suspend()
967 alc_shutup(codec); in alc_suspend()
969 spec->power_hook(codec); in alc_suspend()
973 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
975 struct alc_spec *spec = codec->spec; in alc_resume()
979 codec->patch_ops.init(codec); in alc_resume()
980 snd_hda_regmap_sync(codec); in alc_resume()
981 hda_call_check_power_status(codec, 0x01); in alc_resume()
1002 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1073 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1079 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1081 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1082 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1085 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1088 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1090 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1093 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1094 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1146 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1148 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1150 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1157 #define has_cdefine_beep(codec) 0 argument
1164 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1168 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1172 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1178 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1180 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1188 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1195 codec->spec = spec; in alc_alloc_spec()
1199 codec->single_adc_amp = 1; in alc_alloc_spec()
1201 codec->spdif_status_reset = 1; in alc_alloc_spec()
1202 codec->forced_resume = 1; in alc_alloc_spec()
1203 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1206 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1214 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1218 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1253 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1257 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1636 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1641 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1645 spec = codec->spec; in patch_alc880()
1649 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1651 alc_pre_init(codec); in patch_alc880()
1653 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1655 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1658 err = alc880_parse_auto_config(codec); in patch_alc880()
1668 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1673 alc_free(codec); in patch_alc880()
1681 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1685 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1705 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1707 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1709 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1712 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1715 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1724 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1726 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1730 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1733 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1752 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1758 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1761 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1766 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1769 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1885 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1890 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1894 spec = codec->spec; in patch_alc260()
1904 alc_pre_init(codec); in patch_alc260()
1906 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1908 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1911 err = alc260_parse_auto_config(codec); in patch_alc260()
1921 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1926 alc_free(codec); in patch_alc260()
1990 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1995 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1999 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2002 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2005 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2012 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2019 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2020 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2021 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2022 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2026 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2027 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2028 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2029 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2034 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2038 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2044 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2047 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2049 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2055 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2058 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2063 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2065 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2071 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2077 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2081 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2087 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2091 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2097 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2104 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2107 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2114 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2120 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2123 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2135 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2138 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2143 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2145 snd_ctl_rename(codec->card, kctl, newname); in rename_ctl()
2148 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2152 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2156 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2160 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2161 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2164 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2165 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2172 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2187 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2188 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2191 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2196 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2205 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2209 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2210 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2213 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2216 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2220 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2221 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2224 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2227 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2230 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2236 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2239 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2242 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2245 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2723 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2727 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2732 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2737 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2741 spec = codec->spec; in patch_alc882()
2743 switch (codec->core.vendor_id) { in patch_alc882()
2752 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2756 alc_pre_init(codec); in patch_alc882()
2758 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2760 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2761 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2763 alc_auto_parse_customize_define(codec); in patch_alc882()
2765 if (has_cdefine_beep(codec)) in patch_alc882()
2769 err = alc882_parse_auto_config(codec); in patch_alc882()
2779 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2784 alc_free(codec); in patch_alc882()
2792 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2796 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2911 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2916 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2920 spec = codec->spec; in patch_alc262()
2929 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2931 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2933 alc_pre_init(codec); in patch_alc262()
2935 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2937 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2939 alc_auto_parse_customize_define(codec); in patch_alc262()
2941 if (has_cdefine_beep(codec)) in patch_alc262()
2945 err = alc262_parse_auto_config(codec); in patch_alc262()
2955 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2960 alc_free(codec); in patch_alc262()
2971 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2975 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2984 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3056 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3059 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3064 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3070 err = alc_alloc_spec(codec, 0); in patch_alc268()
3074 spec = codec->spec; in patch_alc268()
3075 if (has_cdefine_beep(codec)) in patch_alc268()
3080 alc_pre_init(codec); in patch_alc268()
3082 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3083 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3086 err = alc268_parse_auto_config(codec); in patch_alc268()
3099 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3100 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3102 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3109 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3114 alc_free(codec); in patch_alc268()
3159 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3164 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3199 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3210 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3229 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3232 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3234 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3239 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3247 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3248 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3249 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3255 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3256 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3261 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3263 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3268 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3276 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3277 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3278 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3284 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3285 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3290 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3293 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3299 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3304 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3307 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3311 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3316 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3318 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3321 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3323 struct alc_spec *spec = codec->spec; in alc269_shutup()
3326 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3328 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3331 alc_shutup_pins(codec); in alc269_shutup()
3367 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3369 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3372 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3374 struct alc_spec *spec = codec->spec; in alc282_init()
3379 alc282_restore_default_value(codec); in alc282_init()
3383 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3384 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3388 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3393 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3399 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3406 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3409 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3411 struct alc_spec *spec = codec->spec; in alc282_shutup()
3417 alc269_shutup(codec); in alc282_shutup()
3421 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3422 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3423 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3428 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3435 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3441 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3442 alc_shutup_pins(codec); in alc282_shutup()
3443 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3483 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3485 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3488 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3490 struct alc_spec *spec = codec->spec; in alc283_init()
3494 alc283_restore_default_value(codec); in alc283_init()
3500 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3504 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3506 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3512 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3519 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3521 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3524 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3526 struct alc_spec *spec = codec->spec; in alc283_shutup()
3531 alc269_shutup(codec); in alc283_shutup()
3535 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3537 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3540 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3542 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3549 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3552 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3556 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3557 alc_shutup_pins(codec); in alc283_shutup()
3558 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3561 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3563 struct alc_spec *spec = codec->spec; in alc256_init()
3572 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3577 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3579 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3580 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3581 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3582 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3583 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3587 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3593 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3599 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3600 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3601 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3602 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3609 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3612 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3614 struct alc_spec *spec = codec->spec; in alc256_shutup()
3621 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3626 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3637 if (codec->core.vendor_id != 0x10ec0236 && in alc256_shutup()
3638 codec->core.vendor_id != 0x10ec0257) in alc256_shutup()
3639 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3642 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3648 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3649 alc_shutup_pins(codec); in alc256_shutup()
3652 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3653 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3654 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3655 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3656 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3661 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3663 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3668 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3669 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3670 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3671 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3672 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3673 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3675 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3678 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3682 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3683 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3686 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3689 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3690 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3691 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3692 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3694 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3695 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3698 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3701 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3702 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3703 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3704 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3707 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3710 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3712 struct alc_spec *spec = codec->spec; in alc225_init()
3720 is_s3_resume(codec) || in alc225_init()
3721 is_s4_resume(codec)) { in alc225_init()
3722 alc285_hp_init(codec); in alc225_init()
3730 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3731 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3736 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3738 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3739 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3740 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3745 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3748 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3755 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3758 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3764 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3765 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3768 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3770 struct alc_spec *spec = codec->spec; in alc225_shutup()
3777 alc_disable_headset_jack_key(codec); in alc225_shutup()
3779 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3781 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3782 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3788 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3791 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3798 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3801 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3807 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3808 alc_shutup_pins(codec); in alc225_shutup()
3811 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3812 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3813 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3814 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3818 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3819 alc_enable_headset_jack_key(codec); in alc225_shutup()
3822 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3824 struct alc_spec *spec = codec->spec; in alc_default_init()
3833 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3838 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3844 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3851 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3853 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3858 alc269_shutup(codec); in alc_default_shutup()
3862 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3867 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3874 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3880 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3881 alc_shutup_pins(codec); in alc_default_shutup()
3884 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3886 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3893 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3899 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3902 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3903 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3906 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3909 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3912 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3916 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3918 struct alc_spec *spec = codec->spec; in alc294_init()
3922 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3923 alc294_hp_init(codec); in alc294_init()
3926 alc_default_init(codec); in alc294_init()
3929 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3932 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3933 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3934 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3937 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3941 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3942 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3944 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3949 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3953 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3954 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3955 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3956 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3957 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3958 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3959 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3960 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3961 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3964 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3966 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3967 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3968 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3969 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3970 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3971 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3974 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3978 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3979 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3980 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3981 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3982 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3983 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3984 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3985 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3986 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3987 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3988 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3989 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3990 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3991 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3992 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3994 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3996 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3998 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
4000 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
4001 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
4002 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
4003 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
4004 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
4005 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
4006 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
4009 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4014 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
4015 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
4017 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
4018 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
4022 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
4024 struct alc_spec *spec = codec->spec; in alc269_suspend()
4027 alc5505_dsp_suspend(codec); in alc269_suspend()
4029 return alc_suspend(codec); in alc269_suspend()
4032 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
4034 struct alc_spec *spec = codec->spec; in alc269_resume()
4037 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
4039 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
4043 codec->patch_ops.init(codec); in alc269_resume()
4046 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
4048 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
4052 snd_hda_regmap_sync(codec); in alc269_resume()
4053 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4060 alc_write_gpio_data(codec); in alc269_resume()
4063 alc5505_dsp_resume(codec); in alc269_resume()
4069 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4072 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4078 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4082 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4083 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4086 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4091 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4095 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4098 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4101 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4107 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4117 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4118 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4120 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4122 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4126 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4131 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4134 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4137 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4149 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4158 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4161 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4163 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4165 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4166 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4169 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4172 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4178 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4181 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4184 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4188 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4191 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4203 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4207 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4208 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4211 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4213 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4214 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4215 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4218 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4220 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4221 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4224 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4248 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4249 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4250 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4251 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4252 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4253 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4254 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4255 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4258 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4261 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4264 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4271 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4280 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4284 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4285 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4286 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4293 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4294 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4296 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4302 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4306 struct alc_spec *spec = codec->spec; in led_power_filter()
4313 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4314 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4316 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4319 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4322 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4336 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4337 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4338 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4345 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4349 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4354 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4355 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4359 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4362 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4365 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4368 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4371 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4374 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4378 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4383 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4390 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4391 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4393 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4402 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4403 struct alc_spec *spec = codec->spec; in micmute_led_set()
4405 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4411 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4416 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4418 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4424 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4428 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4432 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4435 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4438 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4441 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4444 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4447 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4450 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4453 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4456 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4459 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4462 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4465 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4469 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4476 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4477 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4479 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4484 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4487 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4489 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4497 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4498 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4502 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4505 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4507 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4510 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4511 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4518 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4521 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4530 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4532 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4539 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4545 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4548 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4553 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4557 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4566 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4573 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4581 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4582 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4584 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4589 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4593 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4601 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4605 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4609 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4617 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4625 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4626 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4628 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4633 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4636 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4643 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4647 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4650 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4657 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4661 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4664 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4665 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4668 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4671 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4672 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4675 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4678 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4682 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4683 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4687 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4690 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4691 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4694 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4697 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4698 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4699 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4707 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4726 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4729 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4732 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4737 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4740 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4750 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4752 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4757 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4772 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4786 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4789 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4791 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4794 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4800 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4802 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4820 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4823 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4825 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4828 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4831 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4850 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4853 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4855 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4858 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4873 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4875 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4951 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4955 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4957 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4963 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4968 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4972 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4976 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4979 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4980 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4983 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4986 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4989 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4997 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4998 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
5001 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
5004 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
5008 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5068 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5070 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5071 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5072 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5073 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5079 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5080 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5081 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5082 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5087 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5088 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5089 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5090 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5094 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5095 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5096 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5097 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5102 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5103 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5104 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5107 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5108 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5112 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5113 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5114 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5115 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5118 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5122 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5123 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5126 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5127 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5128 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5129 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5137 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5138 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5139 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5140 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5141 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5144 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5147 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5213 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5220 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5221 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5224 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5230 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5231 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5233 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5238 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5242 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5247 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5250 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5253 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5256 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5259 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5262 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5266 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5322 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5324 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5330 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5335 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5339 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5342 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5344 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5345 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5348 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5349 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5355 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5357 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5360 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5363 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5366 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5374 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5376 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5378 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5381 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5384 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5388 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5437 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5439 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5445 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5450 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5454 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5457 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5458 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5463 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5465 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5468 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5471 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5474 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5482 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5485 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5488 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5492 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5532 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5536 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5538 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5540 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5547 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5548 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5549 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5551 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5554 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5557 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5559 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5562 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5563 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5565 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5568 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5574 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5576 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5581 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5583 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5587 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5590 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5594 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5596 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5597 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5599 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5602 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5603 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5605 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5608 alc_process_coef_fw(codec, coef0298); 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()
5617 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5619 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5623 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5625 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5629 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5631 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5635 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5637 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5646 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5649 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5652 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5653 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5654 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5656 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5657 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5659 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5662 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5663 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5665 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5668 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5669 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5670 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5672 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5675 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5683 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5688 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5690 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5697 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5707 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5713 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5720 alc_determine_headset_type(codec); in alc_update_headset_mode()
5722 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5724 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5728 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5732 alc_headset_mode_default(codec); in alc_update_headset_mode()
5737 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5740 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5745 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5748 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5752 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5755 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5758 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5759 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5762 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5765 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5782 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5785 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5792 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5795 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5799 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5804 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5808 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5812 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5815 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5834 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5836 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5842 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5848 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5852 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5854 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5857 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5861 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5863 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5866 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5869 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5872 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5874 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5876 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5879 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5882 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5884 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5892 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5896 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5901 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5905 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5910 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5914 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5921 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5929 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5933 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5934 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5938 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5946 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5950 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5953 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5956 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5961 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5972 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5978 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
5984 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
5990 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5992 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5996 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
6001 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
6004 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
6013 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6028 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6031 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6039 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6040 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6042 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6045 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6049 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6050 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6051 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6053 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6057 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6059 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6069 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6078 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6082 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6085 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6090 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6094 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6098 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6114 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6118 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6126 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6129 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6133 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6138 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6142 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6145 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6149 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6156 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6158 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6163 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6166 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6175 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6181 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6183 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6184 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6185 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6189 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6192 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6202 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6203 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6206 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6216 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6218 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6224 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6232 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6233 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6237 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6249 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6254 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6259 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6264 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6269 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6274 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6277 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6279 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6281 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6291 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6295 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6297 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6306 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6310 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6325 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6332 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6336 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6346 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6347 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6352 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6356 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6360 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6364 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6365 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6368 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6369 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6376 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6382 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6386 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6389 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6400 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6404 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6410 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6419 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6425 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6428 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6430 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6436 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6437 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6445 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6446 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6451 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6454 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6461 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6466 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6470 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6474 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6480 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6481 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6483 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6486 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6490 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6495 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6502 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6507 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6513 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6514 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6516 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6519 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6522 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6527 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6531 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6536 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6543 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6546 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6551 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6556 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6559 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6564 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6568 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6576 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6581 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6589 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6597 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6599 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6600 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6604 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6606 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6611 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6622 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6624 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6632 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6635 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6636 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6640 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6644 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6728 spec->comps[i].codec = cdc; in cs35l41_generic_fixup()
6746 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_two() argument
6748 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2); in cs35l41_fixup_spi_two()
6751 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_four() argument
6753 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4); in cs35l41_fixup_spi_four()
6781 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
6793 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
6803 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
6814 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
6817 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
6826 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
6827 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
6828 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
6830 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
6834 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, in alc_fixup_dell4_mic_no_presence_quiet() argument
6838 struct alc_spec *spec = codec->spec; in alc_fixup_dell4_mic_no_presence_quiet()
6842 alc269_fixup_limit_int_mic_boost(codec, fix, action); in alc_fixup_dell4_mic_no_presence_quiet()
6851 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
6852 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
6869 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, in alc287_fixup_yoga9_14iap7_bass_spk_pin() argument
6895 struct alc_spec *spec = codec->spec; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
6899 snd_hda_apply_pincfgs(codec, pincfgs); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
6900 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7155 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
7161 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
7165 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
10286 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
10288 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
10294 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
10295 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
10296 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
10299 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
10300 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
10301 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
10304 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
10306 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
10309 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
10310 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
10313 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
10315 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
10318 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
10323 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
10328 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
10333 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
10337 spec = codec->spec; in patch_alc269()
10339 codec->power_save_node = 0; in patch_alc269()
10342 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
10343 codec->patch_ops.resume = alc269_resume; in patch_alc269()
10348 switch (codec->core.vendor_id) { in patch_alc269()
10351 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
10353 if (codec->bus->pci && in patch_alc269()
10354 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
10356 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
10360 if (codec->bus->pci && in patch_alc269()
10361 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
10362 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
10363 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
10370 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
10376 alc269_fill_coef(codec); in patch_alc269()
10433 if (alc_get_coef0(codec) & 0x0010) in patch_alc269()
10460 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
10476 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
10482 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
10487 alc_pre_init(codec); in patch_alc269()
10489 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
10495 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
10496 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
10497 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
10498 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
10501 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
10502 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
10503 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
10505 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
10507 alc_auto_parse_customize_define(codec); in patch_alc269()
10509 if (has_cdefine_beep(codec)) in patch_alc269()
10513 err = alc269_parse_auto_config(codec); in patch_alc269()
10523 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
10528 alc_free(codec); in patch_alc269()
10536 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
10540 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
10553 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
10556 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
10561 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
10565 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
10570 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
10574 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
10625 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
10630 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
10634 spec = codec->spec; in patch_alc861()
10635 if (has_cdefine_beep(codec)) in patch_alc861()
10642 alc_pre_init(codec); in patch_alc861()
10644 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
10645 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
10648 err = alc861_parse_auto_config(codec); in patch_alc861()
10658 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
10663 alc_free(codec); in patch_alc861()
10674 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
10678 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
10687 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
10691 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
10692 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
10697 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
10700 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
10704 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
10727 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
10732 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
10736 spec = codec->spec; in patch_alc861vd()
10737 if (has_cdefine_beep(codec)) in patch_alc861vd()
10742 alc_pre_init(codec); in patch_alc861vd()
10744 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
10745 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
10748 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
10758 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
10763 alc_free(codec); in patch_alc861vd()
10783 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
10790 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
10791 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
10792 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
10796 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
10799 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
10804 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
10809 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
10822 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
10826 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
10832 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
10836 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
10837 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
10842 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
10845 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
10847 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
10850 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
10854 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
10857 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
10860 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
10864 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
10868 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
10871 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
10878 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
10887 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
10888 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
10889 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
10891 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10892 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10896 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
10900 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
10905 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
10908 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
10914 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
10919 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
10922 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
10934 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
10937 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
10942 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
10945 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
10948 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
10950 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc897_hp_automute_hook()
10954 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
10957 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
10987 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
10989 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
11689 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
11694 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
11698 spec = codec->spec; in patch_alc662()
11705 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
11707 switch (codec->core.vendor_id) { in patch_alc662()
11713 alc_pre_init(codec); in patch_alc662()
11715 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
11717 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
11718 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
11720 alc_auto_parse_customize_define(codec); in patch_alc662()
11722 if (has_cdefine_beep(codec)) in patch_alc662()
11725 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
11726 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
11728 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
11734 err = alc662_parse_auto_config(codec); in patch_alc662()
11739 switch (codec->core.vendor_id) { in patch_alc662()
11757 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
11762 alc_free(codec); in patch_alc662()
11770 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
11772 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
11777 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
11782 err = alc_alloc_spec(codec, 0); in patch_alc680()
11787 err = alc680_parse_auto_config(codec); in patch_alc680()
11789 alc_free(codec); in patch_alc680()