• Home
  • Raw
  • Download

Lines Matching refs:codec

108 	void (*init_hook)(struct hda_codec *codec);
110 void (*power_hook)(struct hda_codec *codec);
112 void (*shutup)(struct hda_codec *codec);
113 void (*reboot_notify)(struct hda_codec *codec);
138 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
140 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
142 snd_hda_power_up_pm(codec); in coef_mutex_lock()
146 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
148 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
151 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
154 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
159 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
160 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
164 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
169 coef_mutex_lock(codec); in alc_read_coefex_idx()
170 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
171 coef_mutex_unlock(codec); in alc_read_coefex_idx()
175 #define alc_read_coef_idx(codec, coef_idx) \ argument
176 alc_read_coefex_idx(codec, 0x20, coef_idx)
178 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
181 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
182 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
185 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
188 coef_mutex_lock(codec); in alc_write_coefex_idx()
189 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
190 coef_mutex_unlock(codec); in alc_write_coefex_idx()
193 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
194 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
196 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
200 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
203 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
207 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
211 coef_mutex_lock(codec); in alc_update_coefex_idx()
212 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
213 coef_mutex_unlock(codec); in alc_update_coefex_idx()
216 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
217 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
220 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
222 struct alc_spec *spec = codec->spec; in alc_get_coef0()
225 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
243 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
246 coef_mutex_lock(codec); in alc_process_coef_fw()
249 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
251 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
254 coef_mutex_unlock(codec); in alc_process_coef_fw()
262 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
264 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
271 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
273 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
275 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
279 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
282 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
290 alc_write_gpio_data(codec); in alc_update_gpio_data()
293 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
295 struct alc_spec *spec = codec->spec; in alc_write_gpio()
300 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
302 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
306 alc_write_gpio_data(codec); in alc_write_gpio()
309 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
313 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
316 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
319 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
322 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
325 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
328 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
331 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
334 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
337 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
340 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
344 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
352 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
354 struct alc_spec *spec = codec->spec; in alc_fix_pll()
357 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
361 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
364 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
368 alc_fix_pll(codec); in alc_fix_pll_init()
372 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
379 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
385 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
394 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
398 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
402 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
406 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
408 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
410 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
414 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
418 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
420 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
422 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
428 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
433 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
453 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
456 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
459 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
460 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
463 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
472 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
476 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
485 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
489 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
492 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
495 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
499 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
503 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
510 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
516 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
518 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
523 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
529 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
531 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
533 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
534 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
539 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
547 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
550 static int find_ext_mic_pin(struct hda_codec *codec);
552 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
555 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
561 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
564 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
567 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
571 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
574 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
576 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
578 switch (codec->core.vendor_id) { in alc_shutup_pins()
586 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
590 snd_hda_shutup_pins(codec); in alc_shutup_pins()
598 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
600 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
602 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
605 alc_shutup_pins(codec); in alc_eapd_shutup()
609 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
611 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
612 alc_write_gpio(codec); in alc_auto_init_amp()
615 switch (codec->core.vendor_id) { in alc_auto_init_amp()
617 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
623 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
626 alc888_coef_init(codec); in alc_auto_init_amp()
652 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
655 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
662 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
665 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
669 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
673 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
677 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
688 if (!codec->bus->pci) in alc_auto_parse_customize_define()
690 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
691 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
695 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
697 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
700 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
701 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
725 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
727 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
729 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
730 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
731 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
732 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
733 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
734 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
735 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
764 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
768 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
777 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
778 if (codec->bus->pci && in alc_subsystem_id()
779 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
792 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
794 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
795 codec_dbg(codec, in alc_subsystem_id()
812 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
813 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
825 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
828 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
831 alc_setup_gpio(codec, 0x04); in alc_subsystem_id()
866 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
868 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
869 struct alc_spec *spec = codec->spec; in alc_ssid_check()
871 codec_dbg(codec, in alc_ssid_check()
881 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
884 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
890 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
894 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
898 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
907 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
909 alc_fill_eapd_coef(codec); in alc_pre_init()
912 #define is_s3_resume(codec) \ argument
913 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
914 #define is_s4_resume(codec) \ argument
915 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
917 static int alc_init(struct hda_codec *codec) in alc_init() argument
919 struct alc_spec *spec = codec->spec; in alc_init()
922 if (is_s4_resume(codec)) in alc_init()
923 alc_pre_init(codec); in alc_init()
926 spec->init_hook(codec); in alc_init()
929 snd_hda_gen_init(codec); in alc_init()
930 alc_fix_pll(codec); in alc_init()
931 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
932 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
934 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
939 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
941 struct alc_spec *spec = codec->spec; in alc_shutup()
943 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
947 spec->shutup(codec); in alc_shutup()
949 alc_shutup_pins(codec); in alc_shutup()
952 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
954 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
957 spec->reboot_notify(codec); in alc_reboot_notify()
959 alc_shutup(codec); in alc_reboot_notify()
965 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
967 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
970 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
972 struct alc_spec *spec = codec->spec; in alc_suspend()
973 alc_shutup(codec); in alc_suspend()
975 spec->power_hook(codec); in alc_suspend()
981 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
983 struct alc_spec *spec = codec->spec; in alc_resume()
987 codec->patch_ops.init(codec); in alc_resume()
988 snd_hda_regmap_sync(codec); in alc_resume()
989 hda_call_check_power_status(codec, 0x01); in alc_resume()
1011 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1082 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1088 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1090 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1091 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1094 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1097 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1099 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1102 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1103 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1155 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1157 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1159 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1166 #define has_cdefine_beep(codec) 0 argument
1173 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1177 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1181 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1187 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1189 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1197 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1204 codec->spec = spec; in alc_alloc_spec()
1208 codec->single_adc_amp = 1; in alc_alloc_spec()
1210 codec->spdif_status_reset = 1; in alc_alloc_spec()
1211 codec->forced_resume = 1; in alc_alloc_spec()
1212 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1215 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1223 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1227 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1262 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1266 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1645 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1650 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1654 spec = codec->spec; in patch_alc880()
1658 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1660 alc_pre_init(codec); in patch_alc880()
1662 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1664 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1667 err = alc880_parse_auto_config(codec); in patch_alc880()
1677 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1682 alc_free(codec); in patch_alc880()
1690 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1694 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1714 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1716 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1718 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1721 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1724 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1733 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1735 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1739 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1742 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1761 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1767 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1770 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1775 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1778 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1894 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1899 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1903 spec = codec->spec; in patch_alc260()
1913 alc_pre_init(codec); in patch_alc260()
1915 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1917 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1920 err = alc260_parse_auto_config(codec); in patch_alc260()
1930 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1935 alc_free(codec); in patch_alc260()
1999 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
2004 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2008 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2011 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2014 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2021 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2028 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2029 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2030 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2031 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2035 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2036 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2037 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2038 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2043 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2047 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2053 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2056 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2058 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2064 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2067 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2072 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2074 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2080 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2086 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2090 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2096 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2100 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2106 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2113 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2116 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2123 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2129 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2132 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2144 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2147 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2152 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2157 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2161 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2165 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2169 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2170 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2173 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2174 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2181 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2196 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2197 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2200 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2205 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2214 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2218 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2219 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2222 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2225 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2229 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2230 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2233 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2236 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2239 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2245 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2248 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2251 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2254 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2733 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2737 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2742 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2747 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2751 spec = codec->spec; in patch_alc882()
2753 switch (codec->core.vendor_id) { in patch_alc882()
2762 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2766 alc_pre_init(codec); in patch_alc882()
2768 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2770 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2771 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2773 alc_auto_parse_customize_define(codec); in patch_alc882()
2775 if (has_cdefine_beep(codec)) in patch_alc882()
2779 err = alc882_parse_auto_config(codec); in patch_alc882()
2789 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2794 alc_free(codec); in patch_alc882()
2802 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2806 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2921 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2926 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2930 spec = codec->spec; in patch_alc262()
2939 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2941 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2943 alc_pre_init(codec); in patch_alc262()
2945 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2947 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2949 alc_auto_parse_customize_define(codec); in patch_alc262()
2951 if (has_cdefine_beep(codec)) in patch_alc262()
2955 err = alc262_parse_auto_config(codec); in patch_alc262()
2965 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2970 alc_free(codec); in patch_alc262()
2981 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2985 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2994 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3066 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3069 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3074 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3080 err = alc_alloc_spec(codec, 0); in patch_alc268()
3084 spec = codec->spec; in patch_alc268()
3085 if (has_cdefine_beep(codec)) in patch_alc268()
3090 alc_pre_init(codec); in patch_alc268()
3092 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3093 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3096 err = alc268_parse_auto_config(codec); in patch_alc268()
3109 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3110 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3112 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3119 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3124 alc_free(codec); in patch_alc268()
3167 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3172 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3205 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3216 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3238 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3240 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3245 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3253 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3254 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3255 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3261 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3262 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3267 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3269 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3274 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3282 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3283 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3284 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3290 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3291 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3296 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3299 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3304 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3306 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, in alc_fixup_headset_jack()
3310 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3315 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3317 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3320 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3322 struct alc_spec *spec = codec->spec; in alc269_shutup()
3325 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3327 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3330 alc_shutup_pins(codec); in alc269_shutup()
3366 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3368 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3371 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3373 struct alc_spec *spec = codec->spec; in alc282_init()
3378 alc282_restore_default_value(codec); in alc282_init()
3382 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3383 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3387 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3392 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3398 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3405 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3408 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3410 struct alc_spec *spec = codec->spec; in alc282_shutup()
3416 alc269_shutup(codec); in alc282_shutup()
3420 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3421 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3422 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3427 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3434 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3440 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3441 alc_shutup_pins(codec); in alc282_shutup()
3442 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3482 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3484 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3487 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3489 struct alc_spec *spec = codec->spec; in alc283_init()
3493 alc283_restore_default_value(codec); in alc283_init()
3499 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3503 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3505 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3511 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3518 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3520 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3523 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3525 struct alc_spec *spec = codec->spec; in alc283_shutup()
3530 alc269_shutup(codec); in alc283_shutup()
3534 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3536 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3539 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3541 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3548 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3551 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3555 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3556 alc_shutup_pins(codec); in alc283_shutup()
3557 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3560 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3562 struct alc_spec *spec = codec->spec; in alc256_init()
3567 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3568 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3569 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3570 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3571 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3580 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3585 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ 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 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_shutup()
3622 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3627 snd_hda_codec_write(codec, hp_pin, 0, 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 alc225_init(struct hda_codec *codec) in alc225_init() argument
3663 struct alc_spec *spec = codec->spec; in alc225_init()
3668 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3669 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3670 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3678 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3679 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3684 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3687 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3690 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3697 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3700 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3706 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3707 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3710 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3712 struct alc_spec *spec = codec->spec; in alc225_shutup()
3719 alc_disable_headset_jack_key(codec); in alc225_shutup()
3721 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3723 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3724 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3730 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3733 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3740 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3743 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3749 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3750 alc_shutup_pins(codec); in alc225_shutup()
3753 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3754 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3755 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3756 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3760 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3761 alc_enable_headset_jack_key(codec); in alc225_shutup()
3764 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3766 struct alc_spec *spec = codec->spec; in alc_default_init()
3775 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3780 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3786 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3793 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3795 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3800 alc269_shutup(codec); in alc_default_shutup()
3804 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3809 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3816 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3822 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3823 alc_shutup_pins(codec); in alc_default_shutup()
3826 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3828 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3835 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3841 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3844 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3845 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3848 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3851 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3854 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3858 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3860 struct alc_spec *spec = codec->spec; in alc294_init()
3864 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3865 alc294_hp_init(codec); in alc294_init()
3868 alc_default_init(codec); in alc294_init()
3871 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3874 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3875 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3876 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3879 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3883 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3884 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3886 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3891 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3895 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3896 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3897 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3898 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3899 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3900 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3901 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3902 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3903 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3906 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3908 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3909 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3910 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3911 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3912 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3913 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3916 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3920 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3921 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3922 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3923 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3924 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3925 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3926 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3927 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3928 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3929 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3930 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3931 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3932 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3933 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3934 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3936 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3938 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3940 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3942 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3943 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3944 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3945 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3946 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3947 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3948 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3951 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3956 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
3957 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
3959 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3960 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3964 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3966 struct alc_spec *spec = codec->spec; in alc269_suspend()
3969 alc5505_dsp_suspend(codec); in alc269_suspend()
3970 return alc_suspend(codec); in alc269_suspend()
3973 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3975 struct alc_spec *spec = codec->spec; in alc269_resume()
3978 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3980 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3984 codec->patch_ops.init(codec); in alc269_resume()
3987 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3989 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3993 snd_hda_regmap_sync(codec); in alc269_resume()
3994 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4001 alc_write_gpio_data(codec); in alc269_resume()
4004 alc5505_dsp_resume(codec); in alc269_resume()
4010 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4013 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4019 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4023 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4024 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4027 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4032 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4036 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4039 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4042 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4048 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4058 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4059 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4061 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4063 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4067 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4072 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4075 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4078 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4090 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4099 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4102 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4104 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4106 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4107 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4110 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4113 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4119 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4122 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4125 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4129 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4132 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4144 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4148 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4149 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4152 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4154 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4155 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4156 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4159 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4161 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4162 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4165 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4189 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4190 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4191 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4192 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4193 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4194 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4195 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4196 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4199 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4202 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4205 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4212 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4221 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4225 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4226 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4227 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4234 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4235 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4237 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4243 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4247 struct alc_spec *spec = codec->spec; in led_power_filter()
4254 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4255 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4257 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4260 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4263 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4277 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4278 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4279 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4286 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4290 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4295 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4296 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4300 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4303 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4306 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4309 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4312 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4315 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4319 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4324 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4331 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4332 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4334 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4343 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4344 struct alc_spec *spec = codec->spec; in micmute_led_set()
4346 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4352 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4357 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4359 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4365 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4369 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4373 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4376 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4379 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4382 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4385 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4388 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4391 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4394 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4397 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4400 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4403 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4406 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4410 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4417 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4418 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4420 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4425 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4428 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4430 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4438 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4439 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4443 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4446 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4448 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4451 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4452 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4459 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4462 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4471 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4473 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4480 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4486 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4489 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4494 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4498 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4507 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4514 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4522 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4523 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4525 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4530 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4534 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4542 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4546 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4550 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4558 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4562 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit2() argument
4565 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit2()
4573 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit2()
4581 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4582 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4584 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4589 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4592 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4599 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4603 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_micmute_led() argument
4606 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_gpio_micmute_led()
4610 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc285_fixup_hp_gpio_micmute_led()
4613 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4616 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4623 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4627 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4630 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4631 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4634 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_mute_led() argument
4637 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4638 alc285_fixup_hp_gpio_micmute_led(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4641 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4644 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4645 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4648 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4651 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4655 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4656 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4660 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4663 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4664 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4667 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4670 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4671 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4672 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4680 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4699 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4702 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4705 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4710 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4713 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4723 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4725 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4730 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4745 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4759 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4762 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4764 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4767 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4773 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4775 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4793 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4796 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4798 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4801 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4804 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4823 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4826 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4828 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4831 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4846 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4848 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4924 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4928 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4930 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4936 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4941 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4945 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4949 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4952 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4953 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4956 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4959 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4962 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4970 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4971 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4974 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4977 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4981 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5041 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5043 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5044 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5045 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5046 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5052 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5053 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5054 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5055 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5060 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5061 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5062 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5063 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5067 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5068 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5069 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5070 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5075 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5076 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5077 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); 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, coef0292); in alc_headset_mode_mic_in()
5085 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5086 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5087 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5088 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5091 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5095 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5096 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5099 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5100 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5101 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5102 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5110 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5111 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5112 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5113 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5114 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5117 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5120 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5186 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5193 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5194 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5197 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5203 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5204 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5206 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5211 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5215 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5220 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5223 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5226 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5229 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5232 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5235 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5239 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5295 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5297 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5303 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5308 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5312 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5315 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5317 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5318 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5321 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5322 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5328 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5330 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5333 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5336 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5339 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5347 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5349 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5351 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5354 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5357 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5361 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5410 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5412 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5418 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5423 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5427 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5430 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5431 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5436 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5438 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5441 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5444 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5447 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5455 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5458 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5461 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5465 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5505 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5509 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5511 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5513 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5520 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5521 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5522 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5524 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5527 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5530 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5532 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5535 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5536 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5538 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5541 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5547 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5549 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5554 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5556 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5560 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5563 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5567 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5569 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5570 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5572 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5575 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5576 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5578 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5581 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5582 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5585 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5590 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5592 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5596 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5598 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5602 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5604 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5608 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5610 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5619 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5622 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5625 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5626 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5627 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5629 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5630 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5632 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5635 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5636 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5638 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5641 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5642 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5643 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5645 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5648 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5656 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5661 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5663 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5670 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5680 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5686 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5693 alc_determine_headset_type(codec); in alc_update_headset_mode()
5695 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5697 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5701 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5705 alc_headset_mode_default(codec); in alc_update_headset_mode()
5710 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5713 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5718 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5721 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5725 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5728 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5731 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5732 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5735 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5738 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5755 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5758 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5765 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5768 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5772 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5777 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5781 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5785 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5788 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5807 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5809 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5815 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5821 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5825 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5827 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5830 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5834 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5836 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5839 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5842 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5845 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5847 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5849 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5852 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5855 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5857 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5865 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5869 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5874 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5878 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5883 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5887 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5894 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5902 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5907 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5908 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5912 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5920 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5924 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5927 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5930 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5935 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5946 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5952 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
5958 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
5964 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5966 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5970 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5975 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5978 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5987 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6002 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6005 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6013 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6014 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6016 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6019 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6023 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6024 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6025 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6027 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6031 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6033 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6043 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6052 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6056 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6059 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6064 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6068 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6072 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6088 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6092 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6100 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6103 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6107 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6112 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6116 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6119 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6123 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6130 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6132 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6137 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6140 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6149 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6155 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6157 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6158 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6159 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6163 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6166 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6176 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6177 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6180 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6190 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6192 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6198 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6206 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6207 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6211 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6223 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6228 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6233 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6238 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6243 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6248 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6251 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6253 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6255 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6265 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6269 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6271 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6280 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6284 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6299 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6306 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6310 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6320 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6321 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6326 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6330 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6334 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6338 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6339 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6342 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6343 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6350 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6356 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6360 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6363 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6374 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6378 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6384 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6393 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6399 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6402 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6404 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6410 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6411 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6419 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6420 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6425 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6428 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6435 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6440 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6444 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6448 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6454 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6455 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6457 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6460 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6464 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6469 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6476 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6481 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6487 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6488 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6490 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6493 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6496 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6501 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6505 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6510 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6517 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6520 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6525 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6530 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6533 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6538 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6542 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6550 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6555 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6563 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6571 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6573 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6574 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6578 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6580 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6585 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6596 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6598 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6606 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6609 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6610 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6614 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6618 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6640 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
6652 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
6662 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
6673 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
6676 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
6685 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
6686 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
6687 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
6689 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
6693 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec, in alc295_fixup_dell_inspiron_top_speakers() argument
6708 struct alc_spec *spec = codec->spec; in alc295_fixup_dell_inspiron_top_speakers()
6710 alc_fixup_no_shutup(codec, fix, action); in alc295_fixup_dell_inspiron_top_speakers()
6714 snd_hda_apply_pincfgs(codec, pincfgs); in alc295_fixup_dell_inspiron_top_speakers()
6715 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_dell_inspiron_top_speakers()
6961 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
6967 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
6971 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
9955 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
9957 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
9963 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
9964 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9965 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
9968 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
9969 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9970 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
9973 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
9975 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
9978 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
9979 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
9982 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
9984 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
9987 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
9992 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
9997 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
10002 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
10006 spec = codec->spec; in patch_alc269()
10008 codec->power_save_node = 0; in patch_alc269()
10012 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
10013 codec->patch_ops.resume = alc269_resume; in patch_alc269()
10018 switch (codec->core.vendor_id) { in patch_alc269()
10021 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
10023 if (codec->bus->pci && in patch_alc269()
10024 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
10026 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
10030 if (codec->bus->pci && in patch_alc269()
10031 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
10032 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
10033 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
10040 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
10046 alc269_fill_coef(codec); in patch_alc269()
10092 if (codec->core.vendor_id == 0x10ec0236 && in patch_alc269()
10093 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD) in patch_alc269()
10126 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
10142 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
10148 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
10153 alc_pre_init(codec); in patch_alc269()
10155 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
10161 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
10162 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
10163 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
10164 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
10167 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
10168 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
10169 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
10171 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
10173 alc_auto_parse_customize_define(codec); in patch_alc269()
10175 if (has_cdefine_beep(codec)) in patch_alc269()
10179 err = alc269_parse_auto_config(codec); in patch_alc269()
10189 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
10194 alc_free(codec); in patch_alc269()
10202 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
10206 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
10219 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
10222 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
10227 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
10231 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
10236 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
10240 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
10291 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
10296 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
10300 spec = codec->spec; in patch_alc861()
10301 if (has_cdefine_beep(codec)) in patch_alc861()
10308 alc_pre_init(codec); in patch_alc861()
10310 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
10311 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
10314 err = alc861_parse_auto_config(codec); in patch_alc861()
10324 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
10329 alc_free(codec); in patch_alc861()
10340 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
10344 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
10353 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
10357 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
10358 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
10363 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
10366 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
10370 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
10393 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
10398 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
10402 spec = codec->spec; in patch_alc861vd()
10403 if (has_cdefine_beep(codec)) in patch_alc861vd()
10408 alc_pre_init(codec); in patch_alc861vd()
10410 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
10411 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
10414 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
10424 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
10429 alc_free(codec); in patch_alc861vd()
10449 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
10456 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
10457 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
10458 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
10462 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
10465 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
10470 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
10475 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
10488 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
10492 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
10498 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
10502 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
10503 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
10508 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
10511 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
10513 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
10516 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
10520 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
10523 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
10526 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
10530 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
10534 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
10537 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
10544 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
10553 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
10554 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
10555 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
10557 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10558 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10562 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
10566 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
10571 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
10574 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
10580 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
10585 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
10588 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
10600 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
10603 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
10608 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
10611 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
10614 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
10616 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc897_hp_automute_hook()
10620 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
10623 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
10629 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mode() argument
10632 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mode()
10664 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
10666 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
11398 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
11403 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
11407 spec = codec->spec; in patch_alc662()
11414 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
11416 switch (codec->core.vendor_id) { in patch_alc662()
11422 alc_pre_init(codec); in patch_alc662()
11424 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
11426 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
11427 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
11429 alc_auto_parse_customize_define(codec); in patch_alc662()
11431 if (has_cdefine_beep(codec)) in patch_alc662()
11434 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
11435 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
11437 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
11443 err = alc662_parse_auto_config(codec); in patch_alc662()
11448 switch (codec->core.vendor_id) { in patch_alc662()
11466 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
11471 alc_free(codec); in patch_alc662()
11479 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
11481 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
11486 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
11491 err = alc_alloc_spec(codec, 0); in patch_alc680()
11496 err = alc680_parse_auto_config(codec); in patch_alc680()
11498 alc_free(codec); in patch_alc680()