Lines Matching full:codec

3  * Universal Interface for Intel High Definition Audio Codec
80 /* codec parameterization */
107 void (*init_hook)(struct hda_codec *codec);
109 void (*power_hook)(struct hda_codec *codec);
111 void (*shutup)(struct hda_codec *codec);
112 void (*reboot_notify)(struct hda_codec *codec);
136 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
141 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_read_coefex_idx()
142 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in alc_read_coefex_idx()
146 #define alc_read_coef_idx(codec, coef_idx) \ argument
147 alc_read_coefex_idx(codec, 0x20, coef_idx)
149 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
152 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_write_coefex_idx()
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in alc_write_coefex_idx()
156 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
157 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
159 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
163 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); in alc_update_coefex_idx()
166 alc_write_coefex_idx(codec, nid, coef_idx, in alc_update_coefex_idx()
170 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
171 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
174 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
176 struct alc_spec *spec = codec->spec; in alc_get_coef0()
179 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
197 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
202 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
204 alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
214 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
216 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
223 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
225 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
227 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
231 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
234 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
242 alc_write_gpio_data(codec); in alc_update_gpio_data()
245 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
247 struct alc_spec *spec = codec->spec; in alc_write_gpio()
252 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
254 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
258 alc_write_gpio_data(codec); in alc_write_gpio()
261 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
265 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
268 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
271 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
274 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
277 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
280 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
283 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
286 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
289 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
292 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
296 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
304 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
306 struct alc_spec *spec = codec->spec; in alc_fix_pll()
309 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
313 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
316 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
320 alc_fix_pll(codec); in alc_fix_pll_init()
324 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
331 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
337 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
346 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
350 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
354 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
358 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
360 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
362 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
366 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
370 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
372 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
374 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
380 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
385 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
404 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
407 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
410 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
419 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
423 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
432 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
436 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
439 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
442 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
446 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
450 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
457 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
463 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
465 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
470 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
476 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
478 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
480 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
481 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
485 /* turn on/off EAPD controls of the codec */
486 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
494 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
497 static int find_ext_mic_pin(struct hda_codec *codec);
499 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
502 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
508 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
511 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
514 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
518 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
521 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
523 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
525 switch (codec->core.vendor_id) { in alc_shutup_pins()
530 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
534 snd_hda_shutup_pins(codec); in alc_shutup_pins()
542 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
544 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
546 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
549 alc_shutup_pins(codec); in alc_eapd_shutup()
553 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
555 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
556 alc_write_gpio(codec); in alc_auto_init_amp()
559 switch (codec->core.vendor_id) { in alc_auto_init_amp()
561 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
567 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
570 alc888_coef_init(codec); in alc_auto_init_amp()
596 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
599 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
606 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
609 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
613 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
617 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
621 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
632 if (!codec->bus->pci) in alc_auto_parse_customize_define()
634 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
635 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
639 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
641 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
644 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
645 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
669 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
671 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
673 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
674 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
675 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
676 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
677 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
678 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
679 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
702 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
708 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
712 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
721 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
722 if (codec->bus->pci && in alc_subsystem_id()
723 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
736 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
738 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
739 codec_dbg(codec, in alc_subsystem_id()
756 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
757 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
769 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
772 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
775 alc_setup_gpio(codec, 0x03); in alc_subsystem_id()
810 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
812 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
813 struct alc_spec *spec = codec->spec; in alc_ssid_check()
815 codec_dbg(codec, in alc_ssid_check()
825 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
828 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
834 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
838 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
842 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
851 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
853 alc_fill_eapd_coef(codec); in alc_pre_init()
856 #define is_s3_resume(codec) \ argument
857 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
858 #define is_s4_resume(codec) \ argument
859 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
861 static int alc_init(struct hda_codec *codec) in alc_init() argument
863 struct alc_spec *spec = codec->spec; in alc_init()
866 if (is_s4_resume(codec)) in alc_init()
867 alc_pre_init(codec); in alc_init()
870 spec->init_hook(codec); in alc_init()
873 snd_hda_gen_init(codec); in alc_init()
874 alc_fix_pll(codec); in alc_init()
875 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
876 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
878 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
883 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
885 struct alc_spec *spec = codec->spec; in alc_shutup()
887 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
891 spec->shutup(codec); in alc_shutup()
893 alc_shutup_pins(codec); in alc_shutup()
896 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
898 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
901 spec->reboot_notify(codec); in alc_reboot_notify()
903 alc_shutup(codec); in alc_reboot_notify()
909 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
911 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
914 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
916 struct alc_spec *spec = codec->spec; in alc_suspend()
917 alc_shutup(codec); in alc_suspend()
919 spec->power_hook(codec); in alc_suspend()
925 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
927 struct alc_spec *spec = codec->spec; in alc_resume()
931 codec->patch_ops.init(codec); in alc_resume()
932 snd_hda_regmap_sync(codec); in alc_resume()
933 hda_call_check_power_status(codec, 0x01); in alc_resume()
955 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1026 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1032 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1034 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1035 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1038 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1041 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1043 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1046 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1047 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1099 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1101 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1103 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1110 #define has_cdefine_beep(codec) 0 argument
1117 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1121 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1125 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1131 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1133 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1141 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1148 codec->spec = spec; in alc_alloc_spec()
1152 codec->single_adc_amp = 1; in alc_alloc_spec()
1153 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1154 codec->spdif_status_reset = 1; in alc_alloc_spec()
1155 codec->forced_resume = 1; in alc_alloc_spec()
1156 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1158 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1166 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1170 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1205 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1209 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1588 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1593 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1597 spec = codec->spec; in patch_alc880()
1601 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1603 alc_pre_init(codec); in patch_alc880()
1605 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1607 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1610 err = alc880_parse_auto_config(codec); in patch_alc880()
1620 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1625 alc_free(codec); in patch_alc880()
1633 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1637 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1657 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1659 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1661 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1664 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1667 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1676 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1678 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1682 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1685 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1704 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1710 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1713 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1718 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1721 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1837 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1842 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1846 spec = codec->spec; in patch_alc260()
1856 alc_pre_init(codec); in patch_alc260()
1858 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1860 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1863 err = alc260_parse_auto_config(codec); in patch_alc260()
1873 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1878 alc_free(codec); in patch_alc260()
1939 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1944 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1948 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
1951 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
1954 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
1961 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
1968 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
1969 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
1970 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
1971 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
1975 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1976 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1977 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1978 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
1983 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
1987 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
1993 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
1996 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
1998 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2004 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2007 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2012 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2014 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2020 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2026 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2030 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2036 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2040 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2046 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2053 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2056 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2063 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2066 /* For dual-codec configuration, we need to disable some features to avoid
2069 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2072 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2084 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2087 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2092 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2097 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2101 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2105 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2108 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2109 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2110 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2113 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2114 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2121 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2130 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2134 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2135 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2138 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2141 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2145 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2146 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2149 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2152 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2155 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2161 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2164 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2167 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2170 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2332 * codec replicate the sum signal to both channels,
2488 /* All Apple entries are in codec SSIDs */
2592 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2596 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2601 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2606 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2610 spec = codec->spec; in patch_alc882()
2612 switch (codec->core.vendor_id) { in patch_alc882()
2621 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2625 alc_pre_init(codec); in patch_alc882()
2627 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2629 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2631 alc_auto_parse_customize_define(codec); in patch_alc882()
2633 if (has_cdefine_beep(codec)) in patch_alc882()
2637 err = alc882_parse_auto_config(codec); in patch_alc882()
2647 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2652 alc_free(codec); in patch_alc882()
2660 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2664 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2779 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2784 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2788 spec = codec->spec; in patch_alc262()
2797 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2799 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2801 alc_pre_init(codec); in patch_alc262()
2803 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2805 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2807 alc_auto_parse_customize_define(codec); in patch_alc262()
2809 if (has_cdefine_beep(codec)) in patch_alc262()
2813 err = alc262_parse_auto_config(codec); in patch_alc262()
2823 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2828 alc_free(codec); in patch_alc262()
2839 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2843 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2852 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
2914 /* below is codec SSID since multiple Toshiba laptops have the
2924 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2927 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2932 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2938 err = alc_alloc_spec(codec, 0); in patch_alc268()
2942 spec = codec->spec; in patch_alc268()
2943 if (has_cdefine_beep(codec)) in patch_alc268()
2948 alc_pre_init(codec); in patch_alc268()
2950 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2954 err = alc268_parse_auto_config(codec); in patch_alc268()
2967 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
2968 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
2970 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
2977 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
2982 alc_free(codec); in patch_alc268()
3025 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3030 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3063 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3074 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3096 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3098 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3103 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3110 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3111 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3112 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3116 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3117 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3122 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3124 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3129 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3136 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3137 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3138 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3142 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3143 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3148 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3151 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3156 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3158 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, in alc_fixup_headset_jack()
3162 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3167 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3169 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3172 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3174 struct alc_spec *spec = codec->spec; in alc269_shutup()
3177 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3179 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3182 alc_shutup_pins(codec); in alc269_shutup()
3218 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3220 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3223 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3225 struct alc_spec *spec = codec->spec; in alc282_init()
3230 alc282_restore_default_value(codec); in alc282_init()
3234 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3235 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3239 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3244 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3250 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3257 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3260 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3262 struct alc_spec *spec = codec->spec; in alc282_shutup()
3268 alc269_shutup(codec); in alc282_shutup()
3272 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3273 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3274 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3279 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3286 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3292 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3293 alc_shutup_pins(codec); in alc282_shutup()
3294 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3334 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3336 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3339 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3341 struct alc_spec *spec = codec->spec; in alc283_init()
3345 alc283_restore_default_value(codec); in alc283_init()
3351 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3355 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3357 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3363 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3370 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3372 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3375 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3377 struct alc_spec *spec = codec->spec; in alc283_shutup()
3382 alc269_shutup(codec); in alc283_shutup()
3386 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3388 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3391 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3393 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3400 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3403 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3407 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3408 alc_shutup_pins(codec); in alc283_shutup()
3409 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3412 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3414 struct alc_spec *spec = codec->spec; in alc256_init()
3423 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3428 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3430 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3431 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3432 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3433 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3434 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3438 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3444 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3450 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3451 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3452 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3453 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3460 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3463 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3465 struct alc_spec *spec = codec->spec; in alc256_shutup()
3472 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3477 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3484 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3486 * when booting with headset plugged. So skip setting it for the codec alc257 in alc256_shutup()
3488 if (codec->core.vendor_id != 0x10ec0257) in alc256_shutup()
3489 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3492 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3498 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3499 alc_shutup_pins(codec); in alc256_shutup()
3502 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3503 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3504 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3505 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3506 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3511 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3513 struct alc_spec *spec = codec->spec; in alc225_init()
3521 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3522 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3527 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3529 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3530 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3531 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3536 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3539 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3546 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3549 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3555 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3556 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3559 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3561 struct alc_spec *spec = codec->spec; in alc225_shutup()
3568 alc_disable_headset_jack_key(codec); in alc225_shutup()
3570 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3572 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3573 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3579 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3582 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3589 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3592 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3598 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3599 alc_shutup_pins(codec); in alc225_shutup()
3602 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3603 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3604 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3605 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3609 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3610 alc_enable_headset_jack_key(codec); in alc225_shutup()
3613 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3615 struct alc_spec *spec = codec->spec; in alc_default_init()
3624 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3629 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3635 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3642 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3644 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3649 alc269_shutup(codec); in alc_default_shutup()
3653 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3658 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3665 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3671 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3672 alc_shutup_pins(codec); in alc_default_shutup()
3675 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3677 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3684 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3690 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3693 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3694 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3697 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3700 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3703 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3707 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3709 struct alc_spec *spec = codec->spec; in alc294_init()
3713 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3714 alc294_hp_init(codec); in alc294_init()
3717 alc_default_init(codec); in alc294_init()
3720 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3723 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3724 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3725 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3728 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3732 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3733 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3735 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3740 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3744 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3745 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3746 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3747 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3748 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3749 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3750 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3751 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3752 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3755 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3757 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3758 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3759 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3760 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3761 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3762 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3765 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3769 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3770 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3771 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3772 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3773 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3774 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3775 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3776 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3777 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3778 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3779 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3780 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3781 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3782 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3783 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3785 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3787 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3789 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3791 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3792 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3793 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3794 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3795 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3796 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3797 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3800 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3805 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
3806 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
3808 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3809 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3813 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3815 struct alc_spec *spec = codec->spec; in alc269_suspend()
3818 alc5505_dsp_suspend(codec); in alc269_suspend()
3819 return alc_suspend(codec); in alc269_suspend()
3822 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3824 struct alc_spec *spec = codec->spec; in alc269_resume()
3827 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3829 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3833 codec->patch_ops.init(codec); in alc269_resume()
3836 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3838 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3842 snd_hda_regmap_sync(codec); in alc269_resume()
3843 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3845 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
3850 alc_write_gpio_data(codec); in alc269_resume()
3853 alc5505_dsp_resume(codec); in alc269_resume()
3859 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3862 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3868 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
3872 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
3873 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
3876 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
3881 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3885 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3888 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3891 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
3897 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
3907 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
3908 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
3910 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
3912 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
3915 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
3918 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
3930 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
3939 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
3942 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
3944 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
3946 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
3947 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
3950 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
3953 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
3959 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
3962 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
3965 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
3969 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3972 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3984 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
3988 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
3989 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
3992 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
3994 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
3995 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
3996 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
3999 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4001 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4002 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4005 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4029 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4030 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4031 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4032 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4033 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4034 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4035 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4036 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4039 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4042 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4045 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4052 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4061 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4065 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4066 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4067 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4074 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4075 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4077 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4083 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4087 struct alc_spec *spec = codec->spec; in led_power_filter()
4094 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4095 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4097 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4100 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4103 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4117 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4118 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4119 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4126 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4130 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4135 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4136 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4140 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4143 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4146 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4149 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4152 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4155 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4159 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4164 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4171 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4172 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4174 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4183 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4184 struct alc_spec *spec = codec->spec; in micmute_led_set()
4186 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4192 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4197 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4199 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4205 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4209 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4213 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4216 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4219 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4222 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4225 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4228 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4231 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4234 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4241 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4242 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4244 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4249 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4252 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4254 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4262 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4263 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4267 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4270 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4272 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4275 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4276 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4280 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4287 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4295 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4296 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4298 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4303 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4307 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4315 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4319 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4323 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4331 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4339 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4340 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4342 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4347 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4350 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4357 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4361 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4364 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4371 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4375 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4378 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4379 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4382 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4385 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4386 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4390 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4393 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4403 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4405 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4410 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4425 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4439 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4442 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4444 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4447 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4453 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4455 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4473 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4476 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4478 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4481 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4484 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4503 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4506 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4508 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4511 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
4526 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4528 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
4604 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
4608 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4610 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4614 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4619 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4623 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4627 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4630 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4631 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4634 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4637 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4640 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4648 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4649 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4652 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4655 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4659 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
4719 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
4721 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4722 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4723 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
4724 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4728 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4729 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4730 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
4731 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4736 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
4737 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4738 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
4739 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4743 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4744 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4745 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
4746 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4751 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4752 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
4753 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4756 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4757 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
4761 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4762 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4763 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
4764 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4767 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
4771 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4772 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4775 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
4776 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4777 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
4778 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4786 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
4787 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
4788 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4789 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
4790 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4793 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
4796 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
4862 switch (codec->core.vendor_id) { in alc_headset_mode_default()
4869 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
4870 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
4873 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
4877 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
4878 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
4880 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
4885 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
4889 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
4894 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
4897 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
4900 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
4903 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
4906 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
4909 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
4913 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
4969 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
4971 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
4975 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
4980 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
4984 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
4987 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
4989 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
4990 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
4993 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
4994 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5000 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5002 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5005 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5008 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5011 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5019 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5021 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5023 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5026 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5029 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5033 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5082 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5084 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5088 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5093 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5097 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5100 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5101 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5106 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5108 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5111 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5114 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5117 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5125 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5128 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5131 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5135 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5175 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5179 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5181 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5183 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5188 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5189 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5190 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5192 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5195 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5198 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5200 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5203 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5204 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5206 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5209 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5215 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5217 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5222 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5224 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5228 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5231 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5235 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5237 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5238 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5240 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5243 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5244 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5246 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5249 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5250 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5253 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5258 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5260 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5264 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5266 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5270 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5272 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5276 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5278 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5287 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5290 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5293 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5294 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5295 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5297 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5298 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5300 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5303 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5304 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5306 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5309 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
5310 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
5311 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
5313 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5316 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5324 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
5329 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
5331 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
5338 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5348 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5354 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5361 alc_determine_headset_type(codec); in alc_update_headset_mode()
5363 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5365 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5369 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5373 alc_headset_mode_default(codec); in alc_update_headset_mode()
5378 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5381 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5386 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5389 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5393 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5396 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5399 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5402 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5405 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5422 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5425 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5432 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5435 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5439 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5444 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5448 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5452 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5455 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5474 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5476 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5480 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5486 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5490 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5492 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5495 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5499 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5501 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5504 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5507 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5510 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5512 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5514 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5517 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5520 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5522 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5530 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5534 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5539 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5543 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5548 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5552 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5559 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5567 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5572 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5573 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5577 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5585 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5589 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5592 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5595 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5600 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
5605 * ALC298 codec in alc_fixup_tpt470_dacs()
5611 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
5617 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5619 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5623 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5628 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5631 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5640 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
5655 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
5658 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
5666 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
5667 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
5669 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
5672 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
5676 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
5677 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
5678 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
5680 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
5684 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
5686 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
5696 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
5705 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
5709 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
5712 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
5717 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
5721 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
5725 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
5741 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
5745 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
5753 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
5756 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
5760 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
5765 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
5769 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
5772 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
5776 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
5783 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
5785 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
5790 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
5793 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
5802 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
5808 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
5810 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
5811 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
5812 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
5816 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
5819 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
5829 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
5830 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
5833 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
5843 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
5845 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
5851 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
5859 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
5860 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
5864 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
5876 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
5881 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
5886 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
5891 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
5896 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
5901 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
5904 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
5906 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
5908 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
5918 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
5922 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
5924 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
5933 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
5937 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
5952 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
5959 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
5963 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
5973 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
5974 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
5979 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
5983 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
5987 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
5990 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
5991 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
5992 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
5995 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
5996 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6003 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6009 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6013 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6016 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6027 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6031 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6037 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6046 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6052 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6055 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6057 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6063 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6064 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6070 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6071 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6076 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6079 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6086 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6091 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6095 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6099 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6102 /* The Windows driver sets the codec up in a very different way where in alc294_gx502_toggle_output()
6105 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6106 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6108 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6111 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6115 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6120 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6127 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6132 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6139 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6142 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6147 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6152 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6155 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6160 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6164 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6172 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
6175 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
6176 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
8728 * at most one tbl is allowed to define for the same vendor and same codec
8746 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
8748 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
8754 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
8755 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
8756 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
8759 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
8760 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
8761 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
8764 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
8766 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
8769 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
8770 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
8773 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
8775 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
8778 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
8783 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
8788 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
8793 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
8797 spec = codec->spec; in patch_alc269()
8799 codec->power_save_node = 0; in patch_alc269()
8802 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
8803 codec->patch_ops.resume = alc269_resume; in patch_alc269()
8808 switch (codec->core.vendor_id) { in patch_alc269()
8811 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
8813 if (codec->bus->pci && in patch_alc269()
8814 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
8816 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
8820 if (codec->bus->pci && in patch_alc269()
8821 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
8822 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
8823 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
8830 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
8836 alc269_fill_coef(codec); in patch_alc269()
8910 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
8926 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
8932 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
8937 alc_pre_init(codec); in patch_alc269()
8939 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
8941 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
8942 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
8943 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
8945 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
8947 alc_auto_parse_customize_define(codec); in patch_alc269()
8949 if (has_cdefine_beep(codec)) in patch_alc269()
8953 err = alc269_parse_auto_config(codec); in patch_alc269()
8963 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
8968 alc_free(codec); in patch_alc269()
8976 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
8980 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
8993 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
8996 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
9001 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
9005 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
9010 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
9014 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
9066 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
9071 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
9075 spec = codec->spec; in patch_alc861()
9076 if (has_cdefine_beep(codec)) in patch_alc861()
9083 alc_pre_init(codec); in patch_alc861()
9085 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
9086 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
9089 err = alc861_parse_auto_config(codec); in patch_alc861()
9099 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
9104 alc_free(codec); in patch_alc861()
9115 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
9119 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
9128 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
9132 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
9133 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
9138 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
9141 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
9145 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
9168 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
9173 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
9177 spec = codec->spec; in patch_alc861vd()
9178 if (has_cdefine_beep(codec)) in patch_alc861vd()
9183 alc_pre_init(codec); in patch_alc861vd()
9185 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
9186 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
9189 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
9199 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
9204 alc_free(codec); in patch_alc861vd()
9224 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
9231 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
9232 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
9233 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
9237 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
9240 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
9245 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
9250 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
9263 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
9267 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
9273 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
9277 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
9278 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
9283 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
9286 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
9288 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
9291 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
9295 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
9298 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
9301 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
9305 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
9309 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
9312 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
9319 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
9328 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
9329 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
9330 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
9332 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
9333 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
9337 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
9341 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
9346 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
9349 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
9355 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
9360 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
9363 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
9375 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
9378 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
9407 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
9409 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
10051 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
10056 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
10060 spec = codec->spec; in patch_alc662()
10067 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
10069 switch (codec->core.vendor_id) { in patch_alc662()
10075 alc_pre_init(codec); in patch_alc662()
10077 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
10079 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
10080 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
10082 alc_auto_parse_customize_define(codec); in patch_alc662()
10084 if (has_cdefine_beep(codec)) in patch_alc662()
10087 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
10088 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
10090 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
10096 err = alc662_parse_auto_config(codec); in patch_alc662()
10101 switch (codec->core.vendor_id) { in patch_alc662()
10119 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
10124 alc_free(codec); in patch_alc662()
10132 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
10134 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
10139 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
10144 err = alc_alloc_spec(codec, 0); in patch_alc680()
10149 err = alc680_parse_auto_config(codec); in patch_alc680()
10151 alc_free(codec); in patch_alc680()
10244 MODULE_DESCRIPTION("Realtek HD-audio codec");