Lines Matching refs:codec

110 	void (*init_hook)(struct hda_codec *codec);
112 void (*power_hook)(struct hda_codec *codec);
114 void (*shutup)(struct hda_codec *codec);
143 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
145 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
147 snd_hda_power_up_pm(codec); in coef_mutex_lock()
151 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
153 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
156 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
159 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
164 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
165 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
169 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
174 coef_mutex_lock(codec); in alc_read_coefex_idx()
175 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
176 coef_mutex_unlock(codec); in alc_read_coefex_idx()
180 #define alc_read_coef_idx(codec, coef_idx) \ argument
181 alc_read_coefex_idx(codec, 0x20, coef_idx)
183 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
186 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
187 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
190 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
193 coef_mutex_lock(codec); in alc_write_coefex_idx()
194 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
195 coef_mutex_unlock(codec); in alc_write_coefex_idx()
198 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
199 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
201 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
205 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
208 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
212 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
216 coef_mutex_lock(codec); in alc_update_coefex_idx()
217 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
218 coef_mutex_unlock(codec); in alc_update_coefex_idx()
221 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
222 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
225 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
227 struct alc_spec *spec = codec->spec; in alc_get_coef0()
230 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
248 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
251 coef_mutex_lock(codec); in alc_process_coef_fw()
254 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
256 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
259 coef_mutex_unlock(codec); in alc_process_coef_fw()
267 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
269 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
276 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
278 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
280 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
284 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
287 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
295 alc_write_gpio_data(codec); in alc_update_gpio_data()
298 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
300 struct alc_spec *spec = codec->spec; in alc_write_gpio()
305 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
307 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
311 alc_write_gpio_data(codec); in alc_write_gpio()
314 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
318 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
321 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
324 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
327 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
330 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
333 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
336 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
339 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
342 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
345 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
349 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
357 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
359 struct alc_spec *spec = codec->spec; in alc_fix_pll()
362 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
366 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
369 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
373 alc_fix_pll(codec); in alc_fix_pll_init()
377 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
384 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
390 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
399 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
403 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
407 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
411 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
413 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
415 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
419 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
423 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
425 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
427 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
433 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
438 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
458 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
461 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
464 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
465 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
468 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
477 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
481 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
490 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
494 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
497 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
500 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
504 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
508 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
515 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
521 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
523 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
528 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
534 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
536 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
538 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
539 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
544 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
552 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
555 static int find_ext_mic_pin(struct hda_codec *codec);
557 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
560 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
566 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
569 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
572 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
576 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
579 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
581 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
583 switch (codec->core.vendor_id) { in alc_shutup_pins()
591 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
595 snd_hda_shutup_pins(codec); in alc_shutup_pins()
603 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
605 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
607 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
610 alc_shutup_pins(codec); in alc_eapd_shutup()
614 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
616 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
617 alc_write_gpio(codec); in alc_auto_init_amp()
620 switch (codec->core.vendor_id) { in alc_auto_init_amp()
622 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
628 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
631 alc888_coef_init(codec); in alc_auto_init_amp()
657 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
660 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
667 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
670 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
674 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
678 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
682 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
693 if (!codec->bus->pci) in alc_auto_parse_customize_define()
695 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
696 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
700 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
702 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
705 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
706 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
730 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
732 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
734 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
735 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
736 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
737 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
738 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
739 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
740 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
769 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
773 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
782 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
783 if (codec->bus->pci && in alc_subsystem_id()
784 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
797 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
799 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
800 codec_dbg(codec, in alc_subsystem_id()
817 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
818 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
830 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
833 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
836 alc_setup_gpio(codec, 0x04); in alc_subsystem_id()
871 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
873 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
874 struct alc_spec *spec = codec->spec; in alc_ssid_check()
876 codec_dbg(codec, in alc_ssid_check()
886 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
889 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
895 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
899 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
903 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
912 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
914 alc_fill_eapd_coef(codec); in alc_pre_init()
917 #define is_s3_resume(codec) \ argument
918 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
919 #define is_s4_resume(codec) \ argument
920 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
922 static int alc_init(struct hda_codec *codec) in alc_init() argument
924 struct alc_spec *spec = codec->spec; in alc_init()
927 if (is_s4_resume(codec)) in alc_init()
928 alc_pre_init(codec); in alc_init()
931 spec->init_hook(codec); in alc_init()
934 snd_hda_gen_init(codec); in alc_init()
935 alc_fix_pll(codec); in alc_init()
936 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
937 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
939 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
947 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
949 struct alc_spec *spec = codec->spec; in alc_shutup()
951 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
955 spec->shutup(codec); in alc_shutup()
957 alc_shutup_pins(codec); in alc_shutup()
960 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
962 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
965 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
967 struct alc_spec *spec = codec->spec; in alc_suspend()
968 alc_shutup(codec); in alc_suspend()
970 spec->power_hook(codec); in alc_suspend()
974 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
976 struct alc_spec *spec = codec->spec; in alc_resume()
980 codec->patch_ops.init(codec); in alc_resume()
981 snd_hda_regmap_sync(codec); in alc_resume()
982 hda_call_check_power_status(codec, 0x01); in alc_resume()
1003 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1074 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1080 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1082 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1083 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1086 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1089 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1091 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1094 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1095 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1147 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1149 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1151 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1158 #define has_cdefine_beep(codec) 0 argument
1165 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1169 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1173 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1179 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1181 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1189 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1196 codec->spec = spec; in alc_alloc_spec()
1200 codec->single_adc_amp = 1; in alc_alloc_spec()
1202 codec->spdif_status_reset = 1; in alc_alloc_spec()
1203 codec->forced_resume = 1; in alc_alloc_spec()
1204 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1207 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1215 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1219 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1254 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1258 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1637 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1642 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1646 spec = codec->spec; in patch_alc880()
1650 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1652 alc_pre_init(codec); in patch_alc880()
1654 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1656 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1659 err = alc880_parse_auto_config(codec); in patch_alc880()
1669 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1674 alc_free(codec); in patch_alc880()
1682 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1686 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1706 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1708 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1710 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1713 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1716 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1725 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1727 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1731 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1734 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1753 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1759 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1762 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1767 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1770 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1886 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1891 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1895 spec = codec->spec; in patch_alc260()
1905 alc_pre_init(codec); in patch_alc260()
1907 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1909 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1912 err = alc260_parse_auto_config(codec); in patch_alc260()
1922 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1927 alc_free(codec); in patch_alc260()
1991 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1996 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2000 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2003 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2006 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2013 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2020 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2021 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2022 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2023 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2027 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2028 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2029 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2030 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2035 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2039 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2045 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2048 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2050 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2056 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2059 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2064 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2066 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2072 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2078 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2082 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2088 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2092 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2098 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2105 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2108 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2115 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2121 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2124 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2136 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2139 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2144 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2146 snd_ctl_rename(codec->card, kctl, newname); in rename_ctl()
2149 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2153 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2157 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2161 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2162 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2165 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2166 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2173 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2188 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2189 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2192 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2197 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2206 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2210 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2211 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2214 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2217 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2221 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2222 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2225 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2228 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2231 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2237 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2240 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2243 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2246 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2727 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2731 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2736 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2741 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2745 spec = codec->spec; in patch_alc882()
2747 switch (codec->core.vendor_id) { in patch_alc882()
2756 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2760 alc_pre_init(codec); in patch_alc882()
2762 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2764 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2765 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2767 alc_auto_parse_customize_define(codec); in patch_alc882()
2769 if (has_cdefine_beep(codec)) in patch_alc882()
2773 err = alc882_parse_auto_config(codec); in patch_alc882()
2783 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2788 alc_free(codec); in patch_alc882()
2796 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2800 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2915 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2920 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2924 spec = codec->spec; in patch_alc262()
2933 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2935 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2937 alc_pre_init(codec); in patch_alc262()
2939 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2941 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2943 alc_auto_parse_customize_define(codec); in patch_alc262()
2945 if (has_cdefine_beep(codec)) in patch_alc262()
2949 err = alc262_parse_auto_config(codec); in patch_alc262()
2959 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2964 alc_free(codec); in patch_alc262()
2975 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2979 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2988 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3060 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3063 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3068 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3074 err = alc_alloc_spec(codec, 0); in patch_alc268()
3078 spec = codec->spec; in patch_alc268()
3079 if (has_cdefine_beep(codec)) in patch_alc268()
3084 alc_pre_init(codec); in patch_alc268()
3086 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3087 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3090 err = alc268_parse_auto_config(codec); in patch_alc268()
3103 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3104 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3106 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3113 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3118 alc_free(codec); in patch_alc268()
3163 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3168 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3203 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3214 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3233 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3236 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3238 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3243 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3251 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3252 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3253 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3259 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3260 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3265 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3267 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3272 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3280 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3281 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3282 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3288 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3289 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3294 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3297 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3303 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3308 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3311 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3315 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3320 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3322 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3325 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3327 struct alc_spec *spec = codec->spec; in alc269_shutup()
3330 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3332 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3335 alc_shutup_pins(codec); in alc269_shutup()
3371 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3373 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3376 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3378 struct alc_spec *spec = codec->spec; in alc282_init()
3383 alc282_restore_default_value(codec); in alc282_init()
3387 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3388 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3392 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3397 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3403 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3410 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3413 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3415 struct alc_spec *spec = codec->spec; in alc282_shutup()
3421 alc269_shutup(codec); in alc282_shutup()
3425 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3426 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3427 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3432 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3439 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3445 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3446 alc_shutup_pins(codec); in alc282_shutup()
3447 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3487 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3489 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3492 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3494 struct alc_spec *spec = codec->spec; in alc283_init()
3498 alc283_restore_default_value(codec); in alc283_init()
3504 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3508 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3510 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3516 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3523 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3525 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3528 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3530 struct alc_spec *spec = codec->spec; in alc283_shutup()
3535 alc269_shutup(codec); in alc283_shutup()
3539 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3541 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3544 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3546 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3553 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3556 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3560 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3561 alc_shutup_pins(codec); in alc283_shutup()
3562 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3565 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3567 struct alc_spec *spec = codec->spec; in alc256_init()
3572 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3573 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3574 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3575 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3576 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3585 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3590 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3592 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3598 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3604 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3605 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3606 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3607 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3614 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3617 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3619 struct alc_spec *spec = codec->spec; in alc256_shutup()
3626 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_shutup()
3627 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3632 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3644 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3647 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3653 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3654 alc_shutup_pins(codec); in alc256_shutup()
3657 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3658 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3659 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3660 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3661 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3666 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3668 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3673 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3674 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3675 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3676 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3677 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3678 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3680 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3683 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3687 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3688 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3691 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3694 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3695 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3696 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3697 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3699 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3700 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3703 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3706 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3707 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3708 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3709 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3712 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3715 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3717 struct alc_spec *spec = codec->spec; in alc225_init()
3722 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3723 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3724 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3732 is_s3_resume(codec) || in alc225_init()
3733 is_s4_resume(codec)) { in alc225_init()
3734 alc285_hp_init(codec); in alc225_init()
3742 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3743 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3748 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3751 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3754 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3761 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3764 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3770 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3771 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3774 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3776 struct alc_spec *spec = codec->spec; in alc225_shutup()
3783 alc_disable_headset_jack_key(codec); in alc225_shutup()
3785 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3787 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3788 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3794 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3797 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3804 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3807 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3813 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3814 alc_shutup_pins(codec); in alc225_shutup()
3817 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3818 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3819 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3820 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3824 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3825 alc_enable_headset_jack_key(codec); in alc225_shutup()
3828 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3830 struct alc_spec *spec = codec->spec; in alc_default_init()
3839 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3844 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3850 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3857 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3859 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3864 alc269_shutup(codec); in alc_default_shutup()
3868 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3873 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3880 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3886 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3887 alc_shutup_pins(codec); in alc_default_shutup()
3890 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3892 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3899 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3905 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3908 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3909 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3912 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3915 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3918 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3922 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3924 struct alc_spec *spec = codec->spec; in alc294_init()
3928 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3929 alc294_hp_init(codec); in alc294_init()
3932 alc_default_init(codec); in alc294_init()
3935 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3938 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3939 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3940 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3943 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3947 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3948 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3950 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3955 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3959 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3960 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3961 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3962 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3963 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3964 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3965 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3966 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3967 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3970 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3972 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3973 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3974 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3975 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3976 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3977 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3980 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3984 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3985 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3986 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3987 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3988 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3989 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3990 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3991 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3992 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3993 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3994 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3995 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3996 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3997 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3998 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
4000 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
4002 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
4004 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
4006 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
4007 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
4008 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
4009 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
4010 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
4011 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
4012 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
4015 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4020 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
4021 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
4023 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
4024 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
4028 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
4030 struct alc_spec *spec = codec->spec; in alc269_suspend()
4033 alc5505_dsp_suspend(codec); in alc269_suspend()
4035 return alc_suspend(codec); in alc269_suspend()
4038 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
4040 struct alc_spec *spec = codec->spec; in alc269_resume()
4043 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
4045 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
4049 codec->patch_ops.init(codec); in alc269_resume()
4052 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
4054 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
4058 snd_hda_regmap_sync(codec); in alc269_resume()
4059 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4066 alc_write_gpio_data(codec); in alc269_resume()
4069 alc5505_dsp_resume(codec); in alc269_resume()
4075 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4078 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4084 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4088 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4089 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4092 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4097 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4101 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4104 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4107 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4113 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4123 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4124 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4126 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4128 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4132 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4137 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4140 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4143 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4155 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4164 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4167 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4169 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4171 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4172 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4175 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4178 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4184 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4187 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4190 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4194 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4197 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4209 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4213 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4214 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4217 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4219 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4220 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4221 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4224 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4226 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4227 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4230 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4254 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4255 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4256 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4257 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4258 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4259 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4260 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4261 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4264 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4267 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4270 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4277 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4286 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4290 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4291 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4292 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4299 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4300 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4302 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4308 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4312 struct alc_spec *spec = codec->spec; in led_power_filter()
4319 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4320 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4322 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4325 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4328 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4342 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4343 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4344 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4351 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4355 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4360 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4361 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4365 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4368 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4371 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4374 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4377 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4380 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4384 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4389 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4396 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4397 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4399 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4408 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4409 struct alc_spec *spec = codec->spec; in micmute_led_set()
4411 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4417 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4422 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4424 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4430 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4434 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4438 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4441 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4444 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4447 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4450 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4453 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4456 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4459 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4462 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4465 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4468 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4471 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4475 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4482 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4483 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4485 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4490 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4493 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4495 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4503 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4504 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4508 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4511 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4513 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4516 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4517 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4524 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4527 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4536 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4538 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4545 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4551 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4554 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4559 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4563 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4572 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4579 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4587 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4588 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4590 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4595 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4599 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4607 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4611 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4615 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4623 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4627 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit2() argument
4630 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit2()
4638 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit2()
4642 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_coefbit() argument
4646 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_coefbit()
4654 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_coefbit()
4662 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4663 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4665 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4670 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4673 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4680 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4684 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_micmute_led() argument
4687 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_gpio_micmute_led()
4691 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc285_fixup_hp_gpio_micmute_led()
4694 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4697 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4704 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4708 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4711 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4712 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4715 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_mute_led() argument
4718 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4719 alc285_fixup_hp_gpio_micmute_led(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4722 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4725 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4726 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4729 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4732 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4736 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4737 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4741 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4744 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4745 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4748 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4751 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4752 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4753 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4761 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4780 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4783 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4786 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4791 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4794 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4804 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4806 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4811 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4826 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4840 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4843 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4845 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4848 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4854 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4856 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4874 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4877 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4879 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4882 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4885 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4904 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4907 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4909 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4912 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4927 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4929 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
5005 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
5009 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
5011 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
5017 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
5022 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
5026 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
5030 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5033 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
5034 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5037 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
5040 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
5043 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
5051 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
5052 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
5055 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
5058 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
5062 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5122 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5124 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5125 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5126 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5127 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5133 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5134 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5135 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5136 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5141 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5142 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5143 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5144 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5148 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5149 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5150 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5151 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5156 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5157 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5158 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5161 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5162 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5166 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5167 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5168 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5169 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5172 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5176 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5177 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5180 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5181 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5182 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5183 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5191 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5192 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5193 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5194 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5195 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5198 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5201 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5267 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5274 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5275 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5278 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5284 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5285 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5287 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5292 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5296 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5301 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5304 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5307 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5310 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5313 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5316 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5320 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5376 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5378 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5384 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5389 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5393 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5396 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5398 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5399 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5402 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5403 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5409 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5411 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5414 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5417 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5420 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5428 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5430 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5432 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5435 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5438 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5442 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5491 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5493 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5499 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5504 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5508 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5511 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5512 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5517 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5519 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5522 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5525 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5528 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5536 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5539 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5542 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5546 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5586 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5590 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5592 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5594 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5601 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5602 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5603 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5605 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5608 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5611 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5613 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5616 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5617 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); 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()
5628 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5630 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5635 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5637 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5641 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5644 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5648 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5650 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5651 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5653 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5656 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5657 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5659 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5662 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5663 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5666 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5671 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5673 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5677 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5679 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5683 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5685 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5689 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5691 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5700 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5703 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5706 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5707 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5708 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5710 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5711 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5713 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5716 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5717 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5719 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5722 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5723 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5724 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5726 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5729 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5737 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5742 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5744 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5751 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5761 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5767 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5774 alc_determine_headset_type(codec); in alc_update_headset_mode()
5776 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5778 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5782 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5786 alc_headset_mode_default(codec); in alc_update_headset_mode()
5791 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5794 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5799 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5802 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5806 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5809 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5812 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5813 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5816 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5819 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5836 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5839 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5846 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5849 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5853 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5858 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5862 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5866 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5869 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5888 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5890 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5896 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5902 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5906 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5908 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5911 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5915 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5917 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5920 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5923 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5926 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5928 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5930 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5933 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5936 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5938 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5946 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5950 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5955 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5959 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5964 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5968 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5975 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5983 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5987 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5988 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5992 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
6000 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
6004 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
6007 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
6010 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
6015 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
6026 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
6032 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
6038 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
6044 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
6046 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
6050 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
6055 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
6058 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
6067 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6082 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6085 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6093 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6094 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6096 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6099 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6103 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6104 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6105 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6107 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6111 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6113 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6123 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6132 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6136 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6139 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6144 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6148 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6152 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6168 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6172 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6180 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6183 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6187 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6192 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6196 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6199 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6203 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6210 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6212 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6217 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6220 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6229 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6235 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6237 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6238 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6239 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6243 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6246 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6256 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6257 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6260 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6270 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6272 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6278 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6286 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6287 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6291 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6303 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6308 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6313 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6318 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6323 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6328 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6331 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6333 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6335 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6345 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6349 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6351 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6360 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6364 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6379 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6386 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6390 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6400 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6401 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6406 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6410 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6414 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6418 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6419 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6422 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6423 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6430 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6436 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6440 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6443 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6454 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6458 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6464 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6473 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6479 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6482 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6484 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6490 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6491 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6499 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6500 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6505 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6508 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6515 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6520 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6524 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6528 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6534 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6535 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6537 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6540 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6544 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6549 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6556 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6561 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6567 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6568 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6570 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6573 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6576 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6581 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6585 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6590 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6597 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6600 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6605 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6610 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6613 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6618 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6622 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6630 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6635 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6643 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6651 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6653 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6654 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6658 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6660 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6665 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6676 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6678 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6686 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6689 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6690 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6694 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6698 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6810 spec->comps[i].codec = cdc; in cs35l41_generic_fixup()
6842 spec->comps[0].codec = cdc; in tas2781_generic_fixup()
6866 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_two() argument
6868 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 2); in cs35l41_fixup_spi_two()
6871 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_four() argument
6873 cs35l41_generic_fixup(codec, action, "spi", "CSC3551", 4); in cs35l41_fixup_spi_four()
6907 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
6919 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
6929 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
6940 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
6943 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
6952 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
6953 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
6954 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
6956 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
6960 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, in alc_fixup_dell4_mic_no_presence_quiet() argument
6964 struct alc_spec *spec = codec->spec; in alc_fixup_dell4_mic_no_presence_quiet()
6968 alc269_fixup_limit_int_mic_boost(codec, fix, action); in alc_fixup_dell4_mic_no_presence_quiet()
6977 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
6978 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
6995 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, in alc287_fixup_yoga9_14iap7_bass_spk_pin() argument
7021 struct alc_spec *spec = codec->spec; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7025 snd_hda_apply_pincfgs(codec, pincfgs); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7026 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7032 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec, in alc295_fixup_dell_inspiron_top_speakers() argument
7047 struct alc_spec *spec = codec->spec; in alc295_fixup_dell_inspiron_top_speakers()
7049 alc_fixup_no_shutup(codec, fix, action); in alc295_fixup_dell_inspiron_top_speakers()
7053 snd_hda_apply_pincfgs(codec, pincfgs); in alc295_fixup_dell_inspiron_top_speakers()
7054 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_dell_inspiron_top_speakers()
7061 static void alc287_fixup_bind_dacs(struct hda_codec *codec, in alc287_fixup_bind_dacs() argument
7064 struct alc_spec *spec = codec->spec; in alc287_fixup_bind_dacs()
7073 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_bind_dacs()
7077 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc287_fixup_bind_dacs()
7082 static void alc_fixup_headset_mic(struct hda_codec *codec, in alc_fixup_headset_mic() argument
7085 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mic()
7093 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_headset_mic()
7094 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_headset_mic()
7372 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
7378 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
7382 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
10783 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
10785 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
10791 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
10792 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
10793 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
10796 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
10797 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
10798 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
10801 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
10803 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
10806 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
10807 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
10810 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
10812 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
10815 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
10820 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
10825 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
10830 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
10834 spec = codec->spec; in patch_alc269()
10836 codec->power_save_node = 0; in patch_alc269()
10840 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
10841 codec->patch_ops.resume = alc269_resume; in patch_alc269()
10846 switch (codec->core.vendor_id) { in patch_alc269()
10849 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
10851 if (codec->bus->pci && in patch_alc269()
10852 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
10854 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
10858 if (codec->bus->pci && in patch_alc269()
10859 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
10860 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
10861 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
10868 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
10874 alc269_fill_coef(codec); in patch_alc269()
10920 if (codec->core.vendor_id == 0x10ec0236 && in patch_alc269()
10921 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD) in patch_alc269()
10935 if (alc_get_coef0(codec) & 0x0010) in patch_alc269()
10962 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
10978 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
10984 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
10989 alc_pre_init(codec); in patch_alc269()
10991 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
10997 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
10998 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
10999 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
11000 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
11003 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
11004 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
11005 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
11007 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
11009 alc_auto_parse_customize_define(codec); in patch_alc269()
11011 if (has_cdefine_beep(codec)) in patch_alc269()
11015 err = alc269_parse_auto_config(codec); in patch_alc269()
11025 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
11030 alc_free(codec); in patch_alc269()
11038 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
11042 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
11055 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
11058 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
11063 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
11067 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
11072 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
11076 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
11127 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
11132 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
11136 spec = codec->spec; in patch_alc861()
11137 if (has_cdefine_beep(codec)) in patch_alc861()
11144 alc_pre_init(codec); in patch_alc861()
11146 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
11147 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
11150 err = alc861_parse_auto_config(codec); in patch_alc861()
11160 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
11165 alc_free(codec); in patch_alc861()
11176 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
11180 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
11189 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
11193 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
11194 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
11199 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
11202 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
11206 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
11229 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
11234 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
11238 spec = codec->spec; in patch_alc861vd()
11239 if (has_cdefine_beep(codec)) in patch_alc861vd()
11244 alc_pre_init(codec); in patch_alc861vd()
11246 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
11247 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
11250 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
11260 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
11265 alc_free(codec); in patch_alc861vd()
11285 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
11292 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
11293 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
11294 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
11298 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
11301 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
11306 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
11311 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
11324 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
11328 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
11334 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
11338 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
11339 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
11344 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
11347 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
11349 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
11352 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
11356 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
11359 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
11362 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
11366 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
11370 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
11373 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
11380 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
11389 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
11390 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
11391 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
11393 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
11394 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
11398 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
11402 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
11407 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
11410 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
11416 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
11421 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
11424 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
11436 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
11439 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
11444 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
11447 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
11450 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
11452 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc897_hp_automute_hook()
11456 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
11459 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
11465 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mode() argument
11468 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mode()
11500 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
11502 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
12234 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
12239 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
12243 spec = codec->spec; in patch_alc662()
12250 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
12252 switch (codec->core.vendor_id) { in patch_alc662()
12258 alc_pre_init(codec); in patch_alc662()
12260 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
12262 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
12263 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
12265 alc_auto_parse_customize_define(codec); in patch_alc662()
12267 if (has_cdefine_beep(codec)) in patch_alc662()
12270 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
12271 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
12273 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
12279 err = alc662_parse_auto_config(codec); in patch_alc662()
12284 switch (codec->core.vendor_id) { in patch_alc662()
12302 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
12307 alc_free(codec); in patch_alc662()
12315 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
12317 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
12322 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
12327 err = alc_alloc_spec(codec, 0); in patch_alc680()
12332 err = alc680_parse_auto_config(codec); in patch_alc680()
12334 alc_free(codec); in patch_alc680()