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()
2625 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2629 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2634 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2639 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2643 spec = codec->spec; in patch_alc882()
2645 switch (codec->core.vendor_id) { in patch_alc882()
2654 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2658 alc_pre_init(codec); in patch_alc882()
2660 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2662 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2663 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2665 alc_auto_parse_customize_define(codec); in patch_alc882()
2667 if (has_cdefine_beep(codec)) in patch_alc882()
2671 err = alc882_parse_auto_config(codec); in patch_alc882()
2681 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2686 alc_free(codec); in patch_alc882()
2694 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2698 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2813 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2818 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2822 spec = codec->spec; in patch_alc262()
2831 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2833 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2835 alc_pre_init(codec); in patch_alc262()
2837 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2839 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2841 alc_auto_parse_customize_define(codec); in patch_alc262()
2843 if (has_cdefine_beep(codec)) in patch_alc262()
2847 err = alc262_parse_auto_config(codec); in patch_alc262()
2857 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2862 alc_free(codec); in patch_alc262()
2873 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2877 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2886 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
2958 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2961 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2966 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2972 err = alc_alloc_spec(codec, 0); in patch_alc268()
2976 spec = codec->spec; in patch_alc268()
2977 if (has_cdefine_beep(codec)) in patch_alc268()
2982 alc_pre_init(codec); in patch_alc268()
2984 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2985 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2988 err = alc268_parse_auto_config(codec); in patch_alc268()
3001 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3002 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3004 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3011 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3016 alc_free(codec); in patch_alc268()
3060 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3065 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3099 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3110 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3129 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3132 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3134 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3139 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3147 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3148 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3149 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3154 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3155 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3160 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3162 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3167 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3175 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3176 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3177 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3182 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3183 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3188 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3191 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3197 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3202 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3205 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3209 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3214 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3216 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3219 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3221 struct alc_spec *spec = codec->spec; in alc269_shutup()
3224 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3226 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3229 alc_shutup_pins(codec); in alc269_shutup()
3265 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3267 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3270 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3272 struct alc_spec *spec = codec->spec; in alc282_init()
3277 alc282_restore_default_value(codec); in alc282_init()
3281 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3282 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3286 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3291 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3297 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3304 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3307 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3309 struct alc_spec *spec = codec->spec; in alc282_shutup()
3315 alc269_shutup(codec); in alc282_shutup()
3319 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3320 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3321 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3326 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3333 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3339 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3340 alc_shutup_pins(codec); in alc282_shutup()
3341 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3381 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3383 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3386 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3388 struct alc_spec *spec = codec->spec; in alc283_init()
3392 alc283_restore_default_value(codec); in alc283_init()
3398 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3402 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3404 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3410 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3417 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3419 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3422 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3424 struct alc_spec *spec = codec->spec; in alc283_shutup()
3429 alc269_shutup(codec); in alc283_shutup()
3433 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3435 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3438 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3440 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3447 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3450 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3454 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3455 alc_shutup_pins(codec); in alc283_shutup()
3456 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3459 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3461 struct alc_spec *spec = codec->spec; in alc256_init()
3470 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3475 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3477 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3478 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3479 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3480 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3481 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3485 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3491 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3497 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3498 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3499 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3500 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3507 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3510 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3512 struct alc_spec *spec = codec->spec; in alc256_shutup()
3519 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3524 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3537 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3540 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3546 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3547 alc_shutup_pins(codec); in alc256_shutup()
3550 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3551 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3552 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3553 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3554 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3559 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3561 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3566 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3567 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3568 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3569 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3570 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3571 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3573 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3576 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3580 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3581 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3584 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3587 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3588 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3589 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3590 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3592 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3593 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3596 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3599 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3600 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3601 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3602 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3605 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3608 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3610 struct alc_spec *spec = codec->spec; in alc225_init()
3617 is_s3_resume(codec) || in alc225_init()
3618 is_s4_resume(codec)) { in alc225_init()
3619 alc285_hp_init(codec); in alc225_init()
3627 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3628 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3633 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3635 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3636 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3637 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3642 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3645 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3652 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3655 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3661 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3662 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3665 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3667 struct alc_spec *spec = codec->spec; in alc225_shutup()
3674 alc_disable_headset_jack_key(codec); in alc225_shutup()
3676 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3678 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3679 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3685 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3688 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3695 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3698 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3704 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3705 alc_shutup_pins(codec); in alc225_shutup()
3708 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3709 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3710 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3711 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3715 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3716 alc_enable_headset_jack_key(codec); in alc225_shutup()
3719 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3721 struct alc_spec *spec = codec->spec; in alc_default_init()
3730 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3735 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3741 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3748 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3750 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3755 alc269_shutup(codec); in alc_default_shutup()
3759 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3764 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3771 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3777 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3778 alc_shutup_pins(codec); in alc_default_shutup()
3781 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3783 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3790 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3796 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3799 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3800 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3803 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3806 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3809 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3813 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3815 struct alc_spec *spec = codec->spec; in alc294_init()
3819 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3820 alc294_hp_init(codec); in alc294_init()
3823 alc_default_init(codec); in alc294_init()
3826 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3829 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3830 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3831 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3834 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3838 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3839 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3841 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3846 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3850 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3851 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3852 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3853 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3854 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3855 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3856 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3857 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3858 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3861 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3863 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3864 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3865 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3866 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3867 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3868 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3871 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3875 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3876 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3877 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3878 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3879 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3880 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3881 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3882 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3883 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3884 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3885 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3886 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3887 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3888 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3889 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3891 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3893 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3895 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3897 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3898 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3899 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3900 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3901 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3902 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3903 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3906 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3911 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
3912 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
3914 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3915 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3919 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3921 struct alc_spec *spec = codec->spec; in alc269_suspend()
3924 alc5505_dsp_suspend(codec); in alc269_suspend()
3925 return alc_suspend(codec); in alc269_suspend()
3928 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3930 struct alc_spec *spec = codec->spec; in alc269_resume()
3933 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3935 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3939 codec->patch_ops.init(codec); in alc269_resume()
3942 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3944 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3948 snd_hda_regmap_sync(codec); in alc269_resume()
3949 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3956 alc_write_gpio_data(codec); in alc269_resume()
3959 alc5505_dsp_resume(codec); in alc269_resume()
3965 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3968 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3974 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
3978 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
3979 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
3982 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
3987 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3991 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3994 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3997 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4003 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4013 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4014 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4016 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4018 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4022 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4027 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4030 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4033 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4045 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4054 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4057 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4059 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4061 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4062 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4065 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4068 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4074 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4077 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4080 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4084 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4087 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4099 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4103 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4104 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4107 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4109 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4110 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4111 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4114 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4116 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4117 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4120 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4144 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4145 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4146 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4147 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4148 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4149 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4150 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4151 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4154 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4157 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4160 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4167 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4176 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4180 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4181 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4182 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4189 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4190 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4192 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4198 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4202 struct alc_spec *spec = codec->spec; in led_power_filter()
4209 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4210 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4212 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4215 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4218 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4232 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4233 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4234 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4241 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4245 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4250 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4251 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4255 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4258 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4261 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4264 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4267 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4270 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4274 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4279 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4286 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4287 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4289 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4298 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4299 struct alc_spec *spec = codec->spec; in micmute_led_set()
4301 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4307 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4312 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4314 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4320 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4324 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4328 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4331 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4334 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4337 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4340 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4343 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4346 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4349 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4352 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4355 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4362 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4363 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4365 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4370 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4373 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4375 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4383 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4384 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4388 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4391 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4393 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4396 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4397 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4404 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4407 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4416 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4418 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4425 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4431 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4434 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4439 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4443 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4452 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4459 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4467 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4468 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4470 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4475 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4479 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4487 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4491 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4495 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4503 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4511 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4512 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4514 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4519 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4522 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4529 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4533 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4536 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4543 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4547 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4550 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4551 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4554 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4557 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4558 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4561 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4564 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4568 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4569 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4573 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4576 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4577 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4581 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4584 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4594 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4596 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4601 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4616 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4630 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4633 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4635 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4638 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4644 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4646 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4664 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4667 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4669 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4672 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4675 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4694 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4697 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4699 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4702 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4717 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4719 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4795 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4799 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4801 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4806 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4811 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4815 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4819 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4822 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4823 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4826 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4829 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4832 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4840 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4841 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4844 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4847 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4851 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
4911 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
4913 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4914 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4915 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
4916 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4921 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4922 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4923 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
4924 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4929 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
4930 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4931 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
4932 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4936 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4937 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4938 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
4939 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4944 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4945 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
4946 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4949 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4950 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
4954 alc_write_coef_idx(codec, 0x45, 0xc429); 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, coef0293); 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 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
4964 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4965 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4968 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
4969 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4970 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
4971 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4979 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
4980 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
4981 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4982 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
4983 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4986 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
4989 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5055 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5062 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5063 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5066 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5071 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5072 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5074 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5079 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5083 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5088 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5091 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5094 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5097 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5100 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5103 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5107 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5163 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5165 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5170 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5175 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5179 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5182 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5184 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5185 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5188 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5189 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5195 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5197 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5200 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5203 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5206 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5214 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5216 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5218 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5221 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5224 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5228 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5277 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5279 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5284 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5289 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5293 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5296 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5297 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5302 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5304 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5307 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5310 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5313 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5321 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5324 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5327 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5331 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5371 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5375 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5377 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5379 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5385 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5386 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5387 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5389 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5392 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5395 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5397 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5400 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5401 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5403 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5406 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5412 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5414 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5419 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5421 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5425 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5428 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5432 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5434 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5435 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5437 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5440 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5441 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5443 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5446 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5447 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5450 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5455 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5457 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5461 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5463 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5467 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5469 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5473 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5475 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5484 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5487 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5490 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5491 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5492 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5494 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5495 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5497 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5500 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5501 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5503 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5506 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5507 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5508 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5510 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5513 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5521 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5526 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5528 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5535 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5545 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5551 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5558 alc_determine_headset_type(codec); in alc_update_headset_mode()
5560 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5562 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5566 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5570 alc_headset_mode_default(codec); in alc_update_headset_mode()
5575 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5578 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5583 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5586 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5590 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5593 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5596 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5597 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
5600 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5603 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5620 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5623 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5630 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5633 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5637 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5642 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5646 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5650 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5653 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5672 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5674 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5679 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5685 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5689 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5691 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5694 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5698 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5700 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5703 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5706 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5709 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5711 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5713 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5716 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5719 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5721 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5729 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5733 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5738 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5742 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5747 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5751 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5758 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5766 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5770 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5771 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5775 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5783 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5787 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5790 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5793 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5798 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5809 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5815 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
5821 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
5827 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5829 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5833 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5838 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5841 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5850 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
5865 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
5868 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
5876 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
5877 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
5879 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
5882 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
5886 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
5887 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
5888 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
5890 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
5894 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
5896 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
5906 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
5915 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
5919 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
5922 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
5927 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
5931 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
5935 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
5951 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
5955 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
5963 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
5966 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
5970 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
5975 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
5979 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
5982 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
5986 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
5993 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
5995 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6000 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6003 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6012 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6018 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6020 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6021 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6022 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6026 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6029 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6039 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6040 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6043 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6053 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6055 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6061 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6069 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6070 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6074 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6086 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6091 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6096 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6101 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6106 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6111 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6114 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6116 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6118 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6128 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6132 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6134 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6143 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6147 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6162 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6169 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6173 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6183 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6184 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6189 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6193 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6197 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6201 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6202 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6205 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6206 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6213 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6219 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6223 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6226 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6237 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6241 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6247 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6256 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6262 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6265 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6267 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6273 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6274 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6281 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6282 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6287 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6290 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6297 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6302 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6306 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6310 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6316 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6317 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6319 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6322 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6326 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6331 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6338 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6343 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6349 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6350 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6352 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6355 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6358 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6363 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6367 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6372 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6379 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6382 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6387 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6392 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6395 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6400 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6404 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6412 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6417 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6425 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6433 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6435 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6436 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6440 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6442 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6447 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6458 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6460 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6468 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6471 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6472 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
6476 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
6480 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
6495 static void alc256_fixup_tongfang_reset_persistent_settings(struct hda_codec *codec, in alc256_fixup_tongfang_reset_persistent_settings() argument
6506 alc_write_coef_idx(codec, 0x24, 0x0000); in alc256_fixup_tongfang_reset_persistent_settings()
6507 alc_write_coef_idx(codec, 0x26, 0x0000); in alc256_fixup_tongfang_reset_persistent_settings()
6508 alc_write_coef_idx(codec, 0x29, 0x3000); in alc256_fixup_tongfang_reset_persistent_settings()
6509 alc_write_coef_idx(codec, 0x37, 0xfe05); in alc256_fixup_tongfang_reset_persistent_settings()
6510 alc_write_coef_idx(codec, 0x45, 0x5089); in alc256_fixup_tongfang_reset_persistent_settings()
9518 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
9520 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
9526 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
9527 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9528 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
9531 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
9532 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
9533 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
9536 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
9538 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
9541 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
9542 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
9545 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
9547 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
9550 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
9555 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
9560 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
9565 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
9569 spec = codec->spec; in patch_alc269()
9571 codec->power_save_node = 0; in patch_alc269()
9574 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
9575 codec->patch_ops.resume = alc269_resume; in patch_alc269()
9580 switch (codec->core.vendor_id) { in patch_alc269()
9583 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
9585 if (codec->bus->pci && in patch_alc269()
9586 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
9588 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
9592 if (codec->bus->pci && in patch_alc269()
9593 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
9594 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
9595 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
9602 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
9608 alc269_fill_coef(codec); in patch_alc269()
9688 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
9704 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
9710 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
9715 alc_pre_init(codec); in patch_alc269()
9717 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
9723 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
9724 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
9725 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
9726 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
9729 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
9730 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
9731 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
9733 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
9735 alc_auto_parse_customize_define(codec); in patch_alc269()
9737 if (has_cdefine_beep(codec)) in patch_alc269()
9741 err = alc269_parse_auto_config(codec); in patch_alc269()
9751 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
9756 alc_free(codec); in patch_alc269()
9764 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
9768 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
9781 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
9784 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
9789 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
9793 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
9798 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
9802 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
9853 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
9858 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
9862 spec = codec->spec; in patch_alc861()
9863 if (has_cdefine_beep(codec)) in patch_alc861()
9870 alc_pre_init(codec); in patch_alc861()
9872 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
9873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
9876 err = alc861_parse_auto_config(codec); in patch_alc861()
9886 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
9891 alc_free(codec); in patch_alc861()
9902 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
9906 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
9915 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
9919 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
9920 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
9925 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
9928 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
9932 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
9955 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
9960 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
9964 spec = codec->spec; in patch_alc861vd()
9965 if (has_cdefine_beep(codec)) in patch_alc861vd()
9970 alc_pre_init(codec); in patch_alc861vd()
9972 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
9973 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
9976 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
9986 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
9991 alc_free(codec); in patch_alc861vd()
10011 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
10018 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
10019 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
10020 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
10024 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
10027 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
10032 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
10037 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
10050 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
10054 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
10060 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
10064 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
10065 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
10070 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
10073 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
10075 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
10078 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
10082 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
10085 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
10088 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
10092 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
10096 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
10099 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
10106 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
10115 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
10116 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
10117 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
10119 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10120 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
10124 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
10128 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
10133 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
10136 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
10142 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
10147 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
10150 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
10162 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
10165 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
10194 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
10196 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
10865 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
10870 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
10874 spec = codec->spec; in patch_alc662()
10881 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
10883 switch (codec->core.vendor_id) { in patch_alc662()
10889 alc_pre_init(codec); in patch_alc662()
10891 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
10893 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
10894 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
10896 alc_auto_parse_customize_define(codec); in patch_alc662()
10898 if (has_cdefine_beep(codec)) in patch_alc662()
10901 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
10902 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
10904 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
10910 err = alc662_parse_auto_config(codec); in patch_alc662()
10915 switch (codec->core.vendor_id) { in patch_alc662()
10933 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
10938 alc_free(codec); in patch_alc662()
10946 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
10948 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
10953 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
10958 err = alc_alloc_spec(codec, 0); in patch_alc680()
10963 err = alc680_parse_auto_config(codec); in patch_alc680()
10965 alc_free(codec); in patch_alc680()