Lines Matching full:codec
3 * Universal Interface for Intel High Definition Audio Codec
72 /* codec parameterization */
96 void (*init_hook)(struct hda_codec *codec);
98 void (*power_hook)(struct hda_codec *codec);
100 void (*shutup)(struct hda_codec *codec);
101 void (*reboot_notify)(struct hda_codec *codec);
123 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
128 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_read_coefex_idx()
129 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in alc_read_coefex_idx()
133 #define alc_read_coef_idx(codec, coef_idx) \ argument
134 alc_read_coefex_idx(codec, 0x20, coef_idx)
136 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
139 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_write_coefex_idx()
140 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in alc_write_coefex_idx()
143 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
144 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
146 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
150 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); in alc_update_coefex_idx()
153 alc_write_coefex_idx(codec, nid, coef_idx, in alc_update_coefex_idx()
157 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
158 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
161 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
163 struct alc_spec *spec = codec->spec; in alc_get_coef0()
166 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
184 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
189 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
191 alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
201 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
203 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
210 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
212 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
214 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
218 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
221 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
229 alc_write_gpio_data(codec); in alc_update_gpio_data()
232 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
234 struct alc_spec *spec = codec->spec; in alc_write_gpio()
239 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
241 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
245 alc_write_gpio_data(codec); in alc_write_gpio()
248 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
252 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
255 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
258 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
261 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
264 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
267 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
270 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
273 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
276 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
284 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
286 struct alc_spec *spec = codec->spec; in alc_fix_pll()
289 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
293 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
296 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
300 alc_fix_pll(codec); in alc_fix_pll_init()
304 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
311 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
317 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
326 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
330 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
334 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
338 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
340 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
342 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
346 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
350 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
352 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
354 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
360 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
365 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
382 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
385 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
388 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
397 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
401 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
410 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
413 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
416 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
419 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
423 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
426 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
432 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
438 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
440 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
445 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
451 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
453 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
455 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
456 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
460 /* turn on/off EAPD controls of the codec */
461 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
469 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
472 static int find_ext_mic_pin(struct hda_codec *codec);
474 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
477 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
483 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
486 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
489 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
493 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
496 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
498 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
500 switch (codec->core.vendor_id) { in alc_shutup_pins()
504 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
508 snd_hda_shutup_pins(codec); in alc_shutup_pins()
516 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
518 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
520 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
523 alc_shutup_pins(codec); in alc_eapd_shutup()
527 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
529 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
530 alc_write_gpio(codec); in alc_auto_init_amp()
533 switch (codec->core.vendor_id) { in alc_auto_init_amp()
535 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
541 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
544 alc888_coef_init(codec); in alc_auto_init_amp()
570 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
573 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
580 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
583 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
587 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
591 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
595 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
606 if (!codec->bus->pci) in alc_auto_parse_customize_define()
608 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
609 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
613 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
615 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
618 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
619 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
643 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
645 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
647 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
648 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
649 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
650 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
651 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
652 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
653 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
676 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
682 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
686 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
695 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
696 if (codec->bus->pci && in alc_subsystem_id()
697 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
710 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
712 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
713 codec_dbg(codec, in alc_subsystem_id()
730 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
731 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
743 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
746 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
749 alc_setup_gpio(codec, 0x03); in alc_subsystem_id()
784 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
786 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
787 struct alc_spec *spec = codec->spec; in alc_ssid_check()
788 codec_dbg(codec, in alc_ssid_check()
797 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
800 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
806 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
810 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
814 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
823 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
825 alc_fill_eapd_coef(codec); in alc_pre_init()
828 #define is_s3_resume(codec) \ argument
829 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
830 #define is_s4_resume(codec) \ argument
831 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
833 static int alc_init(struct hda_codec *codec) in alc_init() argument
835 struct alc_spec *spec = codec->spec; in alc_init()
838 if (is_s4_resume(codec)) in alc_init()
839 alc_pre_init(codec); in alc_init()
842 spec->init_hook(codec); in alc_init()
845 snd_hda_gen_init(codec); in alc_init()
846 alc_fix_pll(codec); in alc_init()
847 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
848 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
850 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
855 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
857 struct alc_spec *spec = codec->spec; in alc_shutup()
859 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
863 spec->shutup(codec); in alc_shutup()
865 alc_shutup_pins(codec); in alc_shutup()
868 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
870 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
873 spec->reboot_notify(codec); in alc_reboot_notify()
875 alc_shutup(codec); in alc_reboot_notify()
881 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
883 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
886 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
888 struct alc_spec *spec = codec->spec; in alc_suspend()
889 alc_shutup(codec); in alc_suspend()
891 spec->power_hook(codec); in alc_suspend()
897 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
899 struct alc_spec *spec = codec->spec; in alc_resume()
903 codec->patch_ops.init(codec); in alc_resume()
904 regcache_sync(codec->core.regmap); in alc_resume()
905 hda_call_check_power_status(codec, 0x01); in alc_resume()
927 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
998 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1004 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1006 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1007 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1010 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1013 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1015 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1018 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1019 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1071 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1073 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1075 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); in has_cdefine_beep()
1082 #define has_cdefine_beep(codec) 0 argument
1089 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1093 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1097 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1103 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1105 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1113 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1120 codec->spec = spec; in alc_alloc_spec()
1124 codec->single_adc_amp = 1; in alc_alloc_spec()
1125 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1126 codec->spdif_status_reset = 1; in alc_alloc_spec()
1127 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1129 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1137 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1141 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1176 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1180 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1559 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1564 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1568 spec = codec->spec; in patch_alc880()
1572 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1574 alc_pre_init(codec); in patch_alc880()
1576 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1578 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1581 err = alc880_parse_auto_config(codec); in patch_alc880()
1591 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1596 alc_free(codec); in patch_alc880()
1604 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1608 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1628 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1630 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1632 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1635 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1638 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1647 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1649 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1653 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1656 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1675 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1681 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1684 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1689 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1692 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1808 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1813 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1817 spec = codec->spec; in patch_alc260()
1827 alc_pre_init(codec); in patch_alc260()
1829 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1831 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1834 err = alc260_parse_auto_config(codec); in patch_alc260()
1844 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1849 alc_free(codec); in patch_alc260()
1908 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1913 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1917 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
1920 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
1923 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
1930 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
1937 snd_hda_override_conn_list(codec, 0x14, 2, conn1); in alc889_fixup_dac_route()
1938 snd_hda_override_conn_list(codec, 0x15, 2, conn1); in alc889_fixup_dac_route()
1939 snd_hda_override_conn_list(codec, 0x18, 2, conn2); in alc889_fixup_dac_route()
1940 snd_hda_override_conn_list(codec, 0x1a, 2, conn2); in alc889_fixup_dac_route()
1944 snd_hda_override_conn_list(codec, 0x14, 5, conn); in alc889_fixup_dac_route()
1945 snd_hda_override_conn_list(codec, 0x15, 5, conn); in alc889_fixup_dac_route()
1946 snd_hda_override_conn_list(codec, 0x18, 5, conn); in alc889_fixup_dac_route()
1947 snd_hda_override_conn_list(codec, 0x1a, 5, conn); in alc889_fixup_dac_route()
1952 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
1955 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
1962 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
1965 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
1967 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
1973 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
1976 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
1981 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
1983 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
1989 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
1995 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
1999 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2005 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2009 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2015 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2022 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2025 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2032 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2035 /* For dual-codec configuration, we need to disable some features to avoid
2038 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2041 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2053 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2056 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2061 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2066 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2070 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2074 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2077 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2078 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2079 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2082 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2083 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2090 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2099 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2103 snd_hda_override_conn_list(codec, 0x14, 1, conn1); in alc1220_fixup_clevo_p950()
2104 snd_hda_override_conn_list(codec, 0x1b, 1, conn1); in alc1220_fixup_clevo_p950()
2107 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2110 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2114 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2115 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2276 * codec replicate the sum signal to both channels,
2417 /* All Apple entries are in codec SSIDs */
2501 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2505 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2510 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2515 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2519 spec = codec->spec; in patch_alc882()
2521 switch (codec->core.vendor_id) { in patch_alc882()
2529 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2533 alc_pre_init(codec); in patch_alc882()
2535 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2537 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2539 alc_auto_parse_customize_define(codec); in patch_alc882()
2541 if (has_cdefine_beep(codec)) in patch_alc882()
2545 err = alc882_parse_auto_config(codec); in patch_alc882()
2555 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2560 alc_free(codec); in patch_alc882()
2568 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2572 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2687 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2692 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2696 spec = codec->spec; in patch_alc262()
2705 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2707 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2709 alc_pre_init(codec); in patch_alc262()
2711 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2713 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2715 alc_auto_parse_customize_define(codec); in patch_alc262()
2717 if (has_cdefine_beep(codec)) in patch_alc262()
2721 err = alc262_parse_auto_config(codec); in patch_alc262()
2731 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2736 alc_free(codec); in patch_alc262()
2747 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
2751 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
2760 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
2822 /* below is codec SSID since multiple Toshiba laptops have the
2832 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2835 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2840 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2846 err = alc_alloc_spec(codec, 0); in patch_alc268()
2850 spec = codec->spec; in patch_alc268()
2851 if (has_cdefine_beep(codec)) in patch_alc268()
2856 alc_pre_init(codec); in patch_alc268()
2858 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2859 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2862 err = alc268_parse_auto_config(codec); in patch_alc268()
2875 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
2876 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
2878 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
2885 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
2890 alc_free(codec); in patch_alc268()
2933 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
2938 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
2971 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
2974 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
2976 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
2979 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
2981 struct alc_spec *spec = codec->spec; in alc269_shutup()
2984 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
2986 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
2989 alc_shutup_pins(codec); in alc269_shutup()
3025 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3027 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3030 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3032 struct alc_spec *spec = codec->spec; in alc282_init()
3037 alc282_restore_default_value(codec); in alc282_init()
3041 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3042 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3046 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3051 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3057 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3064 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3067 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3069 struct alc_spec *spec = codec->spec; in alc282_shutup()
3075 alc269_shutup(codec); in alc282_shutup()
3079 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3080 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3081 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3086 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3093 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3099 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3100 alc_shutup_pins(codec); in alc282_shutup()
3101 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3141 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3143 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3146 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3148 struct alc_spec *spec = codec->spec; in alc283_init()
3152 alc283_restore_default_value(codec); in alc283_init()
3158 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3162 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3164 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3170 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3177 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3179 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3182 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3184 struct alc_spec *spec = codec->spec; in alc283_shutup()
3189 alc269_shutup(codec); in alc283_shutup()
3193 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3195 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3198 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3200 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3207 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3210 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3214 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3215 alc_shutup_pins(codec); in alc283_shutup()
3216 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3219 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3221 struct alc_spec *spec = codec->spec; in alc256_init()
3230 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3235 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3237 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3238 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3239 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3240 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3241 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3245 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3251 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3257 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3258 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3259 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3260 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3261 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/ in alc256_init()
3264 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3266 struct alc_spec *spec = codec->spec; in alc256_shutup()
3273 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3278 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3285 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3286 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3289 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3295 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3296 alc_shutup_pins(codec); in alc256_shutup()
3299 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3300 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3301 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3302 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3303 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3308 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3310 struct alc_spec *spec = codec->spec; in alc225_init()
3318 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3319 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3324 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3326 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3327 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3328 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3333 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3336 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3343 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3346 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3352 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3353 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3356 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3358 struct alc_spec *spec = codec->spec; in alc225_shutup()
3365 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3367 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3368 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3374 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3377 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3384 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3387 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3393 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3394 alc_shutup_pins(codec); in alc225_shutup()
3397 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3398 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3399 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3400 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3405 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3407 struct alc_spec *spec = codec->spec; in alc_default_init()
3416 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3421 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3427 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3434 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3436 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3441 alc269_shutup(codec); in alc_default_shutup()
3445 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3450 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3457 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3463 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3464 alc_shutup_pins(codec); in alc_default_shutup()
3467 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3469 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3476 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3482 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3485 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3486 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
3489 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3492 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
3495 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
3499 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
3501 struct alc_spec *spec = codec->spec; in alc294_init()
3505 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
3506 alc294_hp_init(codec); in alc294_init()
3509 alc_default_init(codec); in alc294_init()
3512 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
3515 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
3516 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
3517 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
3520 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
3524 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
3525 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3527 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
3532 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3536 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3537 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3538 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3539 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3540 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3541 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3542 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3543 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3544 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3547 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3549 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3550 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3551 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3552 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3553 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3554 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3557 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3561 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3562 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3563 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3564 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3565 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3566 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3567 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3568 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3569 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3570 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3571 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3572 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3573 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3574 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3575 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3577 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3579 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3581 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3583 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3584 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3585 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3586 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3587 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3588 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3589 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3592 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3597 #define alc5505_dsp_suspend(codec) /* NOP */ argument
3598 #define alc5505_dsp_resume(codec) /* NOP */ argument
3600 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3601 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3605 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3607 struct alc_spec *spec = codec->spec; in alc269_suspend()
3610 alc5505_dsp_suspend(codec); in alc269_suspend()
3611 return alc_suspend(codec); in alc269_suspend()
3614 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3616 struct alc_spec *spec = codec->spec; in alc269_resume()
3619 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3621 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3625 codec->patch_ops.init(codec); in alc269_resume()
3628 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3630 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3634 regcache_sync(codec->core.regmap); in alc269_resume()
3635 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3637 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
3642 alc_write_gpio_data(codec); in alc269_resume()
3645 alc5505_dsp_resume(codec); in alc269_resume()
3651 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3654 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3660 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
3664 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
3665 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
3668 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
3673 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3677 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3680 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3683 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
3689 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
3699 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
3700 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
3702 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
3704 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
3707 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
3710 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
3722 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
3731 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
3734 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
3736 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
3738 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
3739 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
3742 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
3745 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
3751 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
3754 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
3757 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
3761 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3764 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3776 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
3780 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
3781 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
3784 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
3786 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
3787 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
3788 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
3791 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
3793 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
3794 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
3797 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
3821 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
3822 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
3823 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
3824 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
3825 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
3826 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
3827 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
3828 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
3831 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
3834 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
3837 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
3848 struct hda_codec *codec = private_data; in alc269_fixup_mic_mute_hook() local
3849 struct alc_spec *spec = codec->spec; in alc269_fixup_mic_mute_hook()
3854 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); in alc269_fixup_mic_mute_hook()
3859 snd_hda_power_up_pm(codec); in alc269_fixup_mic_mute_hook()
3860 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); in alc269_fixup_mic_mute_hook()
3861 snd_hda_power_down_pm(codec); in alc269_fixup_mic_mute_hook()
3866 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
3870 struct alc_spec *spec = codec->spec; in led_power_filter()
3877 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
3878 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
3880 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
3883 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
3886 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
3902 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
3903 codec_dbg(codec, in alc269_fixup_hp_mute_led()
3910 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
3914 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
3921 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
3925 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
3928 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
3931 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
3934 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
3937 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
3940 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
3944 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
3947 struct alc_spec *spec = codec->spec; in alc_update_gpio_led()
3951 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
3957 struct hda_codec *codec = private_data; in alc_fixup_gpio_mute_hook() local
3958 struct alc_spec *spec = codec->spec; in alc_fixup_gpio_mute_hook()
3960 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); in alc_fixup_gpio_mute_hook()
3964 static void alc_gpio_micmute_update(struct hda_codec *codec) in alc_gpio_micmute_update() argument
3966 struct alc_spec *spec = codec->spec; in alc_gpio_micmute_update()
3968 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in alc_gpio_micmute_update()
3973 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
3978 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
3980 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
3990 snd_hda_gen_add_micmute_led(codec, alc_gpio_micmute_update); in alc_fixup_hp_gpio_led()
3994 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
3997 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4000 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4003 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4007 static void alc_cap_micmute_update(struct hda_codec *codec) in alc_cap_micmute_update() argument
4009 struct alc_spec *spec = codec->spec; in alc_cap_micmute_update()
4014 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); in alc_cap_micmute_update()
4020 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); in alc_cap_micmute_update()
4023 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4026 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4028 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4036 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); in alc269_fixup_hp_gpio_mic1_led()
4037 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4041 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4044 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4046 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4049 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); in alc280_fixup_hp_gpio4()
4050 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4055 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
4058 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
4068 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
4070 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
4075 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
4090 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
4104 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
4107 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
4109 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
4112 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
4118 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
4120 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
4138 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
4141 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
4143 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
4146 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
4149 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
4168 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
4171 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
4173 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
4176 snd_hda_gen_add_micmute_led(codec, alc_cap_micmute_update); in alc269_fixup_hp_line1_mic1_led()
4191 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
4267 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
4269 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
4273 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
4278 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
4282 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
4286 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4289 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
4290 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
4293 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
4296 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
4299 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
4307 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
4308 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
4311 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
4314 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
4318 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
4378 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
4380 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4381 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4382 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
4383 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4387 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
4388 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4389 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
4390 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4395 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
4396 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4397 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
4398 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4402 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4403 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4404 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
4405 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4410 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4411 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
4412 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4415 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4416 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
4420 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
4421 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4422 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
4423 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4426 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
4430 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4431 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4434 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
4435 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4436 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
4437 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4445 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
4446 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
4447 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
4448 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
4449 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
4452 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
4455 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
4521 switch (codec->core.vendor_id) { in alc_headset_mode_default()
4528 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
4529 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
4532 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
4536 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
4537 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
4539 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
4544 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
4548 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
4553 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
4556 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
4559 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
4562 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
4565 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
4568 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
4572 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
4628 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
4630 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
4634 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
4639 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
4643 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
4646 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
4648 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
4649 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
4652 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
4653 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
4659 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
4661 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
4664 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
4667 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
4670 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
4678 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
4680 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
4682 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
4685 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
4688 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
4692 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
4741 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
4743 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
4747 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
4752 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
4756 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
4759 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
4760 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
4765 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
4767 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
4770 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
4773 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
4776 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
4784 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
4787 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
4790 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
4794 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
4833 switch (codec->core.vendor_id) { in alc_determine_headset_type()
4835 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
4837 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4842 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
4843 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
4844 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
4846 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4849 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4852 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
4854 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4857 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
4858 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
4860 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4863 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4869 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
4871 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4876 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
4878 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4882 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4885 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4889 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4891 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
4892 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
4894 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4897 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
4898 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
4900 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4903 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
4904 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4907 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4912 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
4914 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4918 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
4920 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
4924 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
4926 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4930 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
4932 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
4941 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4944 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4947 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
4948 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
4949 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
4951 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
4952 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
4954 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4957 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
4958 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
4960 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4963 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
4964 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
4965 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
4967 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4970 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
4978 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
4983 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
4985 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
4992 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
5002 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5008 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
5015 alc_determine_headset_type(codec); in alc_update_headset_mode()
5017 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
5019 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
5023 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
5027 alc_headset_mode_default(codec); in alc_update_headset_mode()
5032 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
5035 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
5040 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
5043 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
5047 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
5050 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
5053 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
5056 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
5059 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
5076 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
5079 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
5086 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
5089 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
5093 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
5098 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
5102 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
5106 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
5109 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
5128 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
5130 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
5134 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
5140 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
5144 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
5146 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
5149 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
5153 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
5155 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
5158 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
5161 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
5164 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
5166 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
5168 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
5171 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
5174 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
5176 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
5184 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
5188 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
5193 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
5197 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
5202 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
5206 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
5213 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
5221 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
5226 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
5227 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
5231 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
5241 * ALC298 codec in alc_fixup_tpt470_dock()
5247 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
5252 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
5255 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
5258 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
5263 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
5265 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
5269 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
5274 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
5277 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
5286 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
5301 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
5304 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
5312 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
5313 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
5315 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
5318 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
5322 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
5323 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
5324 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
5326 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
5330 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
5332 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
5342 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
5351 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
5355 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
5358 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
5363 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
5367 static void alc256_fixup_dell_xps_13_headphone_noise2(struct hda_codec *codec, in alc256_fixup_dell_xps_13_headphone_noise2() argument
5374 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 0, HDA_AMP_VOLMASK, 1); in alc256_fixup_dell_xps_13_headphone_noise2()
5375 snd_hda_override_wcaps(codec, 0x1a, get_wcaps(codec, 0x1a) & ~AC_WCAP_IN_AMP); in alc256_fixup_dell_xps_13_headphone_noise2()
5378 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
5382 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
5398 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
5402 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
5410 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
5413 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
5417 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
5422 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
5426 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
5429 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
5433 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
5440 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
5442 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
5447 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
5450 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
5459 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
5465 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
5467 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
5468 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
5469 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
5473 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
5476 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
5486 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
5487 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
5490 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
5500 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
5502 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
5508 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
5516 snd_hda_override_conn_list(codec, 0x14, 1, conn1); in alc290_fixup_mono_speakers()
5517 snd_hda_override_conn_list(codec, 0x15, 1, conn1); in alc290_fixup_mono_speakers()
5521 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
5533 snd_hda_override_conn_list(codec, 0x17, 1, conn1); in alc298_fixup_speaker_volume()
5538 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
5543 snd_hda_override_conn_list(codec, 0x17, 2, conn); in alc295_fixup_disable_dac3()
5548 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
5551 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
5553 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
5555 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); in alc280_hp_gpio4_automute_hook()
5564 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
5568 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
5570 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
5579 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
5583 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
5592 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
5596 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
5600 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
5603 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
5604 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
5605 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
5608 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
5609 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
5617 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
5620 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
5631 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
5635 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
5641 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
5652 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
5674 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
5680 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
5682 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false, in alc_fixup_headset_jack()
5686 switch (codec->core.vendor_id) { in alc_fixup_headset_jack()
5690 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_fixup_headset_jack()
5691 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_fixup_headset_jack()
5692 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_fixup_headset_jack()
5696 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_fixup_headset_jack()
5697 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_fixup_headset_jack()
5704 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
5707 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
5714 switch (codec->core.vendor_id) { in alc295_fixup_chromebook()
5716 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc295_fixup_chromebook()
5717 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc295_fixup_chromebook()
5720 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc295_fixup_chromebook()
5721 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc295_fixup_chromebook()
5728 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
5732 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
5738 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
5741 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
5742 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
7849 * at most one tbl is allowed to define for the same vendor and same codec
7858 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
7860 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
7866 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
7867 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
7868 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
7871 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
7872 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
7873 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
7876 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
7878 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
7881 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
7882 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
7885 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
7887 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
7890 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
7895 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
7900 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
7905 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
7909 spec = codec->spec; in patch_alc269()
7911 codec->power_save_node = 0; in patch_alc269()
7914 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
7915 codec->patch_ops.resume = alc269_resume; in patch_alc269()
7920 switch (codec->core.vendor_id) { in patch_alc269()
7923 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
7925 if (codec->bus->pci && in patch_alc269()
7926 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
7928 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
7932 if (codec->bus->pci && in patch_alc269()
7933 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
7934 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
7935 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
7942 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
7948 alc269_fill_coef(codec); in patch_alc269()
8020 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
8036 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
8042 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
8047 alc_pre_init(codec); in patch_alc269()
8049 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
8051 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
8052 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
8053 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
8055 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
8057 alc_auto_parse_customize_define(codec); in patch_alc269()
8059 if (has_cdefine_beep(codec)) in patch_alc269()
8063 err = alc269_parse_auto_config(codec); in patch_alc269()
8073 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
8078 alc_free(codec); in patch_alc269()
8086 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
8090 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
8103 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
8106 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
8111 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
8115 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
8120 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
8124 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
8176 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
8181 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
8185 spec = codec->spec; in patch_alc861()
8186 if (has_cdefine_beep(codec)) in patch_alc861()
8193 alc_pre_init(codec); in patch_alc861()
8195 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
8196 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
8199 err = alc861_parse_auto_config(codec); in patch_alc861()
8209 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
8214 alc_free(codec); in patch_alc861()
8225 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
8229 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
8238 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
8242 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
8243 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
8248 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
8251 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
8255 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
8278 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
8283 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
8287 spec = codec->spec; in patch_alc861vd()
8288 if (has_cdefine_beep(codec)) in patch_alc861vd()
8293 alc_pre_init(codec); in patch_alc861vd()
8295 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
8296 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
8299 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
8309 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
8314 alc_free(codec); in patch_alc861vd()
8334 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
8341 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
8342 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
8343 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
8347 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
8350 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
8355 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
8360 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
8373 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
8377 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
8383 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
8387 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
8388 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
8393 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
8396 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
8398 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
8401 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
8405 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
8408 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
8411 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
8415 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
8419 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
8422 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
8429 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
8438 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
8439 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
8440 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
8442 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
8443 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
8447 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
8451 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
8456 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
8463 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
8492 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
8494 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
9082 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
9087 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
9091 spec = codec->spec; in patch_alc662()
9098 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
9100 switch (codec->core.vendor_id) { in patch_alc662()
9106 alc_pre_init(codec); in patch_alc662()
9108 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
9110 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
9111 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
9113 alc_auto_parse_customize_define(codec); in patch_alc662()
9115 if (has_cdefine_beep(codec)) in patch_alc662()
9118 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
9119 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
9121 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
9127 err = alc662_parse_auto_config(codec); in patch_alc662()
9132 switch (codec->core.vendor_id) { in patch_alc662()
9150 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
9155 alc_free(codec); in patch_alc662()
9163 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
9165 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
9170 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
9175 err = alc_alloc_spec(codec, 0); in patch_alc680()
9180 err = alc680_parse_auto_config(codec); in patch_alc680()
9182 alc_free(codec); in patch_alc680()
9271 MODULE_DESCRIPTION("Realtek HD-audio codec");