Lines Matching refs:codec
113 void (*init_hook)(struct hda_codec *codec);
115 void (*power_hook)(struct hda_codec *codec);
117 void (*shutup)(struct hda_codec *codec);
118 void (*reboot_notify)(struct hda_codec *codec);
137 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
142 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_read_coefex_idx()
143 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in alc_read_coefex_idx()
147 #define alc_read_coef_idx(codec, coef_idx) \ argument
148 alc_read_coefex_idx(codec, 0x20, coef_idx)
150 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
153 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in alc_write_coefex_idx()
154 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in alc_write_coefex_idx()
157 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
158 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
160 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
164 unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx); in alc_update_coefex_idx()
167 alc_write_coefex_idx(codec, nid, coef_idx, in alc_update_coefex_idx()
171 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
172 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
175 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
177 struct alc_spec *spec = codec->spec; in alc_get_coef0()
180 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
198 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
203 alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
205 alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
252 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
254 struct alc_spec *spec = codec->spec; in alc_fix_pll()
257 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
261 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
264 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
268 alc_fix_pll(codec); in alc_fix_pll_init()
272 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
279 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
285 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
294 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
298 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
302 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
306 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
308 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
310 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
314 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
318 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
320 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
322 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
328 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
340 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
344 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
352 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
356 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
365 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
368 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
371 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
375 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
378 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
382 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
388 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
390 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
395 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
401 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
403 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
405 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
406 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
411 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
419 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
425 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
427 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
429 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
432 snd_hda_shutup_pins(codec); in alc_eapd_shutup()
436 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
438 alc_fill_eapd_coef(codec); in alc_auto_init_amp()
439 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
442 snd_hda_sequence_write(codec, alc_gpio1_init_verbs); in alc_auto_init_amp()
445 snd_hda_sequence_write(codec, alc_gpio2_init_verbs); in alc_auto_init_amp()
448 snd_hda_sequence_write(codec, alc_gpio3_init_verbs); in alc_auto_init_amp()
451 switch (codec->core.vendor_id) { in alc_auto_init_amp()
453 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
459 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
462 alc888_coef_init(codec); in alc_auto_init_amp()
479 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
482 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
489 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
492 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
496 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
500 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
504 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
515 if (!codec->bus->pci) in alc_auto_parse_customize_define()
517 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
518 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
522 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
524 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
527 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
528 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
552 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
554 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
556 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
557 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
558 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
559 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
560 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
561 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
562 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
591 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
595 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
604 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
605 if (codec->bus->pci && in alc_subsystem_id()
606 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
619 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
621 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
622 codec_dbg(codec, in alc_subsystem_id()
639 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
640 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
693 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
695 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
696 struct alc_spec *spec = codec->spec; in alc_ssid_check()
697 codec_dbg(codec, in alc_ssid_check()
706 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
709 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
724 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
726 struct alc_spec *spec = codec->spec; in alc_build_controls()
729 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
734 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); in alc_build_controls()
745 kctl = snd_ctl_new1(knew, codec); in alc_build_controls()
749 err = snd_hda_ctl_add(codec, 0, kctl); in alc_build_controls()
756 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
765 static int alc_init(struct hda_codec *codec) in alc_init() argument
767 struct alc_spec *spec = codec->spec; in alc_init()
770 spec->init_hook(codec); in alc_init()
772 alc_fix_pll(codec); in alc_init()
773 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
775 snd_hda_gen_init(codec); in alc_init()
777 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
782 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
784 struct alc_spec *spec = codec->spec; in alc_shutup()
787 spec->shutup(codec); in alc_shutup()
789 snd_hda_shutup_pins(codec); in alc_shutup()
792 static void alc_reboot_notify(struct hda_codec *codec) in alc_reboot_notify() argument
794 struct alc_spec *spec = codec->spec; in alc_reboot_notify()
797 spec->reboot_notify(codec); in alc_reboot_notify()
799 alc_shutup(codec); in alc_reboot_notify()
803 static void alc_d3_at_reboot(struct hda_codec *codec) in alc_d3_at_reboot() argument
805 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); in alc_d3_at_reboot()
806 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_d3_at_reboot()
814 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
816 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
819 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
821 struct alc_spec *spec = codec->spec; in alc_suspend()
822 alc_shutup(codec); in alc_suspend()
824 spec->power_hook(codec); in alc_suspend()
830 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
832 struct alc_spec *spec = codec->spec; in alc_resume()
836 codec->patch_ops.init(codec); in alc_resume()
837 regcache_sync(codec->core.regmap); in alc_resume()
838 hda_call_check_power_status(codec, 0x01); in alc_resume()
860 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
929 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
935 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
937 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
938 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
941 if (!codec->bus->pci) in alc_codec_rename_from_preset()
944 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
946 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
949 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
950 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
977 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
979 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
981 q = snd_pci_quirk_lookup(codec->bus->pci, beep_white_list); in has_cdefine_beep()
988 #define has_cdefine_beep(codec) 0 argument
995 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
999 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1003 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1009 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1011 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1019 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1026 codec->spec = spec; in alc_alloc_spec()
1030 codec->single_adc_amp = 1; in alc_alloc_spec()
1032 codec->spdif_status_reset = 1; in alc_alloc_spec()
1033 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1035 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1043 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1047 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1082 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1086 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1465 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1470 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1474 spec = codec->spec; in patch_alc880()
1478 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1480 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1482 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1485 err = alc880_parse_auto_config(codec); in patch_alc880()
1492 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1497 alc_free(codec); in patch_alc880()
1505 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1509 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1529 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1531 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1532 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc260_gpio1_automute()
1536 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1539 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1548 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1550 snd_hda_add_verbs(codec, alc_gpio1_init_verbs); in alc260_fixup_gpio1_toggle()
1554 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1557 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1576 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1584 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1587 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1592 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1595 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1711 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1716 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1720 spec = codec->spec; in patch_alc260()
1730 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1732 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1735 err = alc260_parse_auto_config(codec); in patch_alc260()
1742 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1747 alc_free(codec); in patch_alc260()
1802 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
1807 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
1811 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) in alc882_gpio_mute() argument
1815 gpiostate = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1823 gpiomask = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1827 gpiodir = snd_hda_codec_read(codec, codec->core.afg, 0, in alc882_gpio_mute()
1832 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 snd_hda_codec_write(codec, codec->core.afg, 0, in alc882_gpio_mute()
1844 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
1849 alc882_gpio_mute(codec, 0, 0); in alc885_fixup_macpro_gpio()
1850 alc882_gpio_mute(codec, 1, 0); in alc885_fixup_macpro_gpio()
1857 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
1864 snd_hda_override_conn_list(codec, 0x14, 2, conn1); in alc889_fixup_dac_route()
1865 snd_hda_override_conn_list(codec, 0x15, 2, conn1); in alc889_fixup_dac_route()
1866 snd_hda_override_conn_list(codec, 0x18, 2, conn2); in alc889_fixup_dac_route()
1867 snd_hda_override_conn_list(codec, 0x1a, 2, conn2); in alc889_fixup_dac_route()
1871 snd_hda_override_conn_list(codec, 0x14, 5, conn); in alc889_fixup_dac_route()
1872 snd_hda_override_conn_list(codec, 0x15, 5, conn); in alc889_fixup_dac_route()
1873 snd_hda_override_conn_list(codec, 0x18, 5, conn); in alc889_fixup_dac_route()
1874 snd_hda_override_conn_list(codec, 0x1a, 5, conn); in alc889_fixup_dac_route()
1879 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
1882 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
1889 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
1892 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
1894 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
1900 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
1903 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
1908 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
1910 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
1916 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
1922 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
1926 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
1932 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
1936 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
1942 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
1949 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
1952 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
1959 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2287 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2291 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2296 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2301 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2305 spec = codec->spec; in patch_alc882()
2307 switch (codec->core.vendor_id) { in patch_alc882()
2314 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2318 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2320 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2322 alc_auto_parse_customize_define(codec); in patch_alc882()
2324 if (has_cdefine_beep(codec)) in patch_alc882()
2328 err = alc882_parse_auto_config(codec); in patch_alc882()
2335 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2340 alc_free(codec); in patch_alc882()
2348 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2352 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2458 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2463 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2467 spec = codec->spec; in patch_alc262()
2476 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2478 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2480 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2482 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2484 alc_auto_parse_customize_define(codec); in patch_alc262()
2486 if (has_cdefine_beep(codec)) in patch_alc262()
2490 err = alc262_parse_auto_config(codec); in patch_alc262()
2497 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2502 alc_free(codec); in patch_alc262()
2579 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
2582 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
2587 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
2593 err = alc_alloc_spec(codec, 0); in patch_alc268()
2597 spec = codec->spec; in patch_alc268()
2602 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
2603 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
2606 err = alc268_parse_auto_config(codec); in patch_alc268()
2613 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
2614 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
2616 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
2623 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
2628 alc_free(codec); in patch_alc268()
2667 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
2672 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
2701 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
2704 static int find_ext_mic_pin(struct hda_codec *codec);
2706 static void alc286_shutup(struct hda_codec *codec) in alc286_shutup() argument
2709 int mic_pin = find_ext_mic_pin(codec); in alc286_shutup()
2713 if (codec->bus->shutdown) in alc286_shutup()
2715 for (i = 0; i < codec->init_pins.used; i++) { in alc286_shutup()
2716 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); in alc286_shutup()
2719 snd_hda_codec_read(codec, pin->nid, 0, in alc286_shutup()
2722 codec->pins_shutup = 1; in alc286_shutup()
2725 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
2727 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
2730 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
2732 struct alc_spec *spec = codec->spec; in alc269_shutup()
2735 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
2737 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
2740 snd_hda_shutup_pins(codec); in alc269_shutup()
2776 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
2778 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
2781 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
2783 struct alc_spec *spec = codec->spec; in alc282_init()
2788 alc282_restore_default_value(codec); in alc282_init()
2792 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
2793 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
2797 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
2802 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
2808 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
2815 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
2818 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
2820 struct alc_spec *spec = codec->spec; in alc282_shutup()
2826 alc269_shutup(codec); in alc282_shutup()
2830 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
2831 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
2832 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
2837 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
2843 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
2849 alc_auto_setup_eapd(codec, false); in alc282_shutup()
2850 snd_hda_shutup_pins(codec); in alc282_shutup()
2851 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
2891 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
2893 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
2896 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
2898 struct alc_spec *spec = codec->spec; in alc283_init()
2907 alc283_restore_default_value(codec); in alc283_init()
2913 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
2917 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
2919 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
2925 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
2932 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
2934 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
2937 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
2939 struct alc_spec *spec = codec->spec; in alc283_shutup()
2949 alc269_shutup(codec); in alc283_shutup()
2953 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
2955 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
2958 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
2960 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
2966 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
2969 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
2973 alc_auto_setup_eapd(codec, false); in alc283_shutup()
2974 snd_hda_shutup_pins(codec); in alc283_shutup()
2975 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
2978 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
2981 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
2982 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
2983 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
2986 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
2990 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
2991 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
2993 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
2998 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
3002 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
3003 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
3004 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
3005 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
3006 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
3007 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
3008 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
3009 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
3010 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
3013 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
3015 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
3016 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
3017 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
3018 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
3019 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
3020 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
3023 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
3027 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3028 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
3029 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
3030 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
3031 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
3032 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
3033 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
3034 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
3035 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
3036 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
3037 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
3038 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
3039 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
3040 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
3041 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
3043 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
3045 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
3047 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
3049 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
3050 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
3051 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
3052 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
3053 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
3054 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
3055 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
3058 alc5505_dsp_halt(codec); in alc5505_dsp_init()
3063 #define alc5505_dsp_suspend(codec) /* NOP */ argument
3064 #define alc5505_dsp_resume(codec) /* NOP */ argument
3066 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
3067 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
3071 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
3073 struct alc_spec *spec = codec->spec; in alc269_suspend()
3076 alc5505_dsp_suspend(codec); in alc269_suspend()
3077 return alc_suspend(codec); in alc269_suspend()
3080 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
3082 struct alc_spec *spec = codec->spec; in alc269_resume()
3085 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
3087 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
3091 codec->patch_ops.init(codec); in alc269_resume()
3094 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
3096 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
3100 regcache_sync(codec->core.regmap); in alc269_resume()
3101 hda_call_check_power_status(codec, 0x01); in alc269_resume()
3108 snd_hda_codec_write(codec, codec->core.afg, 0, AC_VERB_SET_GPIO_DATA, in alc269_resume()
3112 alc5505_dsp_resume(codec); in alc269_resume()
3118 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
3121 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
3127 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
3131 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
3134 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
3137 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
3143 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
3153 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
3154 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
3156 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
3158 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
3161 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
3164 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
3176 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
3185 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
3188 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
3190 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
3192 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
3193 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
3196 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
3199 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
3205 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
3208 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
3211 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
3215 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3218 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
3222 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
3225 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
3236 struct hda_codec *codec = private_data; in alc269_fixup_mic_mute_hook() local
3237 struct alc_spec *spec = codec->spec; in alc269_fixup_mic_mute_hook()
3242 pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); in alc269_fixup_mic_mute_hook()
3246 snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); in alc269_fixup_mic_mute_hook()
3250 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
3254 struct alc_spec *spec = codec->spec; in led_power_filter()
3261 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
3262 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
3264 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
3267 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
3270 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
3286 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
3287 codec_dbg(codec, in alc269_fixup_hp_mute_led()
3294 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
3297 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_mic1()
3303 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_mic1()
3307 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
3310 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_mic2()
3316 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_mic2()
3321 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
3324 struct alc_spec *spec = codec->spec; in alc_update_gpio_led()
3335 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_update_gpio_led()
3342 struct hda_codec *codec = private_data; in alc_fixup_gpio_mute_hook() local
3343 struct alc_spec *spec = codec->spec; in alc_fixup_gpio_mute_hook()
3345 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, enabled); in alc_fixup_gpio_mute_hook()
3349 static void alc_fixup_gpio_mic_mute_hook(struct hda_codec *codec, in alc_fixup_gpio_mic_mute_hook() argument
3353 struct alc_spec *spec = codec->spec; in alc_fixup_gpio_mic_mute_hook()
3356 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in alc_fixup_gpio_mic_mute_hook()
3361 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
3364 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_led()
3378 snd_hda_add_verbs(codec, gpio_init); in alc269_fixup_hp_gpio_led()
3382 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
3385 struct alc_spec *spec = codec->spec; in alc286_fixup_hp_gpio_led()
3399 snd_hda_add_verbs(codec, gpio_init); in alc286_fixup_hp_gpio_led()
3404 static void alc269_fixup_hp_cap_mic_mute_hook(struct hda_codec *codec, in alc269_fixup_hp_cap_mic_mute_hook() argument
3408 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_cap_mic_mute_hook()
3411 pinval = snd_hda_codec_get_pin_target(codec, spec->cap_mute_led_nid); in alc269_fixup_hp_cap_mic_mute_hook()
3426 snd_hda_set_pin_ctl_cache(codec, spec->cap_mute_led_nid, pinval); in alc269_fixup_hp_cap_mic_mute_hook()
3429 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
3432 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
3446 snd_hda_add_verbs(codec, gpio_init); in alc269_fixup_hp_gpio_mic1_led()
3447 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
3451 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
3455 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
3469 snd_hda_add_verbs(codec, gpio_init); in alc280_fixup_hp_gpio4()
3470 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
3474 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
3477 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
3487 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
3489 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
3494 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
3509 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
3518 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
3532 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
3535 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
3538 snd_hda_add_verbs(codec, gpio_init); in alc280_fixup_hp_gpio2_mic_hotkey()
3539 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
3541 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
3566 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
3577 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
3580 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
3583 snd_hda_add_verbs(codec, gpio_init); in alc233_fixup_lenovo_line2_mic_hotkey()
3584 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
3607 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
3610 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
3619 codec->power_filter = led_power_filter; in alc269_fixup_hp_line1_mic1_led()
3623 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
3690 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
3692 alc_process_coef_fw(codec, coef0255_1); in alc_headset_mode_unplugged()
3693 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
3696 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
3697 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
3701 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
3706 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
3709 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
3712 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
3715 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
3719 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
3722 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
3726 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
3774 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
3777 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
3778 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3779 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
3780 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3784 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
3785 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3786 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
3787 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3792 alc_update_coef_idx(codec, 0x4f, 0x000c, 0); in alc_headset_mode_mic_in()
3793 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3794 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
3795 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3798 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3799 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
3803 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
3804 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3805 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
3806 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3809 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3810 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3813 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
3814 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3815 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
3816 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3820 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
3821 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
3822 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
3823 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
3826 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
3829 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
3875 switch (codec->core.vendor_id) { in alc_headset_mode_default()
3878 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
3882 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
3886 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
3891 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
3894 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
3897 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
3900 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
3903 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
3907 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
3959 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
3961 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
3964 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
3968 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
3971 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);/* Headset output enable */ in alc_headset_mode_ctia()
3975 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
3977 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
3980 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
3983 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
3986 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
3990 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_ctia()
3993 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
3997 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
4049 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
4051 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
4054 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
4058 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
4061 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
4065 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
4067 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
4070 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
4073 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
4076 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
4080 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
4083 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
4086 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
4090 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
4119 switch (codec->core.vendor_id) { in alc_determine_headset_type()
4122 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
4124 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4129 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
4131 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4135 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); /* Headset output enable */ in alc_determine_headset_type()
4139 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
4141 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
4145 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
4147 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
4151 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
4153 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4157 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
4159 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
4164 alc_process_coef_fw(codec, coef0225); in alc_determine_headset_type()
4166 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
4171 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
4176 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
4178 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
4185 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
4195 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
4201 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
4206 alc_determine_headset_type(codec); in alc_update_headset_mode()
4208 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
4210 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
4214 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
4218 alc_headset_mode_default(codec); in alc_update_headset_mode()
4223 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
4226 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
4231 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
4234 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
4238 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
4241 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
4244 struct alc_spec *spec = codec->spec; in alc_update_headset_jack_cb()
4246 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
4249 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
4252 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
4268 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
4271 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
4278 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
4282 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
4287 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
4291 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
4295 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
4298 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
4317 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
4319 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
4322 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
4328 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
4332 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
4334 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
4337 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
4341 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
4343 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
4346 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
4349 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
4352 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
4355 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
4358 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc288_update_headset_jack_cb()
4362 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
4365 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
4367 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
4372 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
4376 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
4381 static void alc_no_shutup(struct hda_codec *codec) in alc_no_shutup() argument
4385 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
4389 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
4394 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
4398 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
4405 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
4413 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
4419 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
4420 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
4424 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
4426 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
4430 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
4435 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
4438 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
4447 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
4463 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
4466 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
4474 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
4475 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
4477 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
4480 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
4484 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
4485 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
4486 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
4488 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
4492 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
4494 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
4504 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
4513 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
4517 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
4520 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
4525 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
4529 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
4533 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
4549 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
4553 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
4561 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
4564 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
4568 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
4573 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
4577 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
4580 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
4584 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
4591 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
4593 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
4598 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
4601 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
4610 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
4616 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
4618 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
4619 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
4620 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
4624 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
4627 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
4643 snd_hda_add_verbs(codec, gpio2_verbs); in alc282_fixup_asus_tx300()
4644 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
4647 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
4654 kctl = snd_hda_find_mixer_ctl(codec, "Speaker Playback Switch"); in alc282_fixup_asus_tx300()
4657 kctl = snd_hda_find_mixer_ctl(codec, "Bass Speaker Playback Switch"); in alc282_fixup_asus_tx300()
4664 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
4672 snd_hda_override_conn_list(codec, 0x14, 1, conn1); in alc290_fixup_mono_speakers()
4673 snd_hda_override_conn_list(codec, 0x15, 1, conn1); in alc290_fixup_mono_speakers()
4678 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
4681 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
4683 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
4685 alc_update_gpio_led(codec, 0x10, !spec->gen.hp_jack_present); in alc280_hp_gpio4_automute_hook()
4694 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
4698 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
4722 snd_hda_add_verbs(codec, gpio_init); in alc280_fixup_hp_9480m()
5957 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
5959 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
5965 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
5966 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
5967 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
5970 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
5971 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
5972 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
5975 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
5977 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
5980 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
5981 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
5984 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
5986 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
5989 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
5994 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
5999 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
6004 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
6008 spec = codec->spec; in patch_alc269()
6010 codec->power_save_node = 1; in patch_alc269()
6013 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
6014 codec->patch_ops.resume = alc269_resume; 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()
6113 alc_update_coef_idx(codec, 0x4a, 0, 1 << 15); /* Combo jack auto trigger control */ in patch_alc269()
6118 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
6124 err = alc269_parse_auto_config(codec); in patch_alc269()
6131 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
6136 alc_free(codec); in patch_alc269()
6144 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
6148 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
6161 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
6164 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
6169 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
6173 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
6178 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
6182 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
6234 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
6239 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
6243 spec = codec->spec; in patch_alc861()
6250 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
6251 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
6254 err = alc861_parse_auto_config(codec); in patch_alc861()
6261 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
6266 alc_free(codec); in patch_alc861()
6277 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
6281 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
6290 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
6294 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
6295 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
6325 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
6330 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
6334 spec = codec->spec; in patch_alc861vd()
6339 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
6340 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
6343 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
6350 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
6355 alc_free(codec); in patch_alc861vd()
6375 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
6382 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
6383 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
6384 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
6388 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
6391 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
6396 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
6401 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
6414 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
6418 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
6424 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
6428 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
6429 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_led) in gpio_led_power_filter()
6434 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
6437 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
6449 snd_hda_add_verbs(codec, gpio_init); in alc662_fixup_led_gpio1()
6450 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
6478 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
6480 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
6919 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
6924 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
6928 spec = codec->spec; in patch_alc662()
6935 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
6937 switch (codec->core.vendor_id) { in patch_alc662()
6943 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
6945 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups); in patch_alc662()
6946 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
6948 alc_auto_parse_customize_define(codec); in patch_alc662()
6950 if (has_cdefine_beep(codec)) in patch_alc662()
6953 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
6954 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
6956 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
6962 err = alc662_parse_auto_config(codec); in patch_alc662()
6967 switch (codec->core.vendor_id) { in patch_alc662()
6983 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
6988 alc_free(codec); in patch_alc662()
6996 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
6998 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
7003 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
7008 err = alc_alloc_spec(codec, 0); in patch_alc680()
7013 err = alc680_parse_auto_config(codec); in patch_alc680()
7015 alc_free(codec); in patch_alc680()