Lines Matching defs:codec
81 /* codec parameterization */
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);
139 static void coef_mutex_lock(struct hda_codec *codec)
141 struct alc_spec *spec = codec->spec;
143 snd_hda_power_up_pm(codec);
147 static void coef_mutex_unlock(struct hda_codec *codec)
149 struct alc_spec *spec = codec->spec;
152 snd_hda_power_down_pm(codec);
155 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
160 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
161 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);
165 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
170 coef_mutex_lock(codec);
171 val = __alc_read_coefex_idx(codec, nid, coef_idx);
172 coef_mutex_unlock(codec);
176 #define alc_read_coef_idx(codec, coef_idx) \
177 alc_read_coefex_idx(codec, 0x20, coef_idx)
179 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
182 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
183 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
186 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
189 coef_mutex_lock(codec);
190 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
191 coef_mutex_unlock(codec);
194 #define alc_write_coef_idx(codec, coef_idx, coef_val) \
195 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
197 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
201 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
204 __alc_write_coefex_idx(codec, nid, coef_idx,
208 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
212 coef_mutex_lock(codec);
213 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
214 coef_mutex_unlock(codec);
217 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
218 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
221 static unsigned int alc_get_coef0(struct hda_codec *codec)
223 struct alc_spec *spec = codec->spec;
226 spec->coef0 = alc_read_coef_idx(codec, 0);
244 static void alc_process_coef_fw(struct hda_codec *codec,
247 coef_mutex_lock(codec);
250 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
252 __alc_update_coefex_idx(codec, fw->nid, fw->idx,
255 coef_mutex_unlock(codec);
263 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask)
265 struct alc_spec *spec = codec->spec;
272 static void alc_write_gpio_data(struct hda_codec *codec)
274 struct alc_spec *spec = codec->spec;
276 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
280 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask,
283 struct alc_spec *spec = codec->spec;
291 alc_write_gpio_data(codec);
294 static void alc_write_gpio(struct hda_codec *codec)
296 struct alc_spec *spec = codec->spec;
301 snd_hda_codec_write(codec, codec->core.afg, 0,
303 snd_hda_codec_write(codec, codec->core.afg, 0,
307 alc_write_gpio_data(codec);
310 static void alc_fixup_gpio(struct hda_codec *codec, int action,
314 alc_setup_gpio(codec, mask);
317 static void alc_fixup_gpio1(struct hda_codec *codec,
320 alc_fixup_gpio(codec, action, 0x01);
323 static void alc_fixup_gpio2(struct hda_codec *codec,
326 alc_fixup_gpio(codec, action, 0x02);
329 static void alc_fixup_gpio3(struct hda_codec *codec,
332 alc_fixup_gpio(codec, action, 0x03);
335 static void alc_fixup_gpio4(struct hda_codec *codec,
338 alc_fixup_gpio(codec, action, 0x04);
341 static void alc_fixup_micmute_led(struct hda_codec *codec,
345 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
348 int has_loongson_workaround(struct hda_codec *codec)
350 struct azx *chip = bus_to_azx(&codec->bus->core);
360 static void alc_fix_pll(struct hda_codec *codec)
362 struct alc_spec *spec = codec->spec;
365 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx,
369 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
372 struct alc_spec *spec = codec->spec;
376 alc_fix_pll(codec);
380 static void alc_update_knob_master(struct hda_codec *codec,
387 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume");
393 val = snd_hda_codec_read(codec, jack->nid, 0,
402 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res)
406 snd_hda_jack_unsol_event(codec, res >> 2);
410 static void alc_fill_eapd_coef(struct hda_codec *codec)
414 coef = alc_get_coef0(codec);
416 switch (codec->core.vendor_id) {
418 alc_update_coef_idx(codec, 0x7, 0, 1<<5);
422 alc_update_coef_idx(codec, 0x7, 0, 1<<13);
426 alc_update_coef_idx(codec, 0xd, 0, 1<<14);
428 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
430 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
436 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
441 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
461 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
464 alc_update_coef_idx(codec, 0xe, 0, 1<<0);
467 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
468 alc_write_coef_idx(codec, 0x8, 0x4ab7);
471 alc_update_coef_idx(codec, 0xa, 1<<13, 0);
480 alc_update_coef_idx(codec, 0x10, 1<<15, 0);
484 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */
493 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */
497 alc_update_coef_idx(codec, 0x19, 1<<13, 0);
500 alc_update_coef_idx(codec, 0x7, 3<<13, 0);
503 alc_update_coef_idx(codec, 0x4, 1<<10, 0);
507 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
511 alc_update_coef_idx(codec, 0x7, 1<<5, 0);
518 alc_update_coef_idx(codec, 0x7, 1<<1, 0);
524 static void alc888_coef_init(struct hda_codec *codec)
526 switch (alc_get_coef0(codec) & 0x00f0) {
531 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */
537 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
539 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
541 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
542 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
546 /* turn on/off EAPD controls of the codec */
547 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on)
555 set_eapd(codec, *p, on);
558 static int find_ext_mic_pin(struct hda_codec *codec);
560 static void alc_headset_mic_no_shutup(struct hda_codec *codec)
563 int mic_pin = find_ext_mic_pin(codec);
569 if (codec->bus->shutdown)
572 snd_array_for_each(&codec->init_pins, i, pin) {
575 snd_hda_codec_read(codec, pin->nid, 0,
579 codec->pins_shutup = 1;
582 static void alc_shutup_pins(struct hda_codec *codec)
584 struct alc_spec *spec = codec->spec;
586 switch (codec->core.vendor_id) {
594 alc_headset_mic_no_shutup(codec);
598 snd_hda_shutup_pins(codec);
606 static void alc_eapd_shutup(struct hda_codec *codec)
608 struct alc_spec *spec = codec->spec;
610 alc_auto_setup_eapd(codec, false);
613 alc_shutup_pins(codec);
617 static void alc_auto_init_amp(struct hda_codec *codec, int type)
619 alc_auto_setup_eapd(codec, true);
620 alc_write_gpio(codec);
623 switch (codec->core.vendor_id) {
625 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010);
631 alc_update_coef_idx(codec, 7, 0, 0x2030);
634 alc888_coef_init(codec);
660 static void alc_fixup_sku_ignore(struct hda_codec *codec,
663 struct alc_spec *spec = codec->spec;
670 static void alc_fixup_no_depop_delay(struct hda_codec *codec,
673 struct alc_spec *spec = codec->spec;
677 codec->depop_delay = 0;
681 static int alc_auto_parse_customize_define(struct hda_codec *codec)
685 struct alc_spec *spec = codec->spec;
696 if (!codec->bus->pci && !has_loongson_workaround(codec))
698 ass = codec->core.subsystem_id & 0xffff;
699 if (codec->bus->pci && ass != codec->bus->pci->subsystem_device && (ass & 1))
703 if (codec->core.vendor_id == 0x10ec0260)
705 ass = snd_hda_codec_get_pincfg(codec, nid);
708 codec_info(codec, "%s: SKU not ready 0x%08x\n",
709 codec->core.chip_name, ass);
733 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n",
735 codec_dbg(codec, "SKU: port_connectivity=0x%x\n",
737 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep);
738 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum);
739 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization);
740 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp);
741 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type);
742 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap);
743 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override);
766 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
772 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports)
776 struct alc_spec *spec = codec->spec;
785 ass = codec->core.subsystem_id & 0xffff;
786 if (codec->bus->pci &&
787 ass != codec->bus->pci->subsystem_device && (ass & 1))
800 if (codec->core.vendor_id == 0x10ec0260)
802 ass = snd_hda_codec_get_pincfg(codec, nid);
803 codec_dbg(codec,
820 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n",
821 ass & 0xffff, codec->core.vendor_id);
833 alc_setup_gpio(codec, 0x01);
836 alc_setup_gpio(codec, 0x02);
839 alc_setup_gpio(codec, 0x04);
874 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports)
876 if (!alc_subsystem_id(codec, ports)) {
877 struct alc_spec *spec = codec->spec;
879 codec_dbg(codec,
889 static void alc_fixup_inv_dmic(struct hda_codec *codec,
892 struct alc_spec *spec = codec->spec;
898 static int alc_build_controls(struct hda_codec *codec)
902 err = snd_hda_gen_build_controls(codec);
906 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD);
915 static void alc_pre_init(struct hda_codec *codec)
917 alc_fill_eapd_coef(codec);
920 #define is_s3_resume(codec) \
921 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
922 #define is_s4_resume(codec) \
923 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
925 static int alc_init(struct hda_codec *codec)
927 struct alc_spec *spec = codec->spec;
930 if (is_s4_resume(codec))
931 alc_pre_init(codec);
934 spec->init_hook(codec);
937 snd_hda_gen_init(codec);
938 alc_fix_pll(codec);
939 alc_auto_init_amp(codec, spec->init_amp);
940 snd_hda_apply_verbs(codec); /* apply verbs here after own init */
942 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
947 static inline void alc_shutup(struct hda_codec *codec)
949 struct alc_spec *spec = codec->spec;
951 if (!snd_hda_get_bool_hint(codec, "shutup"))
955 spec->shutup(codec);
957 alc_shutup_pins(codec);
960 static void alc_reboot_notify(struct hda_codec *codec)
962 struct alc_spec *spec = codec->spec;
965 spec->reboot_notify(codec);
967 alc_shutup(codec);
973 static void alc_power_eapd(struct hda_codec *codec)
975 alc_auto_setup_eapd(codec, false);
978 static int alc_suspend(struct hda_codec *codec)
980 struct alc_spec *spec = codec->spec;
981 alc_shutup(codec);
983 spec->power_hook(codec);
989 static int alc_resume(struct hda_codec *codec)
991 struct alc_spec *spec = codec->spec;
995 codec->patch_ops.init(codec);
996 snd_hda_regmap_sync(codec);
997 hda_call_check_power_status(codec, 0x01);
1019 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name)
1090 static int alc_codec_rename_from_preset(struct hda_codec *codec)
1096 if (p->vendor_id != codec->core.vendor_id)
1098 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits)
1099 return alc_codec_rename(codec, p->name);
1102 if (!codec->bus->pci)
1105 if (q->codec_vendor_id != codec->core.vendor_id)
1107 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor)
1110 q->pci_subdevice == codec->bus->pci->subsystem_device)
1111 return alc_codec_rename(codec, q->name);
1163 static inline int has_cdefine_beep(struct hda_codec *codec)
1165 struct alc_spec *spec = codec->spec;
1167 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list);
1174 #define has_cdefine_beep(codec) 0
1181 static int alc_parse_auto_config(struct hda_codec *codec,
1185 struct alc_spec *spec = codec->spec;
1189 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids,
1195 alc_ssid_check(codec, ssid_nids);
1197 err = snd_hda_gen_parse_auto_config(codec, cfg);
1205 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
1212 codec->spec = spec;
1216 codec->single_adc_amp = 1;
1217 /* FIXME: do we need this for all Realtek codec models? */
1218 codec->spdif_status_reset = 1;
1219 codec->forced_resume = 1;
1220 codec->patch_ops = alc_patch_ops;
1223 err = alc_codec_rename_from_preset(codec);
1231 static int alc880_parse_auto_config(struct hda_codec *codec)
1235 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids);
1270 static void alc880_fixup_vol_knob(struct hda_codec *codec,
1274 snd_hda_jack_detect_enable_callback(codec, 0x21,
1653 static int patch_alc880(struct hda_codec *codec)
1658 err = alc_alloc_spec(codec, 0x0b);
1662 spec = codec->spec;
1666 codec->patch_ops.unsol_event = alc880_unsol_event;
1668 alc_pre_init(codec);
1670 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl,
1672 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1675 err = alc880_parse_auto_config(codec);
1685 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1690 alc_free(codec);
1698 static int alc260_parse_auto_config(struct hda_codec *codec)
1702 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids);
1722 static void alc260_gpio1_automute(struct hda_codec *codec)
1724 struct alc_spec *spec = codec->spec;
1726 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present);
1729 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec,
1732 struct alc_spec *spec = codec->spec;
1741 snd_hda_jack_detect_enable_callback(codec, 0x0f,
1743 alc_setup_gpio(codec, 0x01);
1747 static void alc260_fixup_kn1(struct hda_codec *codec,
1750 struct alc_spec *spec = codec->spec;
1769 snd_hda_apply_pincfgs(codec, pincfgs);
1775 static void alc260_fixup_fsc_s7020(struct hda_codec *codec,
1778 struct alc_spec *spec = codec->spec;
1783 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1786 struct alc_spec *spec = codec->spec;
1902 static int patch_alc260(struct hda_codec *codec)
1907 err = alc_alloc_spec(codec, 0x07);
1911 spec = codec->spec;
1921 alc_pre_init(codec);
1923 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl,
1925 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1928 err = alc260_parse_auto_config(codec);
1938 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1943 alc_free(codec);
2008 static void alc889_fixup_coef(struct hda_codec *codec,
2013 alc_update_coef_idx(codec, 7, 0, 0x2030);
2017 static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
2020 struct alc_spec *spec = codec->spec;
2023 alc_fixup_gpio3(codec, fix, action);
2030 static void alc889_fixup_dac_route(struct hda_codec *codec,
2037 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2038 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2039 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2);
2040 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2);
2044 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2045 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2046 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn);
2047 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn);
2052 static void alc889_fixup_mbp_vref(struct hda_codec *codec,
2056 struct alc_spec *spec = codec->spec;
2062 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]);
2065 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2067 snd_hda_set_pin_ctl(codec, nids[i], val);
2073 static void alc889_fixup_mac_pins(struct hda_codec *codec,
2076 struct alc_spec *spec = codec->spec;
2081 val = snd_hda_codec_get_pin_target(codec, nids[i]);
2083 snd_hda_set_pin_ctl(codec, nids[i], val);
2089 static void alc889_fixup_imac91_vref(struct hda_codec *codec,
2095 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2099 static void alc889_fixup_mba11_vref(struct hda_codec *codec,
2105 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2109 static void alc889_fixup_mba21_vref(struct hda_codec *codec,
2115 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
2122 static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
2125 struct alc_spec *spec = codec->spec;
2132 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2135 /* For dual-codec configuration, we need to disable some features to avoid
2138 static void alc_fixup_dual_codecs(struct hda_codec *codec,
2141 struct alc_spec *spec = codec->spec;
2153 codec->force_pin_prefix = 1;
2156 static void rename_ctl(struct hda_codec *codec, const char *oldname,
2161 kctl = snd_hda_find_mixer_ctl(codec, oldname);
2166 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
2170 alc_fixup_dual_codecs(codec, fix, action);
2174 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2177 /* rename Capture controls depending on the codec */
2178 rename_ctl(codec, "Capture Volume",
2179 codec->addr == 0 ?
2182 rename_ctl(codec, "Capture Switch",
2183 codec->addr == 0 ?
2190 static void alc1220_fixup_gb_x570(struct hda_codec *codec,
2205 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2206 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2209 alc_process_coef_fw(codec, gb_x570_coefs);
2214 static void alc1220_fixup_clevo_p950(struct hda_codec *codec,
2223 alc_update_coef_idx(codec, 0x7, 0, 0x3c3);
2227 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2228 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1);
2231 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2234 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec,
2238 alc1220_fixup_clevo_p950(codec, fix, action);
2239 alc_fixup_headset_mode_no_hp_mic(codec, fix, action);
2242 static void alc887_asus_hp_automute_hook(struct hda_codec *codec,
2245 struct alc_spec *spec = codec->spec;
2248 snd_hda_gen_hp_automute(codec, jack);
2254 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref);
2257 static void alc887_fixup_asus_jack(struct hda_codec *codec,
2260 struct alc_spec *spec = codec->spec;
2263 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP);
2434 * codec replicate the sum signal to both channels,
2610 /* All Apple entries are in codec SSIDs */
2750 static int alc882_parse_auto_config(struct hda_codec *codec)
2754 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids);
2759 static int patch_alc882(struct hda_codec *codec)
2764 err = alc_alloc_spec(codec, 0x0b);
2768 spec = codec->spec;
2770 switch (codec->core.vendor_id) {
2779 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2783 alc_pre_init(codec);
2785 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl,
2787 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true);
2788 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2790 alc_auto_parse_customize_define(codec);
2792 if (has_cdefine_beep(codec))
2796 err = alc882_parse_auto_config(codec);
2806 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2811 alc_free(codec);
2819 static int alc262_parse_auto_config(struct hda_codec *codec)
2823 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids);
2938 static int patch_alc262(struct hda_codec *codec)
2943 err = alc_alloc_spec(codec, 0x0b);
2947 spec = codec->spec;
2956 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80);
2958 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
2960 alc_pre_init(codec);
2962 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl,
2964 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
2966 alc_auto_parse_customize_define(codec);
2968 if (has_cdefine_beep(codec))
2972 err = alc262_parse_auto_config(codec);
2982 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
2987 alc_free(codec);
2998 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3002 mutex_lock(&codec->control_mutex);
3011 mutex_unlock(&codec->control_mutex);
3073 /* below is codec SSID since multiple Toshiba laptops have the
3083 static int alc268_parse_auto_config(struct hda_codec *codec)
3086 return alc_parse_auto_config(codec, NULL, alc268_ssids);
3091 static int patch_alc268(struct hda_codec *codec)
3097 err = alc_alloc_spec(codec, 0);
3101 spec = codec->spec;
3102 if (has_cdefine_beep(codec))
3107 alc_pre_init(codec);
3109 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups);
3110 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
3113 err = alc268_parse_auto_config(codec);
3126 snd_hda_add_verbs(codec, alc268_beep_init_verbs);
3127 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
3129 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
3136 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
3141 alc_free(codec);
3184 static int alc269_parse_auto_config(struct hda_codec *codec)
3189 struct alc_spec *spec = codec->spec;
3222 return alc_parse_auto_config(codec, alc269_ignore, ssids);
3233 static void alc_headset_btn_callback(struct hda_codec *codec,
3255 static void alc_disable_headset_jack_key(struct hda_codec *codec)
3257 struct alc_spec *spec = codec->spec;
3262 switch (codec->core.vendor_id) {
3270 alc_write_coef_idx(codec, 0x48, 0x0);
3271 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3272 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
3279 alc_write_coef_idx(codec, 0x48, 0x0);
3280 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
3285 static void alc_enable_headset_jack_key(struct hda_codec *codec)
3287 struct alc_spec *spec = codec->spec;
3292 switch (codec->core.vendor_id) {
3300 alc_write_coef_idx(codec, 0x48, 0xd011);
3301 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3302 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
3309 alc_write_coef_idx(codec, 0x48, 0xd011);
3310 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
3315 static void alc_fixup_headset_jack(struct hda_codec *codec,
3318 struct alc_spec *spec = codec->spec;
3323 snd_hda_jack_detect_enable_callback(codec, 0x55,
3325 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", false,
3329 alc_enable_headset_jack_key(codec);
3334 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
3336 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
3339 static void alc269_shutup(struct hda_codec *codec)
3341 struct alc_spec *spec = codec->spec;
3344 alc269vb_toggle_power_output(codec, 0);
3346 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
3349 alc_shutup_pins(codec);
3385 static void alc282_restore_default_value(struct hda_codec *codec)
3387 alc_process_coef_fw(codec, alc282_coefs);
3390 static void alc282_init(struct hda_codec *codec)
3392 struct alc_spec *spec = codec->spec;
3397 alc282_restore_default_value(codec);
3401 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3402 coef78 = alc_read_coef_idx(codec, 0x78);
3406 alc_write_coef_idx(codec, 0x78, 0x9004);
3411 snd_hda_codec_write(codec, hp_pin, 0,
3417 snd_hda_codec_write(codec, hp_pin, 0,
3424 alc_write_coef_idx(codec, 0x78, coef78);
3427 static void alc282_shutup(struct hda_codec *codec)
3429 struct alc_spec *spec = codec->spec;
3435 alc269_shutup(codec);
3439 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3440 coef78 = alc_read_coef_idx(codec, 0x78);
3441 alc_write_coef_idx(codec, 0x78, 0x9004);
3446 snd_hda_codec_write(codec, hp_pin, 0,
3453 snd_hda_codec_write(codec, hp_pin, 0,
3459 alc_auto_setup_eapd(codec, false);
3460 alc_shutup_pins(codec);
3461 alc_write_coef_idx(codec, 0x78, coef78);
3501 static void alc283_restore_default_value(struct hda_codec *codec)
3503 alc_process_coef_fw(codec, alc283_coefs);
3506 static void alc283_init(struct hda_codec *codec)
3508 struct alc_spec *spec = codec->spec;
3512 alc283_restore_default_value(codec);
3518 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3522 alc_write_coef_idx(codec, 0x43, 0x9004);
3524 snd_hda_codec_write(codec, hp_pin, 0,
3530 snd_hda_codec_write(codec, hp_pin, 0,
3537 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3539 alc_write_coef_idx(codec, 0x43, 0x9614);
3542 static void alc283_shutup(struct hda_codec *codec)
3544 struct alc_spec *spec = codec->spec;
3549 alc269_shutup(codec);
3553 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3555 alc_write_coef_idx(codec, 0x43, 0x9004);
3558 alc_write_coef_idx(codec, 0x06, 0x2100);
3560 snd_hda_codec_write(codec, hp_pin, 0,
3567 snd_hda_codec_write(codec, hp_pin, 0,
3570 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3574 alc_auto_setup_eapd(codec, false);
3575 alc_shutup_pins(codec);
3576 alc_write_coef_idx(codec, 0x43, 0x9614);
3579 static void alc256_init(struct hda_codec *codec)
3581 struct alc_spec *spec = codec->spec;
3586 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
3587 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
3588 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
3589 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
3590 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3599 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3604 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3606 snd_hda_codec_write(codec, hp_pin, 0,
3612 snd_hda_codec_write(codec, hp_pin, 0,
3618 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
3619 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3620 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
3621 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
3628 alc_write_coef_idx(codec, 0x36, 0x5757);
3631 static void alc256_shutup(struct hda_codec *codec)
3633 struct alc_spec *spec = codec->spec;
3640 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3641 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3646 snd_hda_codec_write(codec, hp_pin, 0,
3653 /* NOTE: call this before clearing the pin, otherwise codec stalls */
3655 * when booting with headset plugged. So skip setting it for the codec alc257
3658 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
3661 snd_hda_codec_write(codec, hp_pin, 0,
3667 alc_auto_setup_eapd(codec, false);
3668 alc_shutup_pins(codec);
3671 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
3672 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
3673 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
3674 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
3675 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3680 static void alc225_init(struct hda_codec *codec)
3682 struct alc_spec *spec = codec->spec;
3687 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
3688 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
3689 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
3697 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3698 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3703 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
3706 snd_hda_codec_write(codec, hp_pin, 0,
3709 snd_hda_codec_write(codec, 0x16, 0,
3716 snd_hda_codec_write(codec, hp_pin, 0,
3719 snd_hda_codec_write(codec, 0x16, 0,
3725 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3726 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
3729 static void alc225_shutup(struct hda_codec *codec)
3731 struct alc_spec *spec = codec->spec;
3738 alc_disable_headset_jack_key(codec);
3740 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
3742 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3743 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
3749 snd_hda_codec_write(codec, hp_pin, 0,
3752 snd_hda_codec_write(codec, 0x16, 0,
3759 snd_hda_codec_write(codec, hp_pin, 0,
3762 snd_hda_codec_write(codec, 0x16, 0,
3768 alc_auto_setup_eapd(codec, false);
3769 alc_shutup_pins(codec);
3772 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
3773 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
3774 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
3775 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
3779 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
3780 alc_enable_headset_jack_key(codec);
3783 static void alc_default_init(struct hda_codec *codec)
3785 struct alc_spec *spec = codec->spec;
3794 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3799 snd_hda_codec_write(codec, hp_pin, 0,
3805 snd_hda_codec_write(codec, hp_pin, 0,
3812 static void alc_default_shutup(struct hda_codec *codec)
3814 struct alc_spec *spec = codec->spec;
3819 alc269_shutup(codec);
3823 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
3828 snd_hda_codec_write(codec, hp_pin, 0,
3835 snd_hda_codec_write(codec, hp_pin, 0,
3841 alc_auto_setup_eapd(codec, false);
3842 alc_shutup_pins(codec);
3845 static void alc294_hp_init(struct hda_codec *codec)
3847 struct alc_spec *spec = codec->spec;
3854 snd_hda_codec_write(codec, hp_pin, 0,
3860 snd_hda_codec_write(codec, hp_pin, 0,
3863 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
3864 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
3867 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3870 val = alc_read_coefex_idx(codec, 0x58, 0x01);
3873 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
3877 static void alc294_init(struct hda_codec *codec)
3879 struct alc_spec *spec = codec->spec;
3883 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
3884 alc294_hp_init(codec);
3887 alc_default_init(codec);
3890 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
3893 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3894 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
3895 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
3898 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
3902 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
3903 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3905 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
3910 static void alc5505_dsp_halt(struct hda_codec *codec)
3914 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
3915 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
3916 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
3917 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
3918 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
3919 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
3920 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
3921 val = alc5505_coef_get(codec, 0x6220);
3922 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
3925 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
3927 alc5505_coef_set(codec, 0x61b8, 0x04133302);
3928 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
3929 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
3930 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
3931 alc5505_coef_set(codec, 0x6220, 0x2002010f);
3932 alc5505_coef_set(codec, 0x880c, 0x00000004);
3935 static void alc5505_dsp_init(struct hda_codec *codec)
3939 alc5505_dsp_halt(codec);
3940 alc5505_dsp_back_from_halt(codec);
3941 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
3942 alc5505_coef_set(codec, 0x61b0, 0x5b16);
3943 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
3944 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
3945 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
3946 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
3947 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
3948 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
3949 alc5505_coef_set(codec, 0x61b8, 0x04173302);
3950 alc5505_coef_set(codec, 0x61b8, 0x04163302);
3951 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
3952 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
3953 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
3955 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
3957 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
3959 alc5505_coef_set(codec, 0x6220, 0x6002018f);
3961 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
3962 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
3963 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
3964 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
3965 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
3966 alc5505_coef_set(codec, 0x880c, 0x00000003);
3967 alc5505_coef_set(codec, 0x880c, 0x00000010);
3970 alc5505_dsp_halt(codec);
3975 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
3976 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
3978 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
3979 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
3983 static int alc269_suspend(struct hda_codec *codec)
3985 struct alc_spec *spec = codec->spec;
3988 alc5505_dsp_suspend(codec);
3989 return alc_suspend(codec);
3992 static int alc269_resume(struct hda_codec *codec)
3994 struct alc_spec *spec = codec->spec;
3997 alc269vb_toggle_power_output(codec, 0);
3999 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
4003 codec->patch_ops.init(codec);
4006 alc269vb_toggle_power_output(codec, 1);
4008 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
4012 snd_hda_regmap_sync(codec);
4013 hda_call_check_power_status(codec, 0x01);
4015 /* on some machine, the BIOS will clear the codec gpio data when enter
4020 alc_write_gpio_data(codec);
4023 alc5505_dsp_resume(codec);
4029 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
4032 struct alc_spec *spec = codec->spec;
4038 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
4042 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
4043 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
4046 snd_hda_codec_set_pincfg(codec, 0x19,
4051 static void alc269_fixup_hweq(struct hda_codec *codec,
4055 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
4058 static void alc269_fixup_headset_mic(struct hda_codec *codec,
4061 struct alc_spec *spec = codec->spec;
4067 static void alc271_fixup_dmic(struct hda_codec *codec,
4077 if (strcmp(codec->core.chip_name, "ALC271X") &&
4078 strcmp(codec->core.chip_name, "ALC269VB"))
4080 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
4082 snd_hda_sequence_write(codec, verbs);
4086 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
4091 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
4094 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
4097 struct alc_spec *spec = codec->spec;
4109 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
4118 alc_update_coef_idx(codec, 0x07, 0, 0x80);
4121 static void alc269_quanta_automute(struct hda_codec *codec)
4123 snd_hda_gen_update_outputs(codec);
4125 alc_write_coef_idx(codec, 0x0c, 0x680);
4126 alc_write_coef_idx(codec, 0x0c, 0x480);
4129 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
4132 struct alc_spec *spec = codec->spec;
4138 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
4141 struct alc_spec *spec = codec->spec;
4144 snd_hda_gen_hp_automute(codec, jack);
4148 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4151 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
4163 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
4167 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
4168 alc_write_coef_idx(codec, 0x26, 0xb000);
4171 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
4173 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4174 alc_write_coef_idx(codec, 0x26, 0xf000);
4175 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
4178 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
4180 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4181 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4184 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
4208 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
4209 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
4210 alc_write_coef_idx(codec, 0x26, 0xf000);
4211 alc_write_coef_idx(codec, 0x22, 0x31);
4212 alc_write_coef_idx(codec, 0x23, 0x0b);
4213 alc_write_coef_idx(codec, 0x25, 0x00);
4214 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
4215 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
4218 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
4221 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
4224 struct alc_spec *spec = codec->spec;
4231 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
4240 pinval = snd_hda_codec_get_pin_target(codec, pin);
4244 snd_hda_power_up_pm(codec);
4245 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
4246 snd_hda_power_down_pm(codec);
4253 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4254 struct alc_spec *spec = codec->spec;
4256 alc_update_vref_led(codec, spec->mute_led_nid,
4262 static unsigned int led_power_filter(struct hda_codec *codec,
4266 struct alc_spec *spec = codec->spec;
4273 snd_hda_set_pin_ctl(codec, nid,
4274 snd_hda_codec_get_pin_target(codec, nid));
4276 return snd_hda_gen_path_power_filter(codec, nid, power_state);
4279 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
4282 struct alc_spec *spec = codec->spec;
4296 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4297 codec->power_filter = led_power_filter;
4298 codec_dbg(codec,
4305 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
4309 struct alc_spec *spec = codec->spec;
4314 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
4315 codec->power_filter = led_power_filter;
4319 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
4322 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
4325 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
4328 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
4331 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
4334 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
4338 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask,
4343 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */
4350 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4351 struct alc_spec *spec = codec->spec;
4353 alc_update_gpio_led(codec, spec->gpio_mute_led_mask,
4362 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4363 struct alc_spec *spec = codec->spec;
4365 alc_update_gpio_led(codec, spec->gpio_mic_led_mask,
4371 static void alc_fixup_hp_gpio_led(struct hda_codec *codec,
4376 struct alc_spec *spec = codec->spec;
4378 alc_fixup_gpio(codec, action, mute_mask | micmute_mask);
4384 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set);
4388 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set);
4392 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
4395 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
4398 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
4401 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4404 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
4407 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
4410 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
4413 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
4416 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
4419 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
4422 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
4425 struct alc_spec *spec = codec->spec;
4429 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4436 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4437 struct alc_spec *spec = codec->spec;
4439 alc_update_vref_led(codec, spec->cap_mute_led_nid,
4444 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
4447 struct alc_spec *spec = codec->spec;
4449 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4457 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4458 codec->power_filter = led_power_filter;
4462 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
4465 struct alc_spec *spec = codec->spec;
4467 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
4470 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4471 codec->power_filter = led_power_filter;
4478 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
4481 struct alc_spec *spec = codec->spec;
4490 alc_update_gpio_data(codec, 0x01, true);
4492 alc_update_gpio_data(codec, 0x01, false);
4499 struct hda_codec *codec,
4505 alc_update_gpio_data(codec, 0x04, true);
4508 alc_update_gpio_data(codec, 0x04, false);
4513 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
4517 struct alc_spec *spec = codec->spec;
4526 static void alc_update_coef_led(struct hda_codec *codec,
4533 alc_update_coef_idx(codec, led->idx, led->mask,
4541 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4542 struct alc_spec *spec = codec->spec;
4544 alc_update_coef_led(codec, &spec->mute_led_coef,
4549 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4553 struct alc_spec *spec = codec->spec;
4561 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4565 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4569 struct alc_spec *spec = codec->spec;
4577 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4581 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
4584 struct alc_spec *spec = codec->spec;
4592 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
4600 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
4601 struct alc_spec *spec = codec->spec;
4603 alc_update_coef_led(codec, &spec->mic_led_coef,
4608 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4611 struct alc_spec *spec = codec->spec;
4618 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4622 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
4625 struct alc_spec *spec = codec->spec;
4629 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4632 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4635 struct alc_spec *spec = codec->spec;
4642 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
4646 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4649 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4650 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4653 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
4656 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4657 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
4660 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4663 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4664 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4667 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
4670 struct alc_spec *spec = codec->spec;
4674 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4675 codec->power_filter = led_power_filter;
4679 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
4682 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4683 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
4686 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
4689 alc_write_coef_idx(codec, 0x23, coefs[0]);
4690 alc_write_coef_idx(codec, 0x25, coefs[1]);
4691 alc_write_coef_idx(codec, 0x26, 0xb011);
4699 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
4718 alc_write_coef_idx(codec, 0x22, amps[i].nid);
4721 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
4724 alc298_samsung_write_coef_pack(codec, init_seq[j]);
4729 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
4732 struct alc_spec *spec = codec->spec;
4742 static int alc_register_micmute_input_device(struct hda_codec *codec)
4744 struct alc_spec *spec = codec->spec;
4749 codec_err(codec, "Out of memory (input_allocate_device)\n");
4764 codec_err(codec, "input_register_device failed\n");
4778 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
4781 struct alc_spec *spec = codec->spec;
4783 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
4786 if (alc_register_micmute_input_device(codec) != 0)
4792 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
4794 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
4812 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
4815 struct alc_spec *spec = codec->spec;
4817 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
4820 if (alc_register_micmute_input_device(codec) != 0)
4823 snd_hda_jack_detect_enable_callback(codec, 0x1b,
4842 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
4845 struct alc_spec *spec = codec->spec;
4847 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
4850 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
4865 static void alc_headset_mode_unplugged(struct hda_codec *codec)
4867 struct alc_spec *spec = codec->spec;
4943 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
4947 switch (codec->core.vendor_id) {
4949 alc_process_coef_fw(codec, coef0255);
4955 alc_process_coef_fw(codec, coef0256);
4960 alc_process_coef_fw(codec, coef0274);
4964 alc_process_coef_fw(codec, coef0233);
4968 alc_process_coef_fw(codec, coef0288);
4971 alc_process_coef_fw(codec, coef0298);
4972 alc_process_coef_fw(codec, coef0288);
4975 alc_process_coef_fw(codec, coef0292);
4978 alc_process_coef_fw(codec, coef0293);
4981 alc_process_coef_fw(codec, coef0668);
4989 alc_process_coef_fw(codec, alc225_pre_hsmode);
4990 alc_process_coef_fw(codec, coef0225);
4993 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
4996 codec_dbg(codec, "Headset jack set to unplugged mode.\n");
5000 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin,
5060 switch (codec->core.vendor_id) {
5062 alc_write_coef_idx(codec, 0x45, 0xc489);
5063 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5064 alc_process_coef_fw(codec, coef0255);
5065 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5071 alc_write_coef_idx(codec, 0x45, 0xc489);
5072 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5073 alc_process_coef_fw(codec, coef0256);
5074 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5079 alc_write_coef_idx(codec, 0x45, 0x4689);
5080 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5081 alc_process_coef_fw(codec, coef0274);
5082 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5086 alc_write_coef_idx(codec, 0x45, 0xc429);
5087 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5088 alc_process_coef_fw(codec, coef0233);
5089 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5094 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5095 alc_process_coef_fw(codec, coef0288);
5096 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5099 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5100 alc_process_coef_fw(codec, coef0292);
5104 alc_write_coef_idx(codec, 0x45, 0xc429);
5105 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5106 alc_process_coef_fw(codec, coef0293);
5107 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5110 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14);
5114 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5115 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5118 alc_write_coef_idx(codec, 0x11, 0x0001);
5119 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5120 alc_process_coef_fw(codec, coef0688);
5121 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5129 alc_process_coef_fw(codec, alc225_pre_hsmode);
5130 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10);
5131 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0);
5132 alc_process_coef_fw(codec, coef0225);
5133 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50);
5136 codec_dbg(codec, "Headset jack set to mic-in mode.\n");
5139 static void alc_headset_mode_default(struct hda_codec *codec)
5205 switch (codec->core.vendor_id) {
5212 alc_process_coef_fw(codec, alc225_pre_hsmode);
5213 alc_process_coef_fw(codec, coef0225);
5216 alc_process_coef_fw(codec, coef0255);
5222 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5223 alc_write_coef_idx(codec, 0x45, 0xc089);
5225 alc_process_coef_fw(codec, coef0256);
5230 alc_process_coef_fw(codec, coef0274);
5234 alc_process_coef_fw(codec, coef0233);
5239 alc_process_coef_fw(codec, coef0288);
5242 alc_process_coef_fw(codec, coef0292);
5245 alc_process_coef_fw(codec, coef0293);
5248 alc_process_coef_fw(codec, coef0688);
5251 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5254 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n");
5258 static void alc_headset_mode_ctia(struct hda_codec *codec)
5314 switch (codec->core.vendor_id) {
5316 alc_process_coef_fw(codec, coef0255);
5322 alc_process_coef_fw(codec, coef0256);
5327 alc_write_coef_idx(codec, 0x45, 0xd689);
5331 alc_process_coef_fw(codec, coef0233);
5334 val = alc_read_coef_idx(codec, 0x50);
5336 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5337 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5340 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5341 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5347 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400);
5349 alc_process_coef_fw(codec, coef0288);
5352 alc_process_coef_fw(codec, coef0292);
5355 alc_process_coef_fw(codec, coef0293);
5358 alc_process_coef_fw(codec, coef0688);
5366 val = alc_read_coef_idx(codec, 0x45);
5368 alc_process_coef_fw(codec, coef0225_2);
5370 alc_process_coef_fw(codec, coef0225_1);
5373 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5376 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n");
5380 static void alc_headset_mode_omtp(struct hda_codec *codec)
5429 switch (codec->core.vendor_id) {
5431 alc_process_coef_fw(codec, coef0255);
5437 alc_process_coef_fw(codec, coef0256);
5442 alc_write_coef_idx(codec, 0x45, 0xe689);
5446 alc_process_coef_fw(codec, coef0233);
5449 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */
5450 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5455 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400);
5457 alc_process_coef_fw(codec, coef0288);
5460 alc_process_coef_fw(codec, coef0292);
5463 alc_process_coef_fw(codec, coef0293);
5466 alc_process_coef_fw(codec, coef0688);
5474 alc_process_coef_fw(codec, coef0225);
5477 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n");
5480 static void alc_determine_headset_type(struct hda_codec *codec)
5484 struct alc_spec *spec = codec->spec;
5524 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
5528 switch (codec->core.vendor_id) {
5530 alc_process_coef_fw(codec, coef0255);
5532 val = alc_read_coef_idx(codec, 0x46);
5539 alc_write_coef_idx(codec, 0x1b, 0x0e4b);
5540 alc_write_coef_idx(codec, 0x06, 0x6104);
5541 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3);
5543 snd_hda_codec_write(codec, 0x21, 0,
5546 snd_hda_codec_write(codec, 0x21, 0,
5549 alc_process_coef_fw(codec, coef0255);
5551 val = alc_read_coef_idx(codec, 0x46);
5554 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3);
5555 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0);
5557 snd_hda_codec_write(codec, 0x21, 0,
5560 snd_hda_codec_write(codec, 0x21, 0,
5566 alc_process_coef_fw(codec, coef0274);
5568 val = alc_read_coef_idx(codec, 0x46);
5573 alc_write_coef_idx(codec, 0x45, 0xd029);
5575 val = alc_read_coef_idx(codec, 0x46);
5579 snd_hda_codec_write(codec, 0x21, 0,
5582 snd_hda_codec_write(codec, 0x21, 0,
5586 val = alc_read_coef_idx(codec, 0x50);
5588 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020);
5589 alc_process_coef_fw(codec, coef0288);
5591 val = alc_read_coef_idx(codec, 0x50);
5594 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);
5595 alc_process_coef_fw(codec, coef0288);
5597 val = alc_read_coef_idx(codec, 0x50);
5600 alc_process_coef_fw(codec, coef0298);
5601 snd_hda_codec_write(codec, 0x21, 0,
5604 snd_hda_codec_write(codec, 0x21, 0,
5609 alc_process_coef_fw(codec, coef0288);
5611 val = alc_read_coef_idx(codec, 0x50);
5615 alc_write_coef_idx(codec, 0x6b, 0xd429);
5617 val = alc_read_coef_idx(codec, 0x6c);
5621 alc_process_coef_fw(codec, coef0293);
5623 val = alc_read_coef_idx(codec, 0x46);
5627 alc_process_coef_fw(codec, coef0688);
5629 val = alc_read_coef_idx(codec, 0xbe);
5638 snd_hda_codec_write(codec, 0x21, 0,
5641 snd_hda_codec_write(codec, 0x21, 0,
5644 alc_process_coef_fw(codec, alc225_pre_hsmode);
5645 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000);
5646 val = alc_read_coef_idx(codec, 0x45);
5648 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5649 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8);
5651 val = alc_read_coef_idx(codec, 0x46);
5654 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10);
5655 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8);
5657 val = alc_read_coef_idx(codec, 0x46);
5660 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6);
5661 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4);
5662 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
5664 snd_hda_codec_write(codec, 0x21, 0,
5667 snd_hda_codec_write(codec, 0x21, 0,
5675 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n",
5680 static void alc_update_headset_mode(struct hda_codec *codec)
5682 struct alc_spec *spec = codec->spec;
5689 if (!snd_hda_jack_detect(codec, hp_pin))
5699 snd_hda_gen_update_outputs(codec);
5705 alc_headset_mode_unplugged(codec);
5712 alc_determine_headset_type(codec);
5714 alc_headset_mode_ctia(codec);
5716 alc_headset_mode_omtp(codec);
5720 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin);
5724 alc_headset_mode_default(codec);
5729 snd_hda_set_pin_ctl_cache(codec, hp_pin,
5732 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin,
5737 snd_hda_gen_update_outputs(codec);
5740 static void alc_update_headset_mode_hook(struct hda_codec *codec,
5744 alc_update_headset_mode(codec);
5747 static void alc_update_headset_jack_cb(struct hda_codec *codec,
5750 snd_hda_gen_hp_automute(codec, jack);
5751 alc_update_headset_mode(codec);
5754 static void alc_probe_headset_mode(struct hda_codec *codec)
5757 struct alc_spec *spec = codec->spec;
5774 static void alc_fixup_headset_mode(struct hda_codec *codec,
5777 struct alc_spec *spec = codec->spec;
5784 alc_probe_headset_mode(codec);
5787 if (is_s3_resume(codec) || is_s4_resume(codec)) {
5791 alc_update_headset_mode(codec);
5796 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
5800 struct alc_spec *spec = codec->spec;
5804 alc_fixup_headset_mode(codec, fix, action);
5807 static void alc255_set_default_jack_type(struct hda_codec *codec)
5826 switch (codec->core.vendor_id) {
5828 alc_process_coef_fw(codec, alc255fw);
5834 alc_process_coef_fw(codec, alc256fw);
5840 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
5844 alc255_set_default_jack_type(codec);
5846 alc_fixup_headset_mode(codec, fix, action);
5849 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
5853 struct alc_spec *spec = codec->spec;
5855 alc255_set_default_jack_type(codec);
5858 alc_fixup_headset_mode(codec, fix, action);
5861 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
5864 struct alc_spec *spec = codec->spec;
5866 alc_update_headset_jack_cb(codec, jack);
5868 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
5871 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
5874 alc_fixup_headset_mode(codec, fix, action);
5876 struct alc_spec *spec = codec->spec;
5884 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec,
5888 struct alc_spec *spec = codec->spec;
5893 static void alc_fixup_no_shutup(struct hda_codec *codec,
5897 struct alc_spec *spec = codec->spec;
5902 static void alc_fixup_disable_aamix(struct hda_codec *codec,
5906 struct alc_spec *spec = codec->spec;
5913 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
5921 struct alc_spec *spec = codec->spec;
5926 codec->power_save_node = 0; /* avoid click noises */
5927 snd_hda_apply_pincfgs(codec, pincfgs);
5931 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
5939 struct alc_spec *spec = codec->spec;
5943 snd_hda_apply_pincfgs(codec, pincfgs);
5946 snd_hda_codec_write(codec, 0x17, 0,
5949 snd_hda_codec_write(codec, 0x19, 0,
5954 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
5959 * ALC298 codec
5965 struct alc_spec *spec = codec->spec;
5971 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
5977 struct alc_spec *spec = codec->spec;
5983 static void alc_shutup_dell_xps13(struct hda_codec *codec)
5985 struct alc_spec *spec = codec->spec;
5989 snd_hda_codec_write(codec, hp_pin, 0,
5994 static void alc_fixup_dell_xps13(struct hda_codec *codec,
5997 struct alc_spec *spec = codec->spec;
6006 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6021 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec,
6024 struct alc_spec *spec = codec->spec;
6032 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000);
6033 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP);
6035 alc_fixup_headset_mode(codec, fix, action);
6038 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec,
6042 alc_write_coef_idx(codec, 0xc4, 0x8000);
6043 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0);
6044 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
6046 alc_fixup_headset_mode(codec, fix, action);
6050 static int find_ext_mic_pin(struct hda_codec *codec)
6052 struct alc_spec *spec = codec->spec;
6062 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6071 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6075 struct alc_spec *spec = codec->spec;
6078 int mic_pin = find_ext_mic_pin(codec);
6083 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
6087 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
6091 struct alc_spec *spec = codec->spec;
6107 defcfg = snd_hda_codec_get_pincfg(codec, nid);
6111 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
6119 static void alc283_hp_automute_hook(struct hda_codec *codec,
6122 struct alc_spec *spec = codec->spec;
6126 snd_hda_gen_hp_automute(codec, jack);
6131 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
6135 static void alc283_fixup_chromebook(struct hda_codec *codec,
6138 struct alc_spec *spec = codec->spec;
6142 snd_hda_override_wcaps(codec, 0x03, 0);
6149 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6151 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
6156 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
6159 struct alc_spec *spec = codec->spec;
6168 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
6174 static void asus_tx300_automute(struct hda_codec *codec)
6176 struct alc_spec *spec = codec->spec;
6177 snd_hda_gen_update_outputs(codec);
6178 if (snd_hda_jack_detect(codec, 0x1b))
6182 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
6185 struct alc_spec *spec = codec->spec;
6195 alc_setup_gpio(codec, 0x04);
6196 snd_hda_apply_pincfgs(codec, dock_pins);
6199 snd_hda_jack_detect_enable_callback(codec, 0x1b,
6209 rename_ctl(codec, "Speaker Playback Switch",
6211 rename_ctl(codec, "Bass Speaker Playback Switch",
6217 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
6225 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
6226 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
6230 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
6242 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
6247 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
6252 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6257 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
6262 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6267 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
6270 struct alc_spec *spec = codec->spec;
6272 snd_hda_gen_hp_automute(codec, jack);
6274 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
6284 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
6288 struct alc_spec *spec = codec->spec;
6290 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
6299 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
6303 struct alc_spec *spec = codec->spec;
6318 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
6325 struct alc_spec *spec = codec->spec;
6329 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6339 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
6340 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
6345 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec,
6349 alc_fixup_dual_codecs(codec, fix, action);
6353 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs");
6356 /* rename Capture controls depending on the codec */
6357 rename_ctl(codec, "Capture Volume",
6358 codec->addr == 0 ?
6361 rename_ctl(codec, "Capture Switch",
6362 codec->addr == 0 ?
6369 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
6375 codec->power_save_node = 1;
6379 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
6382 struct alc_spec *spec = codec->spec;
6393 codec->power_save_node = 0;
6397 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
6403 struct alc_spec *spec = codec->spec;
6412 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
6418 snd_hda_override_wcaps(codec, 0x03, 0);
6421 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
6423 switch (codec->core.vendor_id) {
6429 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
6430 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
6439 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
6440 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
6445 static void alc295_fixup_chromebook(struct hda_codec *codec,
6448 struct alc_spec *spec = codec->spec;
6455 alc_combo_jack_hp_jd_restart(codec);
6460 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
6464 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
6468 static void alc294_gx502_toggle_output(struct hda_codec *codec,
6471 /* The Windows driver sets the codec up in a very different way where
6474 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6475 alc_write_coef_idx(codec, 0x10, 0x8a20);
6477 alc_write_coef_idx(codec, 0x10, 0x0a20);
6480 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
6484 if (!is_jack_detectable(codec, 0x21))
6489 snd_hda_jack_detect_enable_callback(codec, 0x21,
6496 alc294_gx502_toggle_output(codec, NULL);
6501 static void alc294_gu502_toggle_output(struct hda_codec *codec,
6507 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
6508 alc_write_coef_idx(codec, 0x10, 0x8420);
6510 alc_write_coef_idx(codec, 0x10, 0x0a20);
6513 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
6516 if (!is_jack_detectable(codec, 0x21))
6521 snd_hda_jack_detect_enable_callback(codec, 0x21,
6525 alc294_gu502_toggle_output(codec, NULL);
6530 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
6537 alc_write_coef_idx(codec, 0x65, 0x0);
6540 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
6545 alc_combo_jack_hp_jd_restart(codec);
6550 static void alc_fixup_no_int_mic(struct hda_codec *codec,
6553 struct alc_spec *spec = codec->spec;
6558 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
6562 alc_combo_jack_hp_jd_restart(codec);
6570 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
6575 struct alc_spec *spec = codec->spec;
6583 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
6591 snd_hda_apply_pincfgs(codec, pincfgs);
6593 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
6594 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6598 alc_update_gpio_data(codec, 0x01, true);
6600 alc_update_gpio_data(codec, 0x01, false);
6605 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
6616 snd_hda_apply_pincfgs(codec, pincfgs);
6618 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6626 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
6629 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
6630 hda_fixup_thinkpad_acpi(codec, fix, action);
6634 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
6638 struct alc_spec *spec = codec->spec;
6660 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
6672 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
6682 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
6693 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
6696 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
6701 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
6702 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
6705 if (codec->core.vendor_id == 0x10ec0256) {
6706 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
6707 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
6709 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
6713 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
6728 struct alc_spec *spec = codec->spec;
6730 alc_fixup_no_shutup(codec, fix, action);
6734 snd_hda_apply_pincfgs(codec, pincfgs);
6735 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
6980 * depending on the codec ID
6982 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
6988 if (codec->core.vendor_id == 0x10ec0298)
6992 __snd_hda_apply_fixup(codec, id, action, 0);
9958 * at most one tbl is allowed to define for the same vendor and same codec
9979 static void alc269_fill_coef(struct hda_codec *codec)
9981 struct alc_spec *spec = codec->spec;
9987 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
9988 alc_write_coef_idx(codec, 0xf, 0x960b);
9989 alc_write_coef_idx(codec, 0xe, 0x8817);
9992 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
9993 alc_write_coef_idx(codec, 0xf, 0x960b);
9994 alc_write_coef_idx(codec, 0xe, 0x8814);
9997 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
9999 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
10002 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
10003 val = alc_read_coef_idx(codec, 0xd);
10006 alc_write_coef_idx(codec, 0xd, val | (1<<10));
10008 val = alc_read_coef_idx(codec, 0x17);
10011 alc_write_coef_idx(codec, 0x17, val | (1<<7));
10016 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
10021 static int patch_alc269(struct hda_codec *codec)
10026 err = alc_alloc_spec(codec, 0x0b);
10030 spec = codec->spec;
10032 codec->power_save_node = 0;
10036 codec->patch_ops.suspend = alc269_suspend;
10037 codec->patch_ops.resume = alc269_resume;
10042 switch (codec->core.vendor_id) {
10045 switch (alc_get_coef0(codec) & 0x00f0) {
10047 if (codec->bus->pci &&
10048 codec->bus->pci->subsystem_vendor == 0x1025 &&
10050 err = alc_codec_rename(codec, "ALC271X");
10054 if (codec->bus->pci &&
10055 codec->bus->pci->subsystem_vendor == 0x17aa &&
10056 codec->bus->pci->subsystem_device == 0x21f3)
10057 err = alc_codec_rename(codec, "ALC3202");
10064 alc_fix_pll_init(codec, 0x20, 0x04, 15);
10070 alc269_fill_coef(codec);
10116 if (codec->core.vendor_id == 0x10ec0236 &&
10117 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
10150 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
10166 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
10172 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
10177 alc_pre_init(codec);
10179 snd_hda_pick_fixup(codec, alc269_fixup_models,
10185 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
10186 codec->core.vendor_id == 0x10ec0294) {
10187 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
10188 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
10191 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
10192 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
10193 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
10195 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10197 alc_auto_parse_customize_define(codec);
10199 if (has_cdefine_beep(codec))
10203 err = alc269_parse_auto_config(codec);
10213 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10218 alc_free(codec);
10226 static int alc861_parse_auto_config(struct hda_codec *codec)
10230 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids);
10243 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec,
10246 struct alc_spec *spec = codec->spec;
10251 val = snd_hda_codec_get_pin_target(codec, 0x0f);
10255 snd_hda_set_pin_ctl(codec, 0x0f, val);
10260 static void alc_fixup_no_jack_detect(struct hda_codec *codec,
10264 codec->no_jack_detect = 1;
10315 static int patch_alc861(struct hda_codec *codec)
10320 err = alc_alloc_spec(codec, 0x15);
10324 spec = codec->spec;
10325 if (has_cdefine_beep(codec))
10332 alc_pre_init(codec);
10334 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
10335 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10338 err = alc861_parse_auto_config(codec);
10348 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10353 alc_free(codec);
10364 static int alc861vd_parse_auto_config(struct hda_codec *codec)
10368 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids);
10377 static void alc861vd_fixup_dallas(struct hda_codec *codec,
10381 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
10382 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
10387 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec,
10390 struct alc_spec *spec = codec->spec;
10394 alc_fixup_gpio(codec, action, 0x01);
10417 static int patch_alc861vd(struct hda_codec *codec)
10422 err = alc_alloc_spec(codec, 0x0b);
10426 spec = codec->spec;
10427 if (has_cdefine_beep(codec))
10432 alc_pre_init(codec);
10434 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
10435 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
10438 err = alc861vd_parse_auto_config(codec);
10448 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
10453 alc_free(codec);
10473 static int alc662_parse_auto_config(struct hda_codec *codec)
10480 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 ||
10481 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 ||
10482 codec->core.vendor_id == 0x10ec0671)
10486 return alc_parse_auto_config(codec, alc662_ignore, ssids);
10489 static void alc272_fixup_mario(struct hda_codec *codec,
10494 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
10499 codec_warn(codec, "failed to override amp caps for NID 0x2\n");
10512 static void alc_fixup_bass_chmap(struct hda_codec *codec,
10516 struct alc_spec *spec = codec->spec;
10522 static unsigned int gpio_led_power_filter(struct hda_codec *codec,
10526 struct alc_spec *spec = codec->spec;
10527 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data)
10532 static void alc662_fixup_led_gpio1(struct hda_codec *codec,
10535 struct alc_spec *spec = codec->spec;
10537 alc_fixup_hp_gpio_led(codec, action, 0x01, 0);
10540 codec->power_filter = gpio_led_power_filter;
10544 static void alc662_usi_automute_hook(struct hda_codec *codec,
10547 struct alc_spec *spec = codec->spec;
10550 snd_hda_gen_hp_automute(codec, jack);
10554 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10558 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec,
10561 struct alc_spec *spec = codec->spec;
10568 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec,
10577 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) {
10578 snd_hda_set_pin_ctl_cache(codec, 0x15, 0);
10579 snd_hda_set_pin_ctl_cache(codec, 0x18, 0);
10581 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT);
10582 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT);
10586 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec,
10590 if (!is_jack_detectable(codec, 0x1b))
10595 snd_hda_jack_detect_enable_callback(codec, 0x1b,
10598 alc_setup_gpio(codec, 0x02);
10604 alc662_aspire_ethos_mute_speakers(codec, NULL);
10609 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec,
10612 struct alc_spec *spec = codec->spec;
10624 snd_hda_apply_pincfgs(codec, pincfgs);
10627 alc_write_coef_idx(codec, 0x19, 0xa054);
10632 static void alc897_hp_automute_hook(struct hda_codec *codec,
10635 struct alc_spec *spec = codec->spec;
10638 snd_hda_gen_hp_automute(codec, jack);
10640 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
10644 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec,
10647 struct alc_spec *spec = codec->spec;
10653 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec,
10656 struct alc_spec *spec = codec->spec;
10688 static void alc668_restore_default_value(struct hda_codec *codec)
10690 alc_process_coef_fw(codec, alc668_coefs);
11423 static int patch_alc662(struct hda_codec *codec)
11428 err = alc_alloc_spec(codec, 0x0b);
11432 spec = codec->spec;
11439 alc_fix_pll_init(codec, 0x20, 0x04, 15);
11441 switch (codec->core.vendor_id) {
11447 alc_pre_init(codec);
11449 snd_hda_pick_fixup(codec, alc662_fixup_models,
11451 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true);
11452 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
11454 alc_auto_parse_customize_define(codec);
11456 if (has_cdefine_beep(codec))
11459 if ((alc_get_coef0(codec) & (1 << 14)) &&
11460 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 &&
11462 err = alc_codec_rename(codec, "ALC272X");
11468 err = alc662_parse_auto_config(codec);
11473 switch (codec->core.vendor_id) {
11491 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
11496 alc_free(codec);
11504 static int alc680_parse_auto_config(struct hda_codec *codec)
11506 return alc_parse_auto_config(codec, NULL, NULL);
11511 static int patch_alc680(struct hda_codec *codec)
11516 err = alc_alloc_spec(codec, 0);
11521 err = alc680_parse_auto_config(codec);
11523 alc_free(codec);
11618 MODULE_DESCRIPTION("Realtek HD-audio codec");