Lines Matching refs:codec

107 	void (*init_hook)(struct hda_codec *codec);
109 void (*power_hook)(struct hda_codec *codec);
111 void (*shutup)(struct hda_codec *codec);
135 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_read_coefex_idx()
141 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in alc_read_coefex_idx()
145 #define alc_read_coef_idx(codec, coef_idx) \ argument
146 alc_read_coefex_idx(codec, 0x20, coef_idx)
148 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
151 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_write_coefex_idx()
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in alc_write_coefex_idx()
155 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
156 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
158 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
162 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); in alc_update_coefex_idx()
165 alc_write_coefex_idx(codec, nid, coef_idx, in alc_update_coefex_idx()
169 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
170 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
173 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
175 struct alc_spec *spec = codec->spec; in alc_get_coef0()
178 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
196 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
201 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
203 alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
213 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
215 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
222 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
224 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
226 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
230 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
233 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
241 alc_write_gpio_data(codec); in alc_update_gpio_data()
244 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
246 struct alc_spec *spec = codec->spec; in alc_write_gpio()
251 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
253 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
257 alc_write_gpio_data(codec); in alc_write_gpio()
260 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
264 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
267 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
270 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
273 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
276 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
279 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
282 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
285 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
288 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
291 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
295 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
303 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
305 struct alc_spec *spec = codec->spec; in alc_fix_pll()
308 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
312 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
315 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
319 alc_fix_pll(codec); in alc_fix_pll_init()
323 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
330 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
336 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
345 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
349 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
353 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
357 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
359 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
361 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
365 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
369 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
371 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
373 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
379 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
384 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
403 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
406 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
409 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
410 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
413 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
422 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
426 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
435 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
439 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
442 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
445 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
449 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
453 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
460 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
466 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
468 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
473 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
479 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
481 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
483 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
484 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
489 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
497 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
500 static int find_ext_mic_pin(struct hda_codec *codec);
502 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
505 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
511 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
514 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
517 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
521 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
524 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
526 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
528 switch (codec->core.vendor_id) { in alc_shutup_pins()
535 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
539 snd_hda_shutup_pins(codec); in alc_shutup_pins()
547 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
549 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
551 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
554 alc_shutup_pins(codec); in alc_eapd_shutup()
558 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
560 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
561 alc_write_gpio(codec); in alc_auto_init_amp()
564 switch (codec->core.vendor_id) { in alc_auto_init_amp()
566 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
572 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
575 alc888_coef_init(codec); in alc_auto_init_amp()
601 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
604 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
611 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
614 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
618 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
622 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
626 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
637 if (!codec->bus->pci) in alc_auto_parse_customize_define()
639 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
640 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
644 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
646 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
649 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
650 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
674 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
676 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
678 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
679 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
680 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
681 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
682 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
683 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
684 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
713 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
717 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
726 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
727 if (codec->bus->pci && in alc_subsystem_id()
728 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
741 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
743 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
744 codec_dbg(codec, in alc_subsystem_id()
761 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
762 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
774 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
777 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
780 alc_setup_gpio(codec, 0x03); in alc_subsystem_id()
815 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
817 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
818 struct alc_spec *spec = codec->spec; in alc_ssid_check()
820 codec_dbg(codec, in alc_ssid_check()
830 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
833 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
839 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
843 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
847 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
856 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
858 alc_fill_eapd_coef(codec); in alc_pre_init()
861 #define is_s3_resume(codec) \ argument
862 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
863 #define is_s4_resume(codec) \ argument
864 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
866 static int alc_init(struct hda_codec *codec) in alc_init() argument
868 struct alc_spec *spec = codec->spec; in alc_init()
871 if (is_s4_resume(codec)) in alc_init()
872 alc_pre_init(codec); in alc_init()
875 spec->init_hook(codec); in alc_init()
878 snd_hda_gen_init(codec); in alc_init()
879 alc_fix_pll(codec); in alc_init()
880 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
881 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
883 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
888 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
890 struct alc_spec *spec = codec->spec; in alc_shutup()
892 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
896 spec->shutup(codec); in alc_shutup()
898 alc_shutup_pins(codec); in alc_shutup()
904 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
906 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
909 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
911 struct alc_spec *spec = codec->spec; in alc_suspend()
912 alc_shutup(codec); in alc_suspend()
914 spec->power_hook(codec); in alc_suspend()
920 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
922 struct alc_spec *spec = codec->spec; in alc_resume()
926 codec->patch_ops.init(codec); in alc_resume()
927 snd_hda_regmap_sync(codec); in alc_resume()
928 hda_call_check_power_status(codec, 0x01); in alc_resume()
949 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1020 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1026 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1028 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1029 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1032 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1035 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1037 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1040 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1041 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1093 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1095 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1097 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1104 #define has_cdefine_beep(codec) 0 argument
1111 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1115 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1119 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1125 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1127 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1135 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1142 codec->spec = spec; in alc_alloc_spec()
1146 codec->single_adc_amp = 1; in alc_alloc_spec()
1148 codec->spdif_status_reset = 1; in alc_alloc_spec()
1149 codec->forced_resume = 1; in alc_alloc_spec()
1150 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1152 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1160 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1164 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1199 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1203 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1582 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1587 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1591 spec = codec->spec; in patch_alc880()
1595 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1597 alc_pre_init(codec); in patch_alc880()
1599 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1601 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1604 err = alc880_parse_auto_config(codec); in patch_alc880()
1614 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1619 alc_free(codec); in patch_alc880()
1627 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1631 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1651 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1653 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1655 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1658 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1661 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1670 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1672 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1676 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1679 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1698 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1704 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1707 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1712 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1715 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1831 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1836 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1840 spec = codec->spec; in patch_alc260()
1850 alc_pre_init(codec); in patch_alc260()
1852 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1854 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1857 err = alc260_parse_auto_config(codec); in patch_alc260()
1867 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1872 alc_free(codec); in patch_alc260()
1934 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1939 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1943 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
1946 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
1949 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
1956 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
1963 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
1964 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
1965 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
1966 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
1970 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1971 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1972 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1973 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1978 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
1982 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
1988 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
1991 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
1993 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
1999 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2002 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2007 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2009 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2015 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2021 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2025 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2031 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2035 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2041 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2048 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2051 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2058 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2064 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2067 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2079 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2082 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2087 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2092 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2096 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2100 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2104 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2105 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2108 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2109 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2116 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2125 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2129 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2130 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2133 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2136 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2140 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2141 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2144 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2147 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2150 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2156 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2159 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2162 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2165 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2626 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2630 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2635 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2640 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2644 spec = codec->spec; in patch_alc882()
2646 switch (codec->core.vendor_id) { in patch_alc882()
2655 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2659 alc_pre_init(codec); in patch_alc882()
2661 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2663 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2664 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2666 alc_auto_parse_customize_define(codec); in patch_alc882()
2668 if (has_cdefine_beep(codec)) in patch_alc882()
2672 err = alc882_parse_auto_config(codec); in patch_alc882()
2682 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2687 alc_free(codec); in patch_alc882()
2695 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2699 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2814 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2819 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2823 spec = codec->spec; in patch_alc262()
2832 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2834 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2836 alc_pre_init(codec); in patch_alc262()
2838 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2840 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2842 alc_auto_parse_customize_define(codec); in patch_alc262()
2844 if (has_cdefine_beep(codec)) in patch_alc262()
2848 err = alc262_parse_auto_config(codec); in patch_alc262()
2858 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2863 alc_free(codec); in patch_alc262()
2874 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2878 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2887 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
2959 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2962 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2967 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2973 err = alc_alloc_spec(codec, 0); in patch_alc268()
2977 spec = codec->spec; in patch_alc268()
2978 if (has_cdefine_beep(codec)) in patch_alc268()
2983 alc_pre_init(codec); in patch_alc268()
2985 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2986 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2989 err = alc268_parse_auto_config(codec); in patch_alc268()
3002 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3003 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3005 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3012 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3017 alc_free(codec); in patch_alc268()
3061 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3066 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3100 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3111 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3130 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3133 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3135 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3140 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3148 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3149 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3150 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3155 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3156 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3161 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3163 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3168 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3176 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3177 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3178 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3183 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3184 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3189 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3192 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3198 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3203 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3206 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3210 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3215 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3217 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3220 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3222 struct alc_spec *spec = codec->spec; in alc269_shutup()
3225 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3227 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3230 alc_shutup_pins(codec); in alc269_shutup()
3266 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3268 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3271 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3273 struct alc_spec *spec = codec->spec; in alc282_init()
3278 alc282_restore_default_value(codec); in alc282_init()
3282 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3283 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3287 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3292 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3298 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3305 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3308 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3310 struct alc_spec *spec = codec->spec; in alc282_shutup()
3316 alc269_shutup(codec); in alc282_shutup()
3320 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3321 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3322 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3327 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3334 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3340 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3341 alc_shutup_pins(codec); in alc282_shutup()
3342 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3382 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3384 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3387 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3389 struct alc_spec *spec = codec->spec; in alc283_init()
3393 alc283_restore_default_value(codec); in alc283_init()
3399 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3403 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3405 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3411 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3418 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3420 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3423 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3425 struct alc_spec *spec = codec->spec; in alc283_shutup()
3430 alc269_shutup(codec); in alc283_shutup()
3434 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3436 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3439 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3441 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3448 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3451 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3455 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3456 alc_shutup_pins(codec); in alc283_shutup()
3457 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3460 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3462 struct alc_spec *spec = codec->spec; in alc256_init()
3471 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3476 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3478 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3479 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3480 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3481 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3482 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3486 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3492 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3498 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3499 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3500 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3501 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3508 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3511 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3513 struct alc_spec *spec = codec->spec; in alc256_shutup()
3520 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3525 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3538 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3541 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3547 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3548 alc_shutup_pins(codec); in alc256_shutup()
3551 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3552 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3553 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3554 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3555 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3560 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3562 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3567 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3568 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3569 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3570 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3571 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3572 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3574 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3577 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3581 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3582 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3585 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3588 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3589 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3590 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3591 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3593 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3594 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3597 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3600 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3601 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3602 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3603 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3606 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3609 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3611 struct alc_spec *spec = codec->spec; in alc225_init()
3618 is_s3_resume(codec) || in alc225_init()
3619 is_s4_resume(codec)) { in alc225_init()
3620 alc285_hp_init(codec); in alc225_init()
3628 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3629 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3634 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3636 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3637 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3638 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3643 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3646 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3653 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3656 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3662 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3663 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3666 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3668 struct alc_spec *spec = codec->spec; in alc225_shutup()
3675 alc_disable_headset_jack_key(codec); in alc225_shutup()
3677 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3679 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3680 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3686 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3689 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3696 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3699 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3705 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3706 alc_shutup_pins(codec); in alc225_shutup()
3709 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3710 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3711 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3712 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3716 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3717 alc_enable_headset_jack_key(codec); in alc225_shutup()
3720 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3722 struct alc_spec *spec = codec->spec; in alc_default_init()
3731 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3736 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3742 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3749 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3751 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3756 alc269_shutup(codec); in alc_default_shutup()
3760 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3765 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3772 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3778 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3779 alc_shutup_pins(codec); in alc_default_shutup()
3782 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3784 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3791 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3797 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3800 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3801 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3804 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3807 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3810 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3814 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3816 struct alc_spec *spec = codec->spec; in alc294_init()
3820 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3821 alc294_hp_init(codec); in alc294_init()
3824 alc_default_init(codec); in alc294_init()
3827 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3830 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3831 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3832 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3835 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3839 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3840 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3842 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3847 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3851 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3852 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3853 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3854 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3855 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3856 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3857 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3858 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3859 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3862 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3864 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3865 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3866 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3867 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3868 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3869 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3872 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3876 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3877 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3878 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3879 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3880 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3881 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3882 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3883 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3884 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3885 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3886 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3887 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3888 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3889 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3890 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3892 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3894 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3896 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3898 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3899 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3900 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3901 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3902 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3903 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3904 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3907 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3912 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
3913 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
3915 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3916 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3920 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3922 struct alc_spec *spec = codec->spec; in alc269_suspend()
3925 alc5505_dsp_suspend(codec); in alc269_suspend()
3926 return alc_suspend(codec); in alc269_suspend()
3929 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3931 struct alc_spec *spec = codec->spec; in alc269_resume()
3934 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3936 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3940 codec->patch_ops.init(codec); in alc269_resume()
3943 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3945 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3949 snd_hda_regmap_sync(codec); in alc269_resume()
3950 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3957 alc_write_gpio_data(codec); in alc269_resume()
3960 alc5505_dsp_resume(codec); in alc269_resume()
3966 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3969 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3975 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
3979 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
3980 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
3983 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
3988 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3992 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3995 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3998 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4004 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4014 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4015 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4017 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4019 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4023 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4028 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4031 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4034 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4046 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4055 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4058 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4060 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4062 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4063 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4066 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4069 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4075 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4078 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4081 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4085 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4088 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4100 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4104 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4105 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4108 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4110 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4111 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4112 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4115 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4117 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4118 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4121 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4145 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4146 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4147 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4148 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4149 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4150 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4151 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4152 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4155 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4158 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4161 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4168 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4177 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4181 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4182 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4183 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4190 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4191 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4193 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4199 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4203 struct alc_spec *spec = codec->spec; in led_power_filter()
4210 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4211 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4213 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4216 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4219 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4233 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4234 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4235 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4242 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4246 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4251 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4252 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4256 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4259 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4262 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4265 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4268 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4271 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4275 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4280 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4287 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4288 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4290 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4299 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4300 struct alc_spec *spec = codec->spec; in micmute_led_set()
4302 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4308 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4313 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4315 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4321 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4325 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4329 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4332 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4335 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4338 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4341 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4344 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4347 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4350 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4353 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4356 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4359 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4362 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4366 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4373 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4374 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4376 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4381 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4384 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4386 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4394 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4395 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4399 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4402 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4404 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4407 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4408 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4415 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4418 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4427 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4429 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4436 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4442 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4445 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4450 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4454 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4463 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4470 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4478 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4479 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4481 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4486 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4490 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4498 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4502 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4506 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4514 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4522 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4523 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4525 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4530 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4533 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4540 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4544 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4547 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4554 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4558 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4561 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4562 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4565 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4568 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4569 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4572 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4575 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4579 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4580 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4584 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4587 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4588 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4592 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4595 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4605 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4607 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4612 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4627 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4641 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4644 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4646 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4649 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4655 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4657 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4675 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4678 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4680 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4683 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4686 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4705 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4708 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4710 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4713 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4728 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4730 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4806 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4810 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4812 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4817 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4822 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4826 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4830 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4833 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4834 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4837 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4840 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4843 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4851 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4852 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4855 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4858 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4862 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
4922 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
4924 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4925 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4926 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
4927 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4932 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4933 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4934 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
4935 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4940 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
4941 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4942 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
4943 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4947 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4948 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4949 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
4950 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4955 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4956 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
4957 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4960 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4961 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
4965 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4966 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4967 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
4968 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4971 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
4975 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4976 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4979 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
4980 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4981 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
4982 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4990 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
4991 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
4992 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4993 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
4994 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4997 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5000 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5066 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5073 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5074 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5077 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5082 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5083 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5085 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5090 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5094 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5099 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5102 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5105 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5108 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5111 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5114 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5118 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5174 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5176 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5181 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5186 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5190 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5193 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5195 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5196 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5199 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5200 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5206 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5208 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5211 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5214 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5217 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5225 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5227 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5229 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5232 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5235 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5239 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5288 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5290 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5295 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5300 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5304 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5307 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5308 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5313 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5315 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5318 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5321 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5324 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5332 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5335 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5338 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5342 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5382 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5386 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5388 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5390 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5396 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5397 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5398 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5400 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5403 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5406 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5408 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5411 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5412 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5414 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5417 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5423 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5425 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5430 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5432 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5436 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5439 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5443 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5445 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5446 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5448 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5451 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5452 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5454 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5457 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5458 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5461 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5466 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5468 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5472 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5474 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5478 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5480 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5484 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5486 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5495 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5498 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5501 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5502 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5503 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5505 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5506 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5508 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5511 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5512 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5514 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5517 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5518 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5519 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5521 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5524 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5532 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5537 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5539 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5546 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5556 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5562 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5569 alc_determine_headset_type(codec); in alc_update_headset_mode()
5571 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5573 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5577 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5581 alc_headset_mode_default(codec); in alc_update_headset_mode()
5586 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5589 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5594 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5597 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5601 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5604 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5607 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5608 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5611 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5614 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5631 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5634 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5641 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5644 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5648 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5653 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5657 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5661 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5664 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5683 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5685 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5690 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5696 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5700 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5702 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5705 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5709 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5711 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5714 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5717 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5720 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5722 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5724 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5727 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5730 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5732 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5740 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5744 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5749 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5753 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5758 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5762 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5769 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5777 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5781 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5782 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5786 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5794 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5798 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5801 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5804 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5809 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5820 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5826 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
5832 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
5838 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5840 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5844 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5849 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5852 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5861 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
5876 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
5879 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
5887 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
5888 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
5890 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
5893 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
5897 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
5898 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
5899 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
5901 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
5905 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
5907 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
5917 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
5926 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
5930 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
5933 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
5938 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
5942 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
5946 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
5962 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
5966 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
5974 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
5977 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
5981 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
5986 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
5990 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
5993 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
5997 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6004 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6006 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6011 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6014 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6023 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6029 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6031 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6032 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6033 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6037 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6040 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6050 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6051 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6054 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6064 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6066 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6072 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6080 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6081 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6085 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6097 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6102 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6107 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6112 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6117 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6122 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6125 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6127 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6129 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6139 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6143 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6145 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6154 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6158 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6173 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6180 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6184 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6194 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6195 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6200 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6204 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6208 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6212 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6213 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6216 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6217 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6224 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6230 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6234 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6237 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6248 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6252 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6258 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6267 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6273 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6276 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6278 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6284 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6285 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6292 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6293 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6298 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6301 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6308 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6313 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6317 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6321 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6327 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6328 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6330 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6333 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6337 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6342 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6349 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6354 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6360 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6361 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6363 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6366 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6369 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6374 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6378 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6383 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6390 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6393 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6398 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6403 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6406 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6411 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6415 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6423 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6428 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6436 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6444 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6446 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6447 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6451 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6453 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6458 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6469 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6471 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6479 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6482 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6483 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6487 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6491 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6513 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
6525 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
6535 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
6546 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
6549 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
6558 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
6559 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
6560 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
6562 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
9613 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
9615 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
9621 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
9622 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9623 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
9626 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
9627 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9628 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
9631 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
9633 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
9636 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
9637 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
9640 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
9642 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
9645 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
9650 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
9655 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
9660 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
9664 spec = codec->spec; in patch_alc269()
9666 codec->power_save_node = 0; in patch_alc269()
9669 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
9670 codec->patch_ops.resume = alc269_resume; in patch_alc269()
9675 switch (codec->core.vendor_id) { in patch_alc269()
9678 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
9680 if (codec->bus->pci && in patch_alc269()
9681 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
9683 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
9687 if (codec->bus->pci && in patch_alc269()
9688 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
9689 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
9690 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
9697 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
9703 alc269_fill_coef(codec); in patch_alc269()
9783 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
9799 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
9805 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
9810 alc_pre_init(codec); in patch_alc269()
9812 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
9818 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
9819 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
9820 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
9821 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
9824 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
9825 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
9826 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
9828 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
9830 alc_auto_parse_customize_define(codec); in patch_alc269()
9832 if (has_cdefine_beep(codec)) in patch_alc269()
9836 err = alc269_parse_auto_config(codec); in patch_alc269()
9846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
9851 alc_free(codec); in patch_alc269()
9859 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
9863 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
9876 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
9879 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
9884 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
9888 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
9893 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
9897 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
9948 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
9953 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
9957 spec = codec->spec; in patch_alc861()
9958 if (has_cdefine_beep(codec)) in patch_alc861()
9965 alc_pre_init(codec); in patch_alc861()
9967 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
9968 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
9971 err = alc861_parse_auto_config(codec); in patch_alc861()
9981 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
9986 alc_free(codec); in patch_alc861()
9997 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
10001 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
10010 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
10014 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
10015 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
10020 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
10023 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
10027 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
10050 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
10055 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
10059 spec = codec->spec; in patch_alc861vd()
10060 if (has_cdefine_beep(codec)) in patch_alc861vd()
10065 alc_pre_init(codec); in patch_alc861vd()
10067 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
10068 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
10071 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
10081 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
10086 alc_free(codec); in patch_alc861vd()
10106 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
10113 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
10114 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
10115 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
10119 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
10122 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
10127 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
10132 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
10145 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
10149 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
10155 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
10159 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
10160 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
10165 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
10168 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
10170 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
10173 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
10177 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
10180 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
10183 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
10187 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
10191 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
10194 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
10201 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
10210 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
10211 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
10212 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
10214 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10215 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10219 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
10223 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
10228 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
10231 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
10237 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
10242 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
10245 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
10257 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
10260 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
10265 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
10268 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
10271 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
10273 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc897_hp_automute_hook()
10277 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
10280 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
10310 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
10312 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
11000 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
11005 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
11009 spec = codec->spec; in patch_alc662()
11016 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
11018 switch (codec->core.vendor_id) { in patch_alc662()
11024 alc_pre_init(codec); in patch_alc662()
11026 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
11028 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
11029 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
11031 alc_auto_parse_customize_define(codec); in patch_alc662()
11033 if (has_cdefine_beep(codec)) in patch_alc662()
11036 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
11037 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
11039 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
11045 err = alc662_parse_auto_config(codec); in patch_alc662()
11050 switch (codec->core.vendor_id) { in patch_alc662()
11068 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
11073 alc_free(codec); in patch_alc662()
11081 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
11083 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
11088 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
11093 err = alc_alloc_spec(codec, 0); in patch_alc680()
11098 err = alc680_parse_auto_config(codec); in patch_alc680()
11100 alc_free(codec); in patch_alc680()