Lines Matching refs:codec
109 void (*init_hook)(struct hda_codec *codec);
111 void (*power_hook)(struct hda_codec *codec);
113 void (*shutup)(struct hda_codec *codec);
114 void (*reboot_notify)(struct hda_codec *codec);
132 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
137 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_read_coefex_idx()
138 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in alc_read_coefex_idx()
142 #define alc_read_coef_idx(codec, coef_idx) \ argument
143 alc_read_coefex_idx(codec, 0x20, coef_idx)
145 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
148 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_write_coefex_idx()
149 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in alc_write_coefex_idx()
152 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
153 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
155 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
159 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); in alc_update_coefex_idx()
162 alc_write_coefex_idx(codec, nid, coef_idx, in alc_update_coefex_idx()
166 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
167 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
170 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
172 struct alc_spec *spec = codec->spec; in alc_get_coef0()
175 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
193 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
198 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
200 alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
247 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
249 struct alc_spec *spec = codec->spec; in alc_fix_pll()
252 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
256 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
259 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
263 alc_fix_pll(codec); in alc_fix_pll_init()
267 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
274 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
280 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
289 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
293 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
297 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
301 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
303 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
305 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
309 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
313 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
315 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
317 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
323 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
333 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
337 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
341 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
350 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
353 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
356 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
360 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
363 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
367 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
373 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
375 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
380 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
386 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
388 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
390 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
391 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
396 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
404 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
410 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
412 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
414 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
417 snd_hda_shutup_pins(codec); in alc_eapd_shutup()
421 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
423 alc_fill_eapd_coef(codec); in alc_auto_init_amp()
424 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
427 snd_hda_sequence_write(codec, alc_gpio1_init_verbs); in alc_auto_init_amp()
430 snd_hda_sequence_write(codec, alc_gpio2_init_verbs); in alc_auto_init_amp()
433 snd_hda_sequence_write(codec, alc_gpio3_init_verbs); in alc_auto_init_amp()
436 switch (codec->core.vendor_id) { in alc_auto_init_amp()
438 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
444 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
447 alc888_coef_init(codec); in alc_auto_init_amp()
464 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
467 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
474 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
477 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
481 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
485 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
489 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
500 if (!codec->bus->pci) in alc_auto_parse_customize_define()
502 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
503 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
507 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
509 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
512 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
513 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
537 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
539 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
541 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
542 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
543 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
544 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
545 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
546 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
547 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
576 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
580 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
589 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
590 if (codec->bus->pci && in alc_subsystem_id()
591 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
604 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
606 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
607 codec_dbg(codec, in alc_subsystem_id()
624 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
625 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
678 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
680 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
681 struct alc_spec *spec = codec->spec; in alc_ssid_check()
682 codec_dbg(codec, in alc_ssid_check()
691 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
694 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
709 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
711 struct alc_spec *spec = codec->spec; in alc_build_controls()
714 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
719 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in alc_build_controls()
730 kctl = snd_ctl_new1(knew, codec); in alc_build_controls()
734 err = snd_hda_ctl_add(codec, 0, kctl); in alc_build_controls()
741 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
750 static int alc_init(struct hda_codec *codec) in alc_init() argument
752 struct alc_spec *spec = codec->spec; in alc_init()
755 spec->init_hook(codec); in alc_init()
757 alc_fix_pll(codec); in alc_init()
758 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
760 snd_hda_gen_init(codec); in alc_init()
762 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
767 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
769 struct alc_spec *spec = codec->spec; in alc_shutup()
772 spec->shutup(codec); in alc_shutup()
774 snd_hda_shutup_pins(codec); in alc_shutup()
777 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
779 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
782 spec->reboot_notify(codec); in alc_reboot_notify()
784 alc_shutup(codec); in alc_reboot_notify()
788 static void alc_d3_at_reboot(struct hda_codec *codec) in alc_d3_at_reboot() argument
790 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); in alc_d3_at_reboot()
791 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_d3_at_reboot()
799 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
801 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
804 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
806 struct alc_spec *spec = codec->spec; in alc_suspend()
807 alc_shutup(codec); in alc_suspend()
809 spec->power_hook(codec); in alc_suspend()
815 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
817 struct alc_spec *spec = codec->spec; in alc_resume()
821 codec->patch_ops.init(codec); in alc_resume()
822 regcache_sync(codec->core.regmap); in alc_resume()
823 hda_call_check_power_status(codec, 0x01); in alc_resume()
846 static int alc_codec_rename(struct hda_codec *codec, const char *name) in alc_codec_rename() argument
848 kfree(codec->core.chip_name); in alc_codec_rename()
849 codec->core.chip_name = kstrdup(name, GFP_KERNEL); in alc_codec_rename()
850 if (!codec->core.chip_name) { in alc_codec_rename()
851 alc_free(codec); in alc_codec_rename()
922 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
928 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
930 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
931 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
934 if (!codec->bus->pci) in alc_codec_rename_from_preset()
937 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
939 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
942 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
943 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
970 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
972 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
974 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); in has_cdefine_beep()
981 #define has_cdefine_beep(codec) 0 argument
988 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
992 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
996 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1002 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1004 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1012 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1019 codec->spec = spec; in alc_alloc_spec()
1023 codec->single_adc_amp = 1; in alc_alloc_spec()
1025 codec->spdif_status_reset = 1; in alc_alloc_spec()
1027 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1035 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1039 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1074 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1078 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1457 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1462 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1466 spec = codec->spec; in patch_alc880()
1470 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1472 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1475 err = alc880_parse_auto_config(codec); in patch_alc880()
1482 codec->patch_ops = alc_patch_ops; in patch_alc880()
1483 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1486 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1491 alc_free(codec); in patch_alc880()
1499 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1503 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1523 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1525 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1526 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc260_gpio1_automute()
1530 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1533 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1542 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1544 snd_hda_add_verbs(codec, alc_gpio1_init_verbs); in alc260_fixup_gpio1_toggle()
1548 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1551 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1570 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1578 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1581 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1586 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1589 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1705 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1710 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1714 spec = codec->spec; in patch_alc260()
1722 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1724 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1727 err = alc260_parse_auto_config(codec); in patch_alc260()
1734 codec->patch_ops = alc_patch_ops; in patch_alc260()
1737 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1742 alc_free(codec); in patch_alc260()
1797 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1802 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1806 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) in alc882_gpio_mute() argument
1810 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1818 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1822 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1827 snd_hda_codec_write(codec, codec->core.afg, 0, in alc882_gpio_mute()
1829 snd_hda_codec_write(codec, codec->core.afg, 0, in alc882_gpio_mute()
1834 snd_hda_codec_write(codec, codec->core.afg, 0, in alc882_gpio_mute()
1839 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
1844 alc882_gpio_mute(codec, 0, 0); in alc885_fixup_macpro_gpio()
1845 alc882_gpio_mute(codec, 1, 0); in alc885_fixup_macpro_gpio()
1852 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
1859 snd_hda_override_conn_list(codec, 0x14, 2, conn1); in alc889_fixup_dac_route()
1860 snd_hda_override_conn_list(codec, 0x15, 2, conn1); in alc889_fixup_dac_route()
1861 snd_hda_override_conn_list(codec, 0x18, 2, conn2); in alc889_fixup_dac_route()
1862 snd_hda_override_conn_list(codec, 0x1a, 2, conn2); in alc889_fixup_dac_route()
1866 snd_hda_override_conn_list(codec, 0x14, 5, conn); in alc889_fixup_dac_route()
1867 snd_hda_override_conn_list(codec, 0x15, 5, conn); in alc889_fixup_dac_route()
1868 snd_hda_override_conn_list(codec, 0x18, 5, conn); in alc889_fixup_dac_route()
1869 snd_hda_override_conn_list(codec, 0x1a, 5, conn); in alc889_fixup_dac_route()
1874 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
1877 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
1884 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
1887 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
1889 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
1895 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
1898 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
1903 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
1905 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
1911 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
1917 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
1921 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
1927 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
1931 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
1937 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
1944 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
1947 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
1954 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2282 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2286 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2291 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2296 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2300 spec = codec->spec; in patch_alc882()
2302 switch (codec->core.vendor_id) { in patch_alc882()
2309 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2313 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2315 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2317 alc_auto_parse_customize_define(codec); in patch_alc882()
2319 if (has_cdefine_beep(codec)) in patch_alc882()
2323 err = alc882_parse_auto_config(codec); in patch_alc882()
2330 codec->patch_ops = alc_patch_ops; in patch_alc882()
2332 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2337 alc_free(codec); in patch_alc882()
2345 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2349 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2455 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2460 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2464 spec = codec->spec; in patch_alc262()
2471 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2473 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2475 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2477 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2479 alc_auto_parse_customize_define(codec); in patch_alc262()
2481 if (has_cdefine_beep(codec)) in patch_alc262()
2485 err = alc262_parse_auto_config(codec); in patch_alc262()
2492 codec->patch_ops = alc_patch_ops; in patch_alc262()
2495 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2500 alc_free(codec); in patch_alc262()
2577 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2580 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2585 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2591 err = alc_alloc_spec(codec, 0); in patch_alc268()
2595 spec = codec->spec; in patch_alc268()
2598 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2599 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2602 err = alc268_parse_auto_config(codec); in patch_alc268()
2609 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
2610 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
2612 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
2619 codec->patch_ops = alc_patch_ops; in patch_alc268()
2622 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
2627 alc_free(codec); in patch_alc268()
2663 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
2668 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
2694 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
2697 static int find_ext_mic_pin(struct hda_codec *codec);
2699 static void alc286_shutup(struct hda_codec *codec) in alc286_shutup() argument
2702 int mic_pin = find_ext_mic_pin(codec); in alc286_shutup()
2706 if (codec->bus->shutdown) in alc286_shutup()
2708 for (i = 0; i < codec->init_pins.used; i++) { in alc286_shutup()
2709 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); in alc286_shutup()
2712 snd_hda_codec_read(codec, pin->nid, 0, in alc286_shutup()
2715 codec->pins_shutup = 1; in alc286_shutup()
2718 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
2720 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
2723 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
2725 struct alc_spec *spec = codec->spec; in alc269_shutup()
2728 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
2730 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
2733 snd_hda_shutup_pins(codec); in alc269_shutup()
2769 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
2771 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
2774 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
2776 struct alc_spec *spec = codec->spec; in alc282_init()
2781 alc282_restore_default_value(codec); in alc282_init()
2785 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
2786 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
2790 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
2795 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
2801 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
2808 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
2811 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
2813 struct alc_spec *spec = codec->spec; in alc282_shutup()
2819 alc269_shutup(codec); in alc282_shutup()
2823 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
2824 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
2825 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
2830 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
2836 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
2842 alc_auto_setup_eapd(codec, false); in alc282_shutup()
2843 snd_hda_shutup_pins(codec); in alc282_shutup()
2844 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
2884 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
2886 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
2889 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
2891 struct alc_spec *spec = codec->spec; in alc283_init()
2900 alc283_restore_default_value(codec); in alc283_init()
2906 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
2910 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
2912 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
2918 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
2925 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
2927 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
2930 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
2932 struct alc_spec *spec = codec->spec; in alc283_shutup()
2942 alc269_shutup(codec); in alc283_shutup()
2946 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
2948 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
2951 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
2953 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
2959 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
2962 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
2966 alc_auto_setup_eapd(codec, false); in alc283_shutup()
2967 snd_hda_shutup_pins(codec); in alc283_shutup()
2968 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
2971 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
2974 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
2975 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
2976 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
2979 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
2983 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
2984 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
2986 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
2991 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
2995 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
2996 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
2997 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
2998 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
2999 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3000 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3001 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3002 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3003 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3006 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3008 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3009 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3010 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3011 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3012 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3013 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3016 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3020 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3021 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3022 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3023 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3024 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3025 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3026 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3027 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3028 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3029 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3030 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3031 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3032 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3033 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3034 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3036 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3038 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3040 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3042 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3043 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3044 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3045 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3046 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3047 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3048 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3051 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3056 #define alc5505_dsp_suspend(codec) /* NOP */ argument
3057 #define alc5505_dsp_resume(codec) /* NOP */ argument
3059 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3060 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3064 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3066 struct alc_spec *spec = codec->spec; in alc269_suspend()
3069 alc5505_dsp_suspend(codec); in alc269_suspend()
3070 return alc_suspend(codec); in alc269_suspend()
3073 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3075 struct alc_spec *spec = codec->spec; in alc269_resume()
3078 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3080 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3084 codec->patch_ops.init(codec); in alc269_resume()
3087 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3089 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3093 regcache_sync(codec->core.regmap); in alc269_resume()
3094 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3101 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, in alc269_resume()
3105 alc5505_dsp_resume(codec); in alc269_resume()
3111 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3114 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3120 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3124 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3127 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3130 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
3136 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
3146 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
3147 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
3149 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
3151 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
3154 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
3157 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
3169 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
3178 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
3181 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
3183 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
3185 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
3186 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
3189 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
3192 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
3198 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
3201 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
3204 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
3208 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3211 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3215 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
3218 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
3229 struct hda_codec *codec = private_data; in alc269_fixup_mic_mute_hook() local
3230 struct alc_spec *spec = codec->spec; in alc269_fixup_mic_mute_hook()
3235 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); in alc269_fixup_mic_mute_hook()
3239 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); in alc269_fixup_mic_mute_hook()
3243 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
3247 struct alc_spec *spec = codec->spec; in led_power_filter()
3254 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
3255 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
3257 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
3260 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
3263 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
3279 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
3280 codec_dbg(codec, in alc269_fixup_hp_mute_led()
3287 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
3290 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_mic1()
3296 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_mic1()
3300 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
3303 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_mic2()
3309 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_mic2()
3314 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
3317 struct alc_spec *spec = codec->spec; in alc_update_gpio_led()
3328 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_update_gpio_led()
3335 struct hda_codec *codec = private_data; in alc_fixup_gpio_mute_hook() local
3336 struct alc_spec *spec = codec->spec; in alc_fixup_gpio_mute_hook()
3338 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); in alc_fixup_gpio_mute_hook()
3342 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec, in alc_fixup_gpio_mic_mute_hook() argument
3346 struct alc_spec *spec = codec->spec; in alc_fixup_gpio_mic_mute_hook()
3349 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in alc_fixup_gpio_mic_mute_hook()
3354 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
3357 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_led()
3371 snd_hda_add_verbs(codec, gpio_init); in alc269_fixup_hp_gpio_led()
3375 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
3378 struct alc_spec *spec = codec->spec; in alc286_fixup_hp_gpio_led()
3392 snd_hda_add_verbs(codec, gpio_init); in alc286_fixup_hp_gpio_led()
3397 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec, in alc269_fixup_hp_cap_mic_mute_hook() argument
3401 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_cap_mic_mute_hook()
3404 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); in alc269_fixup_hp_cap_mic_mute_hook()
3419 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); in alc269_fixup_hp_cap_mic_mute_hook()
3422 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
3425 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
3439 snd_hda_add_verbs(codec, gpio_init); in alc269_fixup_hp_gpio_mic1_led()
3440 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
3444 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
3448 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
3462 snd_hda_add_verbs(codec, gpio_init); in alc280_fixup_hp_gpio4()
3463 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
3467 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
3470 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
3480 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
3482 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
3486 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
3494 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
3503 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
3517 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
3520 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
3523 snd_hda_add_verbs(codec, gpio_init); in alc280_fixup_hp_gpio2_mic_hotkey()
3524 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
3526 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
3551 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
3562 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
3565 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
3568 snd_hda_add_verbs(codec, gpio_init); in alc233_fixup_lenovo_line2_mic_hotkey()
3569 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
3592 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
3595 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
3604 codec->power_filter = led_power_filter; in alc269_fixup_hp_line1_mic1_led()
3608 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
3665 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
3667 alc_process_coef_fw(codec, coef0255_1); in alc_headset_mode_unplugged()
3668 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
3671 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
3672 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
3676 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
3680 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
3683 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
3686 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
3689 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
3692 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
3696 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
3737 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
3740 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
3741 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3742 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
3743 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3747 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
3748 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3749 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
3750 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3754 alc_update_coef_idx(codec, 0x4f, 0x000c, 0); in alc_headset_mode_mic_in()
3755 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3756 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
3757 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3760 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3761 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
3765 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
3766 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3767 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
3768 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3771 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3772 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3775 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
3776 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3777 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
3778 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3781 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
3784 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
3830 switch (codec->core.vendor_id) { in alc_headset_mode_default()
3832 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
3836 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
3840 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
3844 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
3847 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
3850 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
3853 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
3856 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
3860 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
3905 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
3907 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
3910 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
3914 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
3918 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
3920 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
3923 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
3926 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
3929 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
3932 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
3936 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
3981 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
3983 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
3986 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
3990 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
3994 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
3996 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
3999 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
4002 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
4005 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
4008 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
4011 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
4015 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
4039 switch (codec->core.vendor_id) { in alc_determine_headset_type()
4042 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
4044 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4049 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
4051 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4056 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
4058 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4062 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
4064 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
4068 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
4070 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4074 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
4076 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
4081 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
4086 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
4088 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
4095 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
4105 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
4111 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
4116 alc_determine_headset_type(codec); in alc_update_headset_mode()
4118 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
4120 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
4124 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
4128 alc_headset_mode_default(codec); in alc_update_headset_mode()
4133 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
4136 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
4141 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
4144 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
4148 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
4151 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
4154 struct alc_spec *spec = codec->spec; in alc_update_headset_jack_cb()
4156 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
4159 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
4162 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
4178 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
4181 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
4188 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
4192 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
4197 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
4201 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
4205 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
4208 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
4227 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
4229 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
4232 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
4238 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
4242 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
4244 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
4247 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
4251 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
4253 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
4256 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
4259 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
4262 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
4265 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
4268 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc288_update_headset_jack_cb()
4272 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
4275 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
4277 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
4282 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
4286 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
4291 static void alc_no_shutup(struct hda_codec *codec) in alc_no_shutup() argument
4295 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
4299 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
4304 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
4308 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
4315 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
4323 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
4329 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
4330 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
4334 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
4336 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
4340 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
4345 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
4348 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
4357 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
4373 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
4376 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
4384 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
4385 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
4387 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
4390 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
4394 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
4395 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
4396 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
4398 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
4402 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
4404 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
4414 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
4423 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
4427 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
4430 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
4435 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
4439 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
4443 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
4459 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
4463 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
4471 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
4474 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
4478 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
4483 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
4487 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
4490 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
4494 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
4501 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
4503 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
4508 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
4511 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
4520 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
4526 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
4528 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
4529 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
4530 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
4534 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
4537 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
4553 snd_hda_add_verbs(codec, gpio2_verbs); in alc282_fixup_asus_tx300()
4554 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
4557 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
4564 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch"); in alc282_fixup_asus_tx300()
4567 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch"); in alc282_fixup_asus_tx300()
4574 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
4582 snd_hda_override_conn_list(codec, 0x14, 1, conn1); in alc290_fixup_mono_speakers()
4583 snd_hda_override_conn_list(codec, 0x15, 1, conn1); in alc290_fixup_mono_speakers()
5963 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
5965 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
5971 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
5972 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
5973 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
5976 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
5977 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
5978 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
5981 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
5983 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
5986 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
5987 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
5990 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
5992 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
5995 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
6000 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
6005 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
6010 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
6014 spec = codec->spec; in patch_alc269()
6016 codec->power_save_node = 1; in patch_alc269()
6018 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
6020 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups); in patch_alc269()
6021 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
6023 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
6025 alc_auto_parse_customize_define(codec); in patch_alc269()
6027 if (has_cdefine_beep(codec)) in patch_alc269()
6030 switch (codec->core.vendor_id) { in patch_alc269()
6033 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
6035 if (codec->bus->pci && in patch_alc269()
6036 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
6038 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
6042 if (codec->bus->pci && in patch_alc269()
6043 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
6044 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
6045 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
6052 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
6057 alc269_fill_coef(codec); in patch_alc269()
6097 alc_update_coef_idx(codec, 0x36, 1 << 13, 1 << 5); /* Switch pcbeep path to Line in path*/ in patch_alc269()
6101 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
6107 err = alc269_parse_auto_config(codec); in patch_alc269()
6114 codec->patch_ops = alc_patch_ops; in patch_alc269()
6115 codec->patch_ops.stream_pm = snd_hda_gen_stream_pm; in patch_alc269()
6117 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
6118 codec->patch_ops.resume = alc269_resume; in patch_alc269()
6123 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
6128 alc_free(codec); in patch_alc269()
6136 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
6140 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
6153 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
6156 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
6161 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
6165 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
6170 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
6174 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
6226 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
6231 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
6235 spec = codec->spec; in patch_alc861()
6238 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
6239 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
6242 err = alc861_parse_auto_config(codec); in patch_alc861()
6249 codec->patch_ops = alc_patch_ops; in patch_alc861()
6254 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
6259 alc_free(codec); in patch_alc861()
6270 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
6274 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
6283 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
6287 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
6288 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
6318 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
6323 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
6327 spec = codec->spec; in patch_alc861vd()
6330 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
6331 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
6334 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
6341 codec->patch_ops = alc_patch_ops; in patch_alc861vd()
6345 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
6350 alc_free(codec); in patch_alc861vd()
6370 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
6377 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
6378 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
6379 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
6383 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
6386 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
6391 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
6396 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
6409 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
6413 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
6419 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
6423 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
6424 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led) in gpio_led_power_filter()
6429 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
6432 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
6444 snd_hda_add_verbs(codec, gpio_init); in alc662_fixup_led_gpio1()
6445 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
6473 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
6475 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
6958 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
6963 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
6967 spec = codec->spec; in patch_alc662()
6972 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
6974 switch (codec->core.vendor_id) { in patch_alc662()
6980 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
6982 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups); in patch_alc662()
6983 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
6985 alc_auto_parse_customize_define(codec); in patch_alc662()
6987 if (has_cdefine_beep(codec)) in patch_alc662()
6990 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
6991 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
6993 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
6999 err = alc662_parse_auto_config(codec); in patch_alc662()
7004 switch (codec->core.vendor_id) { in patch_alc662()
7020 codec->patch_ops = alc_patch_ops; in patch_alc662()
7023 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
7028 alc_free(codec); in patch_alc662()
7036 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
7038 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
7043 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
7048 err = alc_alloc_spec(codec, 0); in patch_alc680()
7053 err = alc680_parse_auto_config(codec); in patch_alc680()
7055 alc_free(codec); in patch_alc680()
7059 codec->patch_ops = alc_patch_ops; in patch_alc680()