Lines Matching full:codec
3 * Universal Interface for Intel High Definition Audio Codec
87 /* codec parameterization */
115 void (*init_hook)(struct hda_codec *codec);
116 void (*power_hook)(struct hda_codec *codec);
117 void (*shutup)(struct hda_codec *codec);
146 static void coef_mutex_lock(struct hda_codec *codec) in coef_mutex_lock() argument
148 struct alc_spec *spec = codec->spec; in coef_mutex_lock()
150 snd_hda_power_up_pm(codec); in coef_mutex_lock()
154 static void coef_mutex_unlock(struct hda_codec *codec) in coef_mutex_unlock() argument
156 struct alc_spec *spec = codec->spec; in coef_mutex_unlock()
159 snd_hda_power_down_pm(codec); in coef_mutex_unlock()
162 static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_read_coefex_idx() argument
167 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_read_coefex_idx()
168 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); in __alc_read_coefex_idx()
172 static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_read_coefex_idx() argument
177 coef_mutex_lock(codec); in alc_read_coefex_idx()
178 val = __alc_read_coefex_idx(codec, nid, coef_idx); in alc_read_coefex_idx()
179 coef_mutex_unlock(codec); in alc_read_coefex_idx()
183 #define alc_read_coef_idx(codec, coef_idx) \ argument
184 alc_read_coefex_idx(codec, 0x20, coef_idx)
186 static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_write_coefex_idx() argument
189 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx); in __alc_write_coefex_idx()
190 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val); in __alc_write_coefex_idx()
193 static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_write_coefex_idx() argument
196 coef_mutex_lock(codec); in alc_write_coefex_idx()
197 __alc_write_coefex_idx(codec, nid, coef_idx, coef_val); in alc_write_coefex_idx()
198 coef_mutex_unlock(codec); in alc_write_coefex_idx()
201 #define alc_write_coef_idx(codec, coef_idx, coef_val) \ argument
202 alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
204 static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in __alc_update_coefex_idx() argument
208 unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx); in __alc_update_coefex_idx()
211 __alc_write_coefex_idx(codec, nid, coef_idx, in __alc_update_coefex_idx()
215 static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid, in alc_update_coefex_idx() argument
219 coef_mutex_lock(codec); in alc_update_coefex_idx()
220 __alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set); in alc_update_coefex_idx()
221 coef_mutex_unlock(codec); in alc_update_coefex_idx()
224 #define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \ argument
225 alc_update_coefex_idx(codec, 0x20, coef_idx, mask, bits_set)
228 static unsigned int alc_get_coef0(struct hda_codec *codec) in alc_get_coef0() argument
230 struct alc_spec *spec = codec->spec; in alc_get_coef0()
233 spec->coef0 = alc_read_coef_idx(codec, 0); in alc_get_coef0()
251 static void alc_process_coef_fw(struct hda_codec *codec, in alc_process_coef_fw() argument
254 coef_mutex_lock(codec); in alc_process_coef_fw()
257 __alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val); in alc_process_coef_fw()
259 __alc_update_coefex_idx(codec, fw->nid, fw->idx, in alc_process_coef_fw()
262 coef_mutex_unlock(codec); in alc_process_coef_fw()
270 static void alc_setup_gpio(struct hda_codec *codec, unsigned int mask) in alc_setup_gpio() argument
272 struct alc_spec *spec = codec->spec; in alc_setup_gpio()
279 static void alc_write_gpio_data(struct hda_codec *codec) in alc_write_gpio_data() argument
281 struct alc_spec *spec = codec->spec; in alc_write_gpio_data()
283 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in alc_write_gpio_data()
287 static void alc_update_gpio_data(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_data() argument
290 struct alc_spec *spec = codec->spec; in alc_update_gpio_data()
298 alc_write_gpio_data(codec); in alc_update_gpio_data()
301 static void alc_write_gpio(struct hda_codec *codec) in alc_write_gpio() argument
303 struct alc_spec *spec = codec->spec; in alc_write_gpio()
308 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
310 snd_hda_codec_write(codec, codec->core.afg, 0, in alc_write_gpio()
314 alc_write_gpio_data(codec); in alc_write_gpio()
317 static void alc_fixup_gpio(struct hda_codec *codec, int action, in alc_fixup_gpio() argument
321 alc_setup_gpio(codec, mask); in alc_fixup_gpio()
324 static void alc_fixup_gpio1(struct hda_codec *codec, in alc_fixup_gpio1() argument
327 alc_fixup_gpio(codec, action, 0x01); in alc_fixup_gpio1()
330 static void alc_fixup_gpio2(struct hda_codec *codec, in alc_fixup_gpio2() argument
333 alc_fixup_gpio(codec, action, 0x02); in alc_fixup_gpio2()
336 static void alc_fixup_gpio3(struct hda_codec *codec, in alc_fixup_gpio3() argument
339 alc_fixup_gpio(codec, action, 0x03); in alc_fixup_gpio3()
342 static void alc_fixup_gpio4(struct hda_codec *codec, in alc_fixup_gpio4() argument
345 alc_fixup_gpio(codec, action, 0x04); in alc_fixup_gpio4()
348 static void alc_fixup_micmute_led(struct hda_codec *codec, in alc_fixup_micmute_led() argument
352 snd_hda_gen_add_micmute_led_cdev(codec, NULL); in alc_fixup_micmute_led()
360 static void alc_fix_pll(struct hda_codec *codec) in alc_fix_pll() argument
362 struct alc_spec *spec = codec->spec; in alc_fix_pll()
365 alc_update_coefex_idx(codec, spec->pll_nid, spec->pll_coef_idx, in alc_fix_pll()
369 static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, in alc_fix_pll_init() argument
372 struct alc_spec *spec = codec->spec; in alc_fix_pll_init()
376 alc_fix_pll(codec); in alc_fix_pll_init()
380 static void alc_update_knob_master(struct hda_codec *codec, in alc_update_knob_master() argument
387 kctl = snd_hda_find_mixer_ctl(codec, "Master Playback Volume"); in alc_update_knob_master()
393 val = snd_hda_codec_read(codec, jack->nid, 0, in alc_update_knob_master()
402 static void alc880_unsol_event(struct hda_codec *codec, unsigned int res) in alc880_unsol_event() argument
406 snd_hda_jack_unsol_event(codec, res >> 2); in alc880_unsol_event()
410 static void alc_fill_eapd_coef(struct hda_codec *codec) in alc_fill_eapd_coef() argument
414 coef = alc_get_coef0(codec); in alc_fill_eapd_coef()
416 switch (codec->core.vendor_id) { in alc_fill_eapd_coef()
418 alc_update_coef_idx(codec, 0x7, 0, 1<<5); in alc_fill_eapd_coef()
422 alc_update_coef_idx(codec, 0x7, 0, 1<<13); in alc_fill_eapd_coef()
426 alc_update_coef_idx(codec, 0xd, 0, 1<<14); in alc_fill_eapd_coef()
428 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
430 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
436 alc_update_coef_idx(codec, 0x4, 1<<15, 0); in alc_fill_eapd_coef()
441 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_fill_eapd_coef()
446 alc_update_coef_idx(codec, 0x36, 1<<13, 0); in alc_fill_eapd_coef()
463 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
466 alc_update_coef_idx(codec, 0xe, 0, 1<<0); in alc_fill_eapd_coef()
469 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc_fill_eapd_coef()
470 alc_write_coef_idx(codec, 0x8, 0x4ab7); in alc_fill_eapd_coef()
473 alc_update_coef_idx(codec, 0xa, 1<<13, 0); in alc_fill_eapd_coef()
477 alc_write_coef_idx(codec, 0x6e, 0x0c25); in alc_fill_eapd_coef()
484 alc_update_coef_idx(codec, 0x10, 1<<15, 0); in alc_fill_eapd_coef()
488 alc_update_coef_idx(codec, 0x4, 1<<10, 0); /* EAPD Ctrl */ in alc_fill_eapd_coef()
497 alc_update_coef_idx(codec, 0xd, 0, 1<<14); /* EAPD Ctrl */ in alc_fill_eapd_coef()
501 alc_update_coef_idx(codec, 0x19, 1<<13, 0); in alc_fill_eapd_coef()
504 alc_update_coef_idx(codec, 0x7, 3<<13, 0); in alc_fill_eapd_coef()
507 alc_update_coef_idx(codec, 0x4, 1<<10, 0); in alc_fill_eapd_coef()
511 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
515 alc_update_coef_idx(codec, 0x7, 1<<5, 0); in alc_fill_eapd_coef()
522 alc_update_coef_idx(codec, 0x7, 1<<1, 0); in alc_fill_eapd_coef()
528 static void alc888_coef_init(struct hda_codec *codec) in alc888_coef_init() argument
530 switch (alc_get_coef0(codec) & 0x00f0) { in alc888_coef_init()
535 alc_update_coef_idx(codec, 7, 0, 0x2030); /* Turn EAPD to High */ in alc888_coef_init()
541 static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on) in set_eapd() argument
543 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in set_eapd()
545 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD) in set_eapd()
546 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE, in set_eapd()
550 /* turn on/off EAPD controls of the codec */
551 static void alc_auto_setup_eapd(struct hda_codec *codec, bool on) in alc_auto_setup_eapd() argument
559 set_eapd(codec, *p, on); in alc_auto_setup_eapd()
562 static int find_ext_mic_pin(struct hda_codec *codec);
564 static void alc_headset_mic_no_shutup(struct hda_codec *codec) in alc_headset_mic_no_shutup() argument
567 int mic_pin = find_ext_mic_pin(codec); in alc_headset_mic_no_shutup()
573 if (codec->bus->shutdown) in alc_headset_mic_no_shutup()
576 snd_array_for_each(&codec->init_pins, i, pin) { in alc_headset_mic_no_shutup()
579 snd_hda_codec_read(codec, pin->nid, 0, in alc_headset_mic_no_shutup()
583 codec->pins_shutup = 1; in alc_headset_mic_no_shutup()
586 static void alc_shutup_pins(struct hda_codec *codec) in alc_shutup_pins() argument
588 struct alc_spec *spec = codec->spec; in alc_shutup_pins()
593 switch (codec->core.vendor_id) { in alc_shutup_pins()
605 alc_headset_mic_no_shutup(codec); in alc_shutup_pins()
608 snd_hda_shutup_pins(codec); in alc_shutup_pins()
616 static void alc_eapd_shutup(struct hda_codec *codec) in alc_eapd_shutup() argument
618 struct alc_spec *spec = codec->spec; in alc_eapd_shutup()
620 alc_auto_setup_eapd(codec, false); in alc_eapd_shutup()
623 alc_shutup_pins(codec); in alc_eapd_shutup()
627 static void alc_auto_init_amp(struct hda_codec *codec, int type) in alc_auto_init_amp() argument
629 alc_auto_setup_eapd(codec, true); in alc_auto_init_amp()
630 alc_write_gpio(codec); in alc_auto_init_amp()
633 switch (codec->core.vendor_id) { in alc_auto_init_amp()
635 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x2010); in alc_auto_init_amp()
641 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc_auto_init_amp()
644 alc888_coef_init(codec); in alc_auto_init_amp()
670 static void alc_fixup_sku_ignore(struct hda_codec *codec, in alc_fixup_sku_ignore() argument
673 struct alc_spec *spec = codec->spec; in alc_fixup_sku_ignore()
680 static void alc_fixup_no_depop_delay(struct hda_codec *codec, in alc_fixup_no_depop_delay() argument
683 struct alc_spec *spec = codec->spec; in alc_fixup_no_depop_delay()
687 codec->depop_delay = 0; in alc_fixup_no_depop_delay()
691 static int alc_auto_parse_customize_define(struct hda_codec *codec) in alc_auto_parse_customize_define() argument
695 struct alc_spec *spec = codec->spec; in alc_auto_parse_customize_define()
706 if (!codec->bus->pci) in alc_auto_parse_customize_define()
708 ass = codec->core.subsystem_id & 0xffff; in alc_auto_parse_customize_define()
709 if (ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_auto_parse_customize_define()
713 if (codec->core.vendor_id == 0x10ec0260) in alc_auto_parse_customize_define()
715 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_auto_parse_customize_define()
718 codec_info(codec, "%s: SKU not ready 0x%08x\n", in alc_auto_parse_customize_define()
719 codec->core.chip_name, ass); in alc_auto_parse_customize_define()
743 codec_dbg(codec, "SKU: Nid=0x%x sku_cfg=0x%08x\n", in alc_auto_parse_customize_define()
745 codec_dbg(codec, "SKU: port_connectivity=0x%x\n", in alc_auto_parse_customize_define()
747 codec_dbg(codec, "SKU: enable_pcbeep=0x%x\n", spec->cdefine.enable_pcbeep); in alc_auto_parse_customize_define()
748 codec_dbg(codec, "SKU: check_sum=0x%08x\n", spec->cdefine.check_sum); in alc_auto_parse_customize_define()
749 codec_dbg(codec, "SKU: customization=0x%08x\n", spec->cdefine.customization); in alc_auto_parse_customize_define()
750 codec_dbg(codec, "SKU: external_amp=0x%x\n", spec->cdefine.external_amp); in alc_auto_parse_customize_define()
751 codec_dbg(codec, "SKU: platform_type=0x%x\n", spec->cdefine.platform_type); in alc_auto_parse_customize_define()
752 codec_dbg(codec, "SKU: swap=0x%x\n", spec->cdefine.swap); in alc_auto_parse_customize_define()
753 codec_dbg(codec, "SKU: override=0x%x\n", spec->cdefine.override); in alc_auto_parse_customize_define()
776 /* 32-bit subsystem ID for BIOS loading in HD Audio codec.
782 static int alc_subsystem_id(struct hda_codec *codec, const hda_nid_t *ports) in alc_subsystem_id() argument
786 struct alc_spec *spec = codec->spec; in alc_subsystem_id()
795 ass = codec->core.subsystem_id & 0xffff; in alc_subsystem_id()
796 if (codec->bus->pci && in alc_subsystem_id()
797 ass != codec->bus->pci->subsystem_device && (ass & 1)) in alc_subsystem_id()
810 if (codec->core.vendor_id == 0x10ec0260) in alc_subsystem_id()
812 ass = snd_hda_codec_get_pincfg(codec, nid); in alc_subsystem_id()
813 codec_dbg(codec, in alc_subsystem_id()
830 codec_dbg(codec, "realtek: Enabling init ASM_ID=0x%04x CODEC_ID=%08x\n", in alc_subsystem_id()
831 ass & 0xffff, codec->core.vendor_id); in alc_subsystem_id()
843 alc_setup_gpio(codec, 0x01); in alc_subsystem_id()
846 alc_setup_gpio(codec, 0x02); in alc_subsystem_id()
849 alc_setup_gpio(codec, 0x04); in alc_subsystem_id()
884 static void alc_ssid_check(struct hda_codec *codec, const hda_nid_t *ports) in alc_ssid_check() argument
886 if (!alc_subsystem_id(codec, ports)) { in alc_ssid_check()
887 struct alc_spec *spec = codec->spec; in alc_ssid_check()
889 codec_dbg(codec, in alc_ssid_check()
897 static void alc_fixup_inv_dmic(struct hda_codec *codec, in alc_fixup_inv_dmic() argument
900 struct alc_spec *spec = codec->spec; in alc_fixup_inv_dmic()
906 static int alc_build_controls(struct hda_codec *codec) in alc_build_controls() argument
910 err = snd_hda_gen_build_controls(codec); in alc_build_controls()
914 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_BUILD); in alc_build_controls()
923 static void alc_pre_init(struct hda_codec *codec) in alc_pre_init() argument
925 alc_fill_eapd_coef(codec); in alc_pre_init()
928 #define is_s3_resume(codec) \ argument
929 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESUME)
930 #define is_s4_resume(codec) \ argument
931 ((codec)->core.dev.power.power_state.event == PM_EVENT_RESTORE)
932 #define is_s4_suspend(codec) \ argument
933 ((codec)->core.dev.power.power_state.event == PM_EVENT_FREEZE)
935 static int alc_init(struct hda_codec *codec) in alc_init() argument
937 struct alc_spec *spec = codec->spec; in alc_init()
940 if (is_s4_resume(codec)) in alc_init()
941 alc_pre_init(codec); in alc_init()
944 spec->init_hook(codec); in alc_init()
947 snd_hda_gen_init(codec); in alc_init()
948 alc_fix_pll(codec); in alc_init()
949 alc_auto_init_amp(codec, spec->init_amp); in alc_init()
950 snd_hda_apply_verbs(codec); /* apply verbs here after own init */ in alc_init()
952 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in alc_init()
960 static void alc_free(struct hda_codec *codec) in alc_free() argument
962 struct alc_spec *spec = codec->spec; in alc_free()
967 snd_hda_gen_free(codec); in alc_free()
970 static inline void alc_shutup(struct hda_codec *codec) in alc_shutup() argument
972 struct alc_spec *spec = codec->spec; in alc_shutup()
974 if (!snd_hda_get_bool_hint(codec, "shutup")) in alc_shutup()
978 spec->shutup(codec); in alc_shutup()
980 alc_shutup_pins(codec); in alc_shutup()
983 static void alc_power_eapd(struct hda_codec *codec) in alc_power_eapd() argument
985 alc_auto_setup_eapd(codec, false); in alc_power_eapd()
988 static int alc_suspend(struct hda_codec *codec) in alc_suspend() argument
990 struct alc_spec *spec = codec->spec; in alc_suspend()
991 alc_shutup(codec); in alc_suspend()
993 spec->power_hook(codec); in alc_suspend()
997 static int alc_resume(struct hda_codec *codec) in alc_resume() argument
999 struct alc_spec *spec = codec->spec; in alc_resume()
1003 codec->patch_ops.init(codec); in alc_resume()
1004 snd_hda_regmap_sync(codec); in alc_resume()
1005 hda_call_check_power_status(codec, 0x01); in alc_resume()
1023 #define alc_codec_rename(codec, name) snd_hda_codec_set_name(codec, name) argument
1094 static int alc_codec_rename_from_preset(struct hda_codec *codec) in alc_codec_rename_from_preset() argument
1100 if (p->vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1102 if ((alc_get_coef0(codec) & p->coef_mask) == p->coef_bits) in alc_codec_rename_from_preset()
1103 return alc_codec_rename(codec, p->name); in alc_codec_rename_from_preset()
1106 if (!codec->bus->pci) in alc_codec_rename_from_preset()
1109 if (q->codec_vendor_id != codec->core.vendor_id) in alc_codec_rename_from_preset()
1111 if (q->pci_subvendor != codec->bus->pci->subsystem_vendor) in alc_codec_rename_from_preset()
1114 q->pci_subdevice == codec->bus->pci->subsystem_device) in alc_codec_rename_from_preset()
1115 return alc_codec_rename(codec, q->name); in alc_codec_rename_from_preset()
1167 static inline int has_cdefine_beep(struct hda_codec *codec) in has_cdefine_beep() argument
1169 struct alc_spec *spec = codec->spec; in has_cdefine_beep()
1171 q = snd_pci_quirk_lookup(codec->bus->pci, beep_allow_list); in has_cdefine_beep()
1178 #define has_cdefine_beep(codec) 0 argument
1185 static int alc_parse_auto_config(struct hda_codec *codec, in alc_parse_auto_config() argument
1189 struct alc_spec *spec = codec->spec; in alc_parse_auto_config()
1193 err = snd_hda_parse_pin_defcfg(codec, cfg, ignore_nids, in alc_parse_auto_config()
1199 alc_ssid_check(codec, ssid_nids); in alc_parse_auto_config()
1201 err = snd_hda_gen_parse_auto_config(codec, cfg); in alc_parse_auto_config()
1209 static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid) in alc_alloc_spec() argument
1216 codec->spec = spec; in alc_alloc_spec()
1220 codec->single_adc_amp = 1; in alc_alloc_spec()
1221 /* FIXME: do we need this for all Realtek codec models? */ in alc_alloc_spec()
1222 codec->spdif_status_reset = 1; in alc_alloc_spec()
1223 codec->forced_resume = 1; in alc_alloc_spec()
1224 codec->patch_ops = alc_patch_ops; in alc_alloc_spec()
1227 err = alc_codec_rename_from_preset(codec); in alc_alloc_spec()
1235 static int alc880_parse_auto_config(struct hda_codec *codec) in alc880_parse_auto_config() argument
1239 return alc_parse_auto_config(codec, alc880_ignore, alc880_ssids); in alc880_parse_auto_config()
1274 static void alc880_fixup_vol_knob(struct hda_codec *codec, in alc880_fixup_vol_knob() argument
1278 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc880_fixup_vol_knob()
1657 static int patch_alc880(struct hda_codec *codec) in patch_alc880() argument
1662 err = alc_alloc_spec(codec, 0x0b); in patch_alc880()
1666 spec = codec->spec; in patch_alc880()
1670 codec->patch_ops.unsol_event = alc880_unsol_event; in patch_alc880()
1672 alc_pre_init(codec); in patch_alc880()
1674 snd_hda_pick_fixup(codec, alc880_fixup_models, alc880_fixup_tbl, in patch_alc880()
1676 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc880()
1679 err = alc880_parse_auto_config(codec); in patch_alc880()
1689 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc880()
1694 alc_free(codec); in patch_alc880()
1702 static int alc260_parse_auto_config(struct hda_codec *codec) in alc260_parse_auto_config() argument
1706 return alc_parse_auto_config(codec, alc260_ignore, alc260_ssids); in alc260_parse_auto_config()
1726 static void alc260_gpio1_automute(struct hda_codec *codec) in alc260_gpio1_automute() argument
1728 struct alc_spec *spec = codec->spec; in alc260_gpio1_automute()
1730 alc_update_gpio_data(codec, 0x01, spec->gen.hp_jack_present); in alc260_gpio1_automute()
1733 static void alc260_fixup_gpio1_toggle(struct hda_codec *codec, in alc260_fixup_gpio1_toggle() argument
1736 struct alc_spec *spec = codec->spec; in alc260_fixup_gpio1_toggle()
1745 snd_hda_jack_detect_enable_callback(codec, 0x0f, in alc260_fixup_gpio1_toggle()
1747 alc_setup_gpio(codec, 0x01); in alc260_fixup_gpio1_toggle()
1751 static void alc260_fixup_kn1(struct hda_codec *codec, in alc260_fixup_kn1() argument
1754 struct alc_spec *spec = codec->spec; in alc260_fixup_kn1()
1773 snd_hda_apply_pincfgs(codec, pincfgs); in alc260_fixup_kn1()
1779 static void alc260_fixup_fsc_s7020(struct hda_codec *codec, in alc260_fixup_fsc_s7020() argument
1782 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020()
1787 static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec, in alc260_fixup_fsc_s7020_jwse() argument
1790 struct alc_spec *spec = codec->spec; in alc260_fixup_fsc_s7020_jwse()
1906 static int patch_alc260(struct hda_codec *codec) in patch_alc260() argument
1911 err = alc_alloc_spec(codec, 0x07); in patch_alc260()
1915 spec = codec->spec; in patch_alc260()
1925 alc_pre_init(codec); in patch_alc260()
1927 snd_hda_pick_fixup(codec, alc260_fixup_models, alc260_fixup_tbl, in patch_alc260()
1929 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc260()
1932 err = alc260_parse_auto_config(codec); in patch_alc260()
1942 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc260()
1947 alc_free(codec); in patch_alc260()
2012 static void alc889_fixup_coef(struct hda_codec *codec, in alc889_fixup_coef() argument
2017 alc_update_coef_idx(codec, 7, 0, 0x2030); in alc889_fixup_coef()
2021 static void alc885_fixup_macpro_gpio(struct hda_codec *codec, in alc885_fixup_macpro_gpio() argument
2024 struct alc_spec *spec = codec->spec; in alc885_fixup_macpro_gpio()
2027 alc_fixup_gpio3(codec, fix, action); in alc885_fixup_macpro_gpio()
2034 static void alc889_fixup_dac_route(struct hda_codec *codec, in alc889_fixup_dac_route() argument
2041 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2042 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc889_fixup_dac_route()
2043 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2044 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn2), conn2); in alc889_fixup_dac_route()
2048 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2049 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2050 snd_hda_override_conn_list(codec, 0x18, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2051 snd_hda_override_conn_list(codec, 0x1a, ARRAY_SIZE(conn), conn); in alc889_fixup_dac_route()
2056 static void alc889_fixup_mbp_vref(struct hda_codec *codec, in alc889_fixup_mbp_vref() argument
2060 struct alc_spec *spec = codec->spec; in alc889_fixup_mbp_vref()
2066 unsigned int val = snd_hda_codec_get_pincfg(codec, nids[i]); in alc889_fixup_mbp_vref()
2069 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mbp_vref()
2071 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mbp_vref()
2077 static void alc889_fixup_mac_pins(struct hda_codec *codec, in alc889_fixup_mac_pins() argument
2080 struct alc_spec *spec = codec->spec; in alc889_fixup_mac_pins()
2085 val = snd_hda_codec_get_pin_target(codec, nids[i]); in alc889_fixup_mac_pins()
2087 snd_hda_set_pin_ctl(codec, nids[i], val); in alc889_fixup_mac_pins()
2093 static void alc889_fixup_imac91_vref(struct hda_codec *codec, in alc889_fixup_imac91_vref() argument
2099 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_imac91_vref()
2103 static void alc889_fixup_mba11_vref(struct hda_codec *codec, in alc889_fixup_mba11_vref() argument
2109 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba11_vref()
2113 static void alc889_fixup_mba21_vref(struct hda_codec *codec, in alc889_fixup_mba21_vref() argument
2119 alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids)); in alc889_fixup_mba21_vref()
2126 static void alc882_fixup_no_primary_hp(struct hda_codec *codec, in alc882_fixup_no_primary_hp() argument
2129 struct alc_spec *spec = codec->spec; in alc882_fixup_no_primary_hp()
2136 static void alc_fixup_bass_chmap(struct hda_codec *codec,
2139 /* For dual-codec configuration, we need to disable some features to avoid
2142 static void alc_fixup_dual_codecs(struct hda_codec *codec, in alc_fixup_dual_codecs() argument
2145 struct alc_spec *spec = codec->spec; in alc_fixup_dual_codecs()
2157 codec->force_pin_prefix = 1; in alc_fixup_dual_codecs()
2160 static void rename_ctl(struct hda_codec *codec, const char *oldname, in rename_ctl() argument
2165 kctl = snd_hda_find_mixer_ctl(codec, oldname); in rename_ctl()
2167 snd_ctl_rename(codec->card, kctl, newname); in rename_ctl()
2170 static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec, in alc1220_fixup_gb_dual_codecs() argument
2174 alc_fixup_dual_codecs(codec, fix, action); in alc1220_fixup_gb_dual_codecs()
2178 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs"); in alc1220_fixup_gb_dual_codecs()
2181 /* rename Capture controls depending on the codec */ in alc1220_fixup_gb_dual_codecs()
2182 rename_ctl(codec, "Capture Volume", in alc1220_fixup_gb_dual_codecs()
2183 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2186 rename_ctl(codec, "Capture Switch", in alc1220_fixup_gb_dual_codecs()
2187 codec->addr == 0 ? in alc1220_fixup_gb_dual_codecs()
2194 static void alc1220_fixup_gb_x570(struct hda_codec *codec, in alc1220_fixup_gb_x570() argument
2209 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2210 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_gb_x570()
2213 alc_process_coef_fw(codec, gb_x570_coefs); in alc1220_fixup_gb_x570()
2218 static void alc1220_fixup_clevo_p950(struct hda_codec *codec, in alc1220_fixup_clevo_p950() argument
2227 alc_update_coef_idx(codec, 0x7, 0, 0x3c3); in alc1220_fixup_clevo_p950()
2231 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2232 snd_hda_override_conn_list(codec, 0x1b, ARRAY_SIZE(conn1), conn1); in alc1220_fixup_clevo_p950()
2235 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec,
2238 static void alc1220_fixup_clevo_pb51ed(struct hda_codec *codec, in alc1220_fixup_clevo_pb51ed() argument
2242 alc1220_fixup_clevo_p950(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2243 alc_fixup_headset_mode_no_hp_mic(codec, fix, action); in alc1220_fixup_clevo_pb51ed()
2246 static void alc887_asus_hp_automute_hook(struct hda_codec *codec, in alc887_asus_hp_automute_hook() argument
2249 struct alc_spec *spec = codec->spec; in alc887_asus_hp_automute_hook()
2252 snd_hda_gen_hp_automute(codec, jack); in alc887_asus_hp_automute_hook()
2258 snd_hda_set_pin_ctl(codec, 0x19, PIN_HP | vref); in alc887_asus_hp_automute_hook()
2261 static void alc887_fixup_asus_jack(struct hda_codec *codec, in alc887_fixup_asus_jack() argument
2264 struct alc_spec *spec = codec->spec; in alc887_fixup_asus_jack()
2267 snd_hda_set_pin_ctl_cache(codec, 0x1b, PIN_HP); in alc887_fixup_asus_jack()
2438 * codec replicate the sum signal to both channels,
2614 /* All Apple entries are in codec SSIDs */
2757 static int alc882_parse_auto_config(struct hda_codec *codec) in alc882_parse_auto_config() argument
2761 return alc_parse_auto_config(codec, alc882_ignore, alc882_ssids); in alc882_parse_auto_config()
2766 static int patch_alc882(struct hda_codec *codec) in patch_alc882() argument
2771 err = alc_alloc_spec(codec, 0x0b); in patch_alc882()
2775 spec = codec->spec; in patch_alc882()
2777 switch (codec->core.vendor_id) { in patch_alc882()
2786 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc882()
2790 alc_pre_init(codec); in patch_alc882()
2792 snd_hda_pick_fixup(codec, alc882_fixup_models, alc882_fixup_tbl, in patch_alc882()
2794 snd_hda_pick_pin_fixup(codec, alc882_pin_fixup_tbl, alc882_fixups, true); in patch_alc882()
2795 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc882()
2797 alc_auto_parse_customize_define(codec); in patch_alc882()
2799 if (has_cdefine_beep(codec)) in patch_alc882()
2803 err = alc882_parse_auto_config(codec); in patch_alc882()
2813 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc882()
2818 alc_free(codec); in patch_alc882()
2826 static int alc262_parse_auto_config(struct hda_codec *codec) in alc262_parse_auto_config() argument
2830 return alc_parse_auto_config(codec, alc262_ignore, alc262_ssids); in alc262_parse_auto_config()
2945 static int patch_alc262(struct hda_codec *codec) in patch_alc262() argument
2950 err = alc_alloc_spec(codec, 0x0b); in patch_alc262()
2954 spec = codec->spec; in patch_alc262()
2963 alc_update_coefex_idx(codec, 0x1a, 7, 0, 0x80); in patch_alc262()
2965 alc_fix_pll_init(codec, 0x20, 0x0a, 10); in patch_alc262()
2967 alc_pre_init(codec); in patch_alc262()
2969 snd_hda_pick_fixup(codec, alc262_fixup_models, alc262_fixup_tbl, in patch_alc262()
2971 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc262()
2973 alc_auto_parse_customize_define(codec); in patch_alc262()
2975 if (has_cdefine_beep(codec)) in patch_alc262()
2979 err = alc262_parse_auto_config(codec); in patch_alc262()
2989 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc262()
2994 alc_free(codec); in patch_alc262()
3005 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in alc268_beep_switch_put() local
3009 mutex_lock(&codec->control_mutex); in alc268_beep_switch_put()
3018 mutex_unlock(&codec->control_mutex); in alc268_beep_switch_put()
3080 /* below is codec SSID since multiple Toshiba laptops have the
3090 static int alc268_parse_auto_config(struct hda_codec *codec) in alc268_parse_auto_config() argument
3093 return alc_parse_auto_config(codec, NULL, alc268_ssids); in alc268_parse_auto_config()
3098 static int patch_alc268(struct hda_codec *codec) in patch_alc268() argument
3104 err = alc_alloc_spec(codec, 0); in patch_alc268()
3108 spec = codec->spec; in patch_alc268()
3109 if (has_cdefine_beep(codec)) in patch_alc268()
3114 alc_pre_init(codec); in patch_alc268()
3116 snd_hda_pick_fixup(codec, alc268_fixup_models, alc268_fixup_tbl, alc268_fixups); in patch_alc268()
3117 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc268()
3120 err = alc268_parse_auto_config(codec); in patch_alc268()
3133 snd_hda_add_verbs(codec, alc268_beep_init_verbs); in patch_alc268()
3134 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) in patch_alc268()
3136 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, in patch_alc268()
3143 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc268()
3148 alc_free(codec); in patch_alc268()
3193 static int alc269_parse_auto_config(struct hda_codec *codec) in alc269_parse_auto_config() argument
3198 struct alc_spec *spec = codec->spec; in alc269_parse_auto_config()
3233 return alc_parse_auto_config(codec, alc269_ignore, ssids); in alc269_parse_auto_config()
3244 static void alc_headset_btn_callback(struct hda_codec *codec, in alc_headset_btn_callback() argument
3263 snd_hda_jack_set_button_state(codec, jack->nid, report); in alc_headset_btn_callback()
3266 static void alc_disable_headset_jack_key(struct hda_codec *codec) in alc_disable_headset_jack_key() argument
3268 struct alc_spec *spec = codec->spec; in alc_disable_headset_jack_key()
3273 switch (codec->core.vendor_id) { in alc_disable_headset_jack_key()
3281 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3282 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3283 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0); in alc_disable_headset_jack_key()
3290 alc_write_coef_idx(codec, 0x48, 0x0); in alc_disable_headset_jack_key()
3291 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0); in alc_disable_headset_jack_key()
3296 static void alc_enable_headset_jack_key(struct hda_codec *codec) in alc_enable_headset_jack_key() argument
3298 struct alc_spec *spec = codec->spec; in alc_enable_headset_jack_key()
3303 switch (codec->core.vendor_id) { in alc_enable_headset_jack_key()
3311 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3312 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3313 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8); in alc_enable_headset_jack_key()
3320 alc_write_coef_idx(codec, 0x48, 0xd011); in alc_enable_headset_jack_key()
3321 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045); in alc_enable_headset_jack_key()
3326 static void alc_fixup_headset_jack(struct hda_codec *codec, in alc_fixup_headset_jack() argument
3329 struct alc_spec *spec = codec->spec; in alc_fixup_headset_jack()
3335 snd_hda_jack_detect_enable_callback(codec, 0x55, in alc_fixup_headset_jack()
3340 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55, in alc_fixup_headset_jack()
3343 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack", in alc_fixup_headset_jack()
3347 alc_enable_headset_jack_key(codec); in alc_fixup_headset_jack()
3352 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) in alc269vb_toggle_power_output() argument
3354 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0); in alc269vb_toggle_power_output()
3357 static void alc269_shutup(struct hda_codec *codec) in alc269_shutup() argument
3359 struct alc_spec *spec = codec->spec; in alc269_shutup()
3362 alc269vb_toggle_power_output(codec, 0); in alc269_shutup()
3364 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_shutup()
3367 alc_shutup_pins(codec); in alc269_shutup()
3403 static void alc282_restore_default_value(struct hda_codec *codec) in alc282_restore_default_value() argument
3405 alc_process_coef_fw(codec, alc282_coefs); in alc282_restore_default_value()
3408 static void alc282_init(struct hda_codec *codec) in alc282_init() argument
3410 struct alc_spec *spec = codec->spec; in alc282_init()
3415 alc282_restore_default_value(codec); in alc282_init()
3419 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_init()
3420 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_init()
3424 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_init()
3429 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3435 snd_hda_codec_write(codec, hp_pin, 0, in alc282_init()
3442 alc_write_coef_idx(codec, 0x78, coef78); in alc282_init()
3445 static void alc282_shutup(struct hda_codec *codec) in alc282_shutup() argument
3447 struct alc_spec *spec = codec->spec; in alc282_shutup()
3453 alc269_shutup(codec); in alc282_shutup()
3457 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc282_shutup()
3458 coef78 = alc_read_coef_idx(codec, 0x78); in alc282_shutup()
3459 alc_write_coef_idx(codec, 0x78, 0x9004); in alc282_shutup()
3464 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3471 snd_hda_codec_write(codec, hp_pin, 0, in alc282_shutup()
3477 alc_auto_setup_eapd(codec, false); in alc282_shutup()
3478 alc_shutup_pins(codec); in alc282_shutup()
3479 alc_write_coef_idx(codec, 0x78, coef78); in alc282_shutup()
3519 static void alc283_restore_default_value(struct hda_codec *codec) in alc283_restore_default_value() argument
3521 alc_process_coef_fw(codec, alc283_coefs); in alc283_restore_default_value()
3524 static void alc283_init(struct hda_codec *codec) in alc283_init() argument
3526 struct alc_spec *spec = codec->spec; in alc283_init()
3530 alc283_restore_default_value(codec); in alc283_init()
3536 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_init()
3540 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_init()
3542 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3548 snd_hda_codec_write(codec, hp_pin, 0, in alc283_init()
3555 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc283_init()
3557 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_init()
3560 static void alc283_shutup(struct hda_codec *codec) in alc283_shutup() argument
3562 struct alc_spec *spec = codec->spec; in alc283_shutup()
3567 alc269_shutup(codec); in alc283_shutup()
3571 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc283_shutup()
3573 alc_write_coef_idx(codec, 0x43, 0x9004); in alc283_shutup()
3576 alc_write_coef_idx(codec, 0x06, 0x2100); in alc283_shutup()
3578 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3585 snd_hda_codec_write(codec, hp_pin, 0, in alc283_shutup()
3588 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc283_shutup()
3592 alc_auto_setup_eapd(codec, false); in alc283_shutup()
3593 alc_shutup_pins(codec); in alc283_shutup()
3594 alc_write_coef_idx(codec, 0x43, 0x9614); in alc283_shutup()
3597 static void alc256_init(struct hda_codec *codec) in alc256_init() argument
3599 struct alc_spec *spec = codec->spec; in alc256_init()
3604 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1); in alc256_init()
3605 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2); in alc256_init()
3606 alc_update_coef_idx(codec, 0x08, 7<<4, 0); in alc256_init()
3607 alc_update_coef_idx(codec, 0x3b, 1<<15, 0); in alc256_init()
3608 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc256_init()
3617 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_init()
3621 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_init()
3623 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3628 snd_hda_codec_write(codec, hp_pin, 0, in alc256_init()
3632 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc256_init()
3634 alc_update_coef_idx(codec, 0x46, 3 << 12, 0); in alc256_init()
3635 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */ in alc256_init()
3636 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15); in alc256_init()
3643 alc_write_coef_idx(codec, 0x36, 0x5757); in alc256_init()
3646 static void alc256_shutup(struct hda_codec *codec) in alc256_shutup() argument
3648 struct alc_spec *spec = codec->spec; in alc256_shutup()
3655 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc256_shutup()
3656 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc256_shutup()
3661 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3667 /* NOTE: call this before clearing the pin, otherwise codec stalls */ in alc256_shutup()
3669 * when booting with headset plugged. So skip setting it for the codec alc257 in alc256_shutup()
3672 alc_update_coef_idx(codec, 0x46, 0, 3 << 12); in alc256_shutup()
3675 snd_hda_codec_write(codec, hp_pin, 0, in alc256_shutup()
3681 alc_auto_setup_eapd(codec, false); in alc256_shutup()
3682 alc_shutup_pins(codec); in alc256_shutup()
3685 alc_update_coef_idx(codec, 0x03, 1<<1, 0); in alc256_shutup()
3686 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4); in alc256_shutup()
3687 alc_update_coef_idx(codec, 0x08, 3<<2, 0); in alc256_shutup()
3688 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15); in alc256_shutup()
3689 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc256_shutup()
3694 static void alc285_hp_init(struct hda_codec *codec) in alc285_hp_init() argument
3696 struct alc_spec *spec = codec->spec; in alc285_hp_init()
3701 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */ in alc285_hp_init()
3702 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */ in alc285_hp_init()
3703 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */ in alc285_hp_init()
3704 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */ in alc285_hp_init()
3705 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */ in alc285_hp_init()
3706 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0); in alc285_hp_init()
3707 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0); in alc285_hp_init()
3709 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc285_hp_init()
3712 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3716 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14); in alc285_hp_init()
3717 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0); in alc285_hp_init()
3720 snd_hda_codec_write(codec, hp_pin, 0, in alc285_hp_init()
3723 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */ in alc285_hp_init()
3724 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880); in alc285_hp_init()
3725 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049); in alc285_hp_init()
3726 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0); in alc285_hp_init()
3728 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */ in alc285_hp_init()
3729 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3732 val = alc_read_coefex_idx(codec, 0x58, 0x00); in alc285_hp_init()
3735 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */ in alc285_hp_init()
3736 alc_update_coef_idx(codec, 0x38, 1<<4, coef38); in alc285_hp_init()
3737 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d); in alc285_hp_init()
3738 alc_update_coef_idx(codec, 0x36, 3<<13, coef36); in alc285_hp_init()
3741 alc_update_coef_idx(codec, 0x4a, 1<<15, 0); in alc285_hp_init()
3744 static void alc225_init(struct hda_codec *codec) in alc225_init() argument
3746 struct alc_spec *spec = codec->spec; in alc225_init()
3751 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2); in alc225_init()
3752 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6); in alc225_init()
3753 alc_update_coef_idx(codec, 0x33, 1<<11, 0); in alc225_init()
3761 is_s3_resume(codec) || in alc225_init()
3762 is_s4_resume(codec)) { in alc225_init()
3763 alc285_hp_init(codec); in alc225_init()
3771 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_init()
3772 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_init()
3776 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */ in alc225_init()
3779 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3782 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3787 snd_hda_codec_write(codec, hp_pin, 0, in alc225_init()
3790 snd_hda_codec_write(codec, 0x16, 0, in alc225_init()
3794 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_init()
3795 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */ in alc225_init()
3799 static void alc225_shutup(struct hda_codec *codec) in alc225_shutup() argument
3801 struct alc_spec *spec = codec->spec; in alc225_shutup()
3808 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc225_shutup()
3809 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16); in alc225_shutup()
3812 alc_disable_headset_jack_key(codec); in alc225_shutup()
3814 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10); in alc225_shutup()
3818 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3821 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3827 snd_hda_codec_write(codec, hp_pin, 0, in alc225_shutup()
3830 snd_hda_codec_write(codec, 0x16, 0, in alc225_shutup()
3834 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0); in alc225_shutup()
3835 alc_enable_headset_jack_key(codec); in alc225_shutup()
3837 alc_auto_setup_eapd(codec, false); in alc225_shutup()
3838 alc_shutup_pins(codec); in alc225_shutup()
3841 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2); in alc225_shutup()
3842 alc_update_coef_idx(codec, 0x0e, 7<<6, 0); in alc225_shutup()
3843 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11); in alc225_shutup()
3844 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4); in alc225_shutup()
3849 static void alc222_init(struct hda_codec *codec) in alc222_init() argument
3851 struct alc_spec *spec = codec->spec; in alc222_init()
3860 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_init()
3861 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_init()
3867 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3870 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3875 snd_hda_codec_write(codec, hp_pin, 0, in alc222_init()
3878 snd_hda_codec_write(codec, 0x14, 0, in alc222_init()
3885 static void alc222_shutup(struct hda_codec *codec) in alc222_shutup() argument
3887 struct alc_spec *spec = codec->spec; in alc222_shutup()
3894 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc222_shutup()
3895 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14); in alc222_shutup()
3901 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3904 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3910 snd_hda_codec_write(codec, hp_pin, 0, in alc222_shutup()
3913 snd_hda_codec_write(codec, 0x14, 0, in alc222_shutup()
3918 alc_auto_setup_eapd(codec, false); in alc222_shutup()
3919 alc_shutup_pins(codec); in alc222_shutup()
3922 static void alc_default_init(struct hda_codec *codec) in alc_default_init() argument
3924 struct alc_spec *spec = codec->spec; in alc_default_init()
3933 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_init()
3938 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3943 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_init()
3949 static void alc_default_shutup(struct hda_codec *codec) in alc_default_shutup() argument
3951 struct alc_spec *spec = codec->spec; in alc_default_shutup()
3956 alc269_shutup(codec); in alc_default_shutup()
3960 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin); in alc_default_shutup()
3965 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3971 snd_hda_codec_write(codec, hp_pin, 0, in alc_default_shutup()
3976 alc_auto_setup_eapd(codec, false); in alc_default_shutup()
3977 alc_shutup_pins(codec); in alc_default_shutup()
3980 static void alc294_hp_init(struct hda_codec *codec) in alc294_hp_init() argument
3982 struct alc_spec *spec = codec->spec; in alc294_hp_init()
3989 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3995 snd_hda_codec_write(codec, hp_pin, 0, in alc294_hp_init()
3998 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */ in alc294_hp_init()
3999 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */ in alc294_hp_init()
4002 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4005 val = alc_read_coefex_idx(codec, 0x58, 0x01); in alc294_hp_init()
4008 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b); in alc294_hp_init()
4012 static void alc294_init(struct hda_codec *codec) in alc294_init() argument
4014 struct alc_spec *spec = codec->spec; in alc294_init()
4018 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) { in alc294_init()
4019 alc294_hp_init(codec); in alc294_init()
4022 alc_default_init(codec); in alc294_init()
4025 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg, in alc5505_coef_set() argument
4028 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_set()
4029 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */ in alc5505_coef_set()
4030 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */ in alc5505_coef_set()
4033 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg) in alc5505_coef_get() argument
4037 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1); in alc5505_coef_get()
4038 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4040 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0) in alc5505_coef_get()
4045 static void alc5505_dsp_halt(struct hda_codec *codec) in alc5505_dsp_halt() argument
4049 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */ in alc5505_dsp_halt()
4050 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */ in alc5505_dsp_halt()
4051 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */ in alc5505_dsp_halt()
4052 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */ in alc5505_dsp_halt()
4053 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */ in alc5505_dsp_halt()
4054 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */ in alc5505_dsp_halt()
4055 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */ in alc5505_dsp_halt()
4056 val = alc5505_coef_get(codec, 0x6220); in alc5505_dsp_halt()
4057 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */ in alc5505_dsp_halt()
4060 static void alc5505_dsp_back_from_halt(struct hda_codec *codec) in alc5505_dsp_back_from_halt() argument
4062 alc5505_coef_set(codec, 0x61b8, 0x04133302); in alc5505_dsp_back_from_halt()
4063 alc5505_coef_set(codec, 0x61b0, 0x00005b16); in alc5505_dsp_back_from_halt()
4064 alc5505_coef_set(codec, 0x61b4, 0x040a2b02); in alc5505_dsp_back_from_halt()
4065 alc5505_coef_set(codec, 0x6230, 0xf80d4011); in alc5505_dsp_back_from_halt()
4066 alc5505_coef_set(codec, 0x6220, 0x2002010f); in alc5505_dsp_back_from_halt()
4067 alc5505_coef_set(codec, 0x880c, 0x00000004); in alc5505_dsp_back_from_halt()
4070 static void alc5505_dsp_init(struct hda_codec *codec) in alc5505_dsp_init() argument
4074 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4075 alc5505_dsp_back_from_halt(codec); in alc5505_dsp_init()
4076 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */ in alc5505_dsp_init()
4077 alc5505_coef_set(codec, 0x61b0, 0x5b16); in alc5505_dsp_init()
4078 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */ in alc5505_dsp_init()
4079 alc5505_coef_set(codec, 0x61b4, 0x04132b02); in alc5505_dsp_init()
4080 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/ in alc5505_dsp_init()
4081 alc5505_coef_set(codec, 0x61b8, 0x041f3302); in alc5505_dsp_init()
4082 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */ in alc5505_dsp_init()
4083 alc5505_coef_set(codec, 0x61b8, 0x041b3302); in alc5505_dsp_init()
4084 alc5505_coef_set(codec, 0x61b8, 0x04173302); in alc5505_dsp_init()
4085 alc5505_coef_set(codec, 0x61b8, 0x04163302); in alc5505_dsp_init()
4086 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */ in alc5505_dsp_init()
4087 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */ in alc5505_dsp_init()
4088 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */ in alc5505_dsp_init()
4090 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */ in alc5505_dsp_init()
4092 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */ in alc5505_dsp_init()
4094 alc5505_coef_set(codec, 0x6220, 0x6002018f); in alc5505_dsp_init()
4096 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/ in alc5505_dsp_init()
4097 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */ in alc5505_dsp_init()
4098 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */ in alc5505_dsp_init()
4099 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */ in alc5505_dsp_init()
4100 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */ in alc5505_dsp_init()
4101 alc5505_coef_set(codec, 0x880c, 0x00000003); in alc5505_dsp_init()
4102 alc5505_coef_set(codec, 0x880c, 0x00000010); in alc5505_dsp_init()
4105 alc5505_dsp_halt(codec); in alc5505_dsp_init()
4110 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */ argument
4111 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */ argument
4113 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec) argument
4114 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec) argument
4117 static int alc269_suspend(struct hda_codec *codec) in alc269_suspend() argument
4119 struct alc_spec *spec = codec->spec; in alc269_suspend()
4122 alc5505_dsp_suspend(codec); in alc269_suspend()
4124 return alc_suspend(codec); in alc269_suspend()
4127 static int alc269_resume(struct hda_codec *codec) in alc269_resume() argument
4129 struct alc_spec *spec = codec->spec; in alc269_resume()
4132 alc269vb_toggle_power_output(codec, 0); in alc269_resume()
4134 (alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_resume()
4138 codec->patch_ops.init(codec); in alc269_resume()
4141 alc269vb_toggle_power_output(codec, 1); in alc269_resume()
4143 (alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_resume()
4147 snd_hda_regmap_sync(codec); in alc269_resume()
4148 hda_call_check_power_status(codec, 0x01); in alc269_resume()
4150 /* on some machine, the BIOS will clear the codec gpio data when enter in alc269_resume()
4155 alc_write_gpio_data(codec); in alc269_resume()
4158 alc5505_dsp_resume(codec); in alc269_resume()
4163 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec, in alc269_fixup_pincfg_no_hp_to_lineout() argument
4166 struct alc_spec *spec = codec->spec; in alc269_fixup_pincfg_no_hp_to_lineout()
4172 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec, in alc269_fixup_pincfg_U7x7_headset_mic() argument
4176 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21); in alc269_fixup_pincfg_U7x7_headset_mic()
4177 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19); in alc269_fixup_pincfg_U7x7_headset_mic()
4180 snd_hda_codec_set_pincfg(codec, 0x19, in alc269_fixup_pincfg_U7x7_headset_mic()
4185 static void alc269_fixup_hweq(struct hda_codec *codec, in alc269_fixup_hweq() argument
4189 alc_update_coef_idx(codec, 0x1e, 0, 0x80); in alc269_fixup_hweq()
4192 static void alc269_fixup_headset_mic(struct hda_codec *codec, in alc269_fixup_headset_mic() argument
4195 struct alc_spec *spec = codec->spec; in alc269_fixup_headset_mic()
4201 static void alc271_fixup_dmic(struct hda_codec *codec, in alc271_fixup_dmic() argument
4211 if (strcmp(codec->core.chip_name, "ALC271X") && in alc271_fixup_dmic()
4212 strcmp(codec->core.chip_name, "ALC269VB")) in alc271_fixup_dmic()
4214 cfg = snd_hda_codec_get_pincfg(codec, 0x12); in alc271_fixup_dmic()
4216 snd_hda_sequence_write(codec, verbs); in alc271_fixup_dmic()
4220 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec, in alc269vb_fixup_aspire_e1_coef() argument
4225 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000); in alc269vb_fixup_aspire_e1_coef()
4228 static void alc269_fixup_pcm_44k(struct hda_codec *codec, in alc269_fixup_pcm_44k() argument
4231 struct alc_spec *spec = codec->spec; in alc269_fixup_pcm_44k()
4243 static void alc269_fixup_stereo_dmic(struct hda_codec *codec, in alc269_fixup_stereo_dmic() argument
4252 alc_update_coef_idx(codec, 0x07, 0, 0x80); in alc269_fixup_stereo_dmic()
4255 static void alc269_quanta_automute(struct hda_codec *codec) in alc269_quanta_automute() argument
4257 snd_hda_gen_update_outputs(codec); in alc269_quanta_automute()
4259 alc_write_coef_idx(codec, 0x0c, 0x680); in alc269_quanta_automute()
4260 alc_write_coef_idx(codec, 0x0c, 0x480); in alc269_quanta_automute()
4263 static void alc269_fixup_quanta_mute(struct hda_codec *codec, in alc269_fixup_quanta_mute() argument
4266 struct alc_spec *spec = codec->spec; in alc269_fixup_quanta_mute()
4272 static void alc269_x101_hp_automute_hook(struct hda_codec *codec, in alc269_x101_hp_automute_hook() argument
4275 struct alc_spec *spec = codec->spec; in alc269_x101_hp_automute_hook()
4278 snd_hda_gen_hp_automute(codec, jack); in alc269_x101_hp_automute_hook()
4282 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4285 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc269_x101_hp_automute_hook()
4297 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec, in alc298_huawei_mbx_stereo_seq() argument
4301 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0); in alc298_huawei_mbx_stereo_seq()
4302 alc_write_coef_idx(codec, 0x26, 0xb000); in alc298_huawei_mbx_stereo_seq()
4305 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0); in alc298_huawei_mbx_stereo_seq()
4307 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_huawei_mbx_stereo_seq()
4308 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_huawei_mbx_stereo_seq()
4309 alc_write_coef_idx(codec, 0x23, initval->value_0x23); in alc298_huawei_mbx_stereo_seq()
4312 alc_write_coef_idx(codec, 0x25, initval->value_0x25); in alc298_huawei_mbx_stereo_seq()
4314 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_huawei_mbx_stereo_seq()
4315 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_huawei_mbx_stereo_seq()
4318 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec, in alc298_fixup_huawei_mbx_stereo() argument
4342 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00); in alc298_fixup_huawei_mbx_stereo()
4343 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80); in alc298_fixup_huawei_mbx_stereo()
4344 alc_write_coef_idx(codec, 0x26, 0xf000); in alc298_fixup_huawei_mbx_stereo()
4345 alc_write_coef_idx(codec, 0x22, 0x31); in alc298_fixup_huawei_mbx_stereo()
4346 alc_write_coef_idx(codec, 0x23, 0x0b); in alc298_fixup_huawei_mbx_stereo()
4347 alc_write_coef_idx(codec, 0x25, 0x00); in alc298_fixup_huawei_mbx_stereo()
4348 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26); in alc298_fixup_huawei_mbx_stereo()
4349 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010); in alc298_fixup_huawei_mbx_stereo()
4352 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init); in alc298_fixup_huawei_mbx_stereo()
4355 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec, in alc269_fixup_x101_headset_mic() argument
4358 struct alc_spec *spec = codec->spec; in alc269_fixup_x101_headset_mic()
4365 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin, in alc_update_vref_led() argument
4374 pinval = snd_hda_codec_get_pin_target(codec, pin); in alc_update_vref_led()
4378 snd_hda_power_up_pm(codec); in alc_update_vref_led()
4379 snd_hda_set_pin_ctl_cache(codec, pin, pinval); in alc_update_vref_led()
4380 snd_hda_power_down_pm(codec); in alc_update_vref_led()
4387 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_mute_led_set() local
4388 struct alc_spec *spec = codec->spec; in vref_mute_led_set()
4390 alc_update_vref_led(codec, spec->mute_led_nid, in vref_mute_led_set()
4396 static unsigned int led_power_filter(struct hda_codec *codec, in led_power_filter() argument
4400 struct alc_spec *spec = codec->spec; in led_power_filter()
4407 snd_hda_set_pin_ctl(codec, nid, in led_power_filter()
4408 snd_hda_codec_get_pin_target(codec, nid)); in led_power_filter()
4410 return snd_hda_gen_path_power_filter(codec, nid, power_state); in led_power_filter()
4413 static void alc269_fixup_hp_mute_led(struct hda_codec *codec, in alc269_fixup_hp_mute_led() argument
4416 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led()
4430 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led()
4431 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led()
4432 codec_dbg(codec, in alc269_fixup_hp_mute_led()
4439 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec, in alc269_fixup_hp_mute_led_micx() argument
4443 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_mute_led_micx()
4448 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set); in alc269_fixup_hp_mute_led_micx()
4449 codec->power_filter = led_power_filter; in alc269_fixup_hp_mute_led_micx()
4453 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic1() argument
4456 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18); in alc269_fixup_hp_mute_led_mic1()
4459 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic2() argument
4462 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19); in alc269_fixup_hp_mute_led_mic2()
4465 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec, in alc269_fixup_hp_mute_led_mic3() argument
4468 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b); in alc269_fixup_hp_mute_led_mic3()
4472 static void alc_update_gpio_led(struct hda_codec *codec, unsigned int mask, in alc_update_gpio_led() argument
4477 alc_update_gpio_data(codec, mask, !enabled); /* muted -> LED on */ in alc_update_gpio_led()
4484 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in gpio_mute_led_set() local
4485 struct alc_spec *spec = codec->spec; in gpio_mute_led_set()
4487 alc_update_gpio_led(codec, spec->gpio_mute_led_mask, in gpio_mute_led_set()
4496 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in micmute_led_set() local
4497 struct alc_spec *spec = codec->spec; in micmute_led_set()
4499 alc_update_gpio_led(codec, spec->gpio_mic_led_mask, in micmute_led_set()
4505 static void alc_fixup_hp_gpio_led(struct hda_codec *codec, in alc_fixup_hp_gpio_led() argument
4510 struct alc_spec *spec = codec->spec; in alc_fixup_hp_gpio_led()
4512 alc_fixup_gpio(codec, action, mute_mask | micmute_mask); in alc_fixup_hp_gpio_led()
4518 snd_hda_gen_add_mute_led_cdev(codec, gpio_mute_led_set); in alc_fixup_hp_gpio_led()
4522 snd_hda_gen_add_micmute_led_cdev(codec, micmute_led_set); in alc_fixup_hp_gpio_led()
4526 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec, in alc236_fixup_hp_gpio_led() argument
4529 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01); in alc236_fixup_hp_gpio_led()
4532 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_led() argument
4535 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc269_fixup_hp_gpio_led()
4538 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_led() argument
4541 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01); in alc285_fixup_hp_gpio_led()
4544 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec, in alc286_fixup_hp_gpio_led() argument
4547 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20); in alc286_fixup_hp_gpio_led()
4550 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec, in alc287_fixup_hp_gpio_led() argument
4553 alc_fixup_hp_gpio_led(codec, action, 0x10, 0); in alc287_fixup_hp_gpio_led()
4556 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec, in alc245_fixup_hp_gpio_led() argument
4559 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_gpio_led()
4563 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc245_fixup_hp_gpio_led()
4570 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in vref_micmute_led_set() local
4571 struct alc_spec *spec = codec->spec; in vref_micmute_led_set()
4573 alc_update_vref_led(codec, spec->cap_mute_led_nid, in vref_micmute_led_set()
4578 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_gpio_mic1_led() argument
4581 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_gpio_mic1_led()
4583 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc269_fixup_hp_gpio_mic1_led()
4591 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_gpio_mic1_led()
4592 codec->power_filter = led_power_filter; in alc269_fixup_hp_gpio_mic1_led()
4596 static void alc280_fixup_hp_gpio4(struct hda_codec *codec, in alc280_fixup_hp_gpio4() argument
4599 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio4()
4601 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_gpio4()
4604 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc280_fixup_hp_gpio4()
4605 codec->power_filter = led_power_filter; in alc280_fixup_hp_gpio4()
4612 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec, in alc245_fixup_hp_x360_amp() argument
4615 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_x360_amp()
4624 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_x360_amp()
4626 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_x360_amp()
4633 struct hda_codec *codec, in alc274_hp_envy_pcm_hook() argument
4639 alc_update_gpio_data(codec, 0x04, true); in alc274_hp_envy_pcm_hook()
4642 alc_update_gpio_data(codec, 0x04, false); in alc274_hp_envy_pcm_hook()
4647 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec, in alc274_fixup_hp_envy_gpio() argument
4651 struct alc_spec *spec = codec->spec; in alc274_fixup_hp_envy_gpio()
4660 static void alc_update_coef_led(struct hda_codec *codec, in alc_update_coef_led() argument
4667 alc_update_coef_idx(codec, led->idx, led->mask, in alc_update_coef_led()
4675 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_mute_led_set() local
4676 struct alc_spec *spec = codec->spec; in coef_mute_led_set()
4678 alc_update_coef_led(codec, &spec->mute_led_coef, in coef_mute_led_set()
4683 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc285_fixup_hp_mute_led_coefbit() argument
4687 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_mute_led_coefbit()
4695 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc285_fixup_hp_mute_led_coefbit()
4699 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit() argument
4703 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit()
4711 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit()
4715 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec, in alc236_fixup_hp_mute_led_coefbit2() argument
4718 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_mute_led_coefbit2()
4726 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc236_fixup_hp_mute_led_coefbit2()
4730 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_coefbit() argument
4734 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_coefbit()
4742 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_coefbit()
4746 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec, in alc245_fixup_hp_mute_led_v1_coefbit() argument
4750 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_mute_led_v1_coefbit()
4758 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc245_fixup_hp_mute_led_v1_coefbit()
4766 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in coef_micmute_led_set() local
4767 struct alc_spec *spec = codec->spec; in coef_micmute_led_set()
4769 alc_update_coef_led(codec, &spec->mic_led_coef, in coef_micmute_led_set()
4774 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_coef_micmute_led() argument
4777 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_coef_micmute_led()
4784 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc285_fixup_hp_coef_micmute_led()
4788 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec, in alc285_fixup_hp_gpio_micmute_led() argument
4791 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_gpio_micmute_led()
4795 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc285_fixup_hp_gpio_micmute_led()
4798 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec, in alc236_fixup_hp_coef_micmute_led() argument
4801 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_coef_micmute_led()
4808 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set); in alc236_fixup_hp_coef_micmute_led()
4812 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec, in alc295_fixup_hp_mute_led_coefbit11() argument
4815 struct alc_spec *spec = codec->spec; in alc295_fixup_hp_mute_led_coefbit11()
4823 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set); in alc295_fixup_hp_mute_led_coefbit11()
4827 static void alc285_fixup_hp_mute_led(struct hda_codec *codec, in alc285_fixup_hp_mute_led() argument
4830 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_mute_led()
4831 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc285_fixup_hp_mute_led()
4834 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_mute_led() argument
4837 alc285_fixup_hp_mute_led_coefbit(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4838 alc285_fixup_hp_gpio_micmute_led(codec, fix, action); in alc285_fixup_hp_spectre_x360_mute_led()
4841 static void alc236_fixup_hp_mute_led(struct hda_codec *codec, in alc236_fixup_hp_mute_led() argument
4844 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led()
4845 alc236_fixup_hp_coef_micmute_led(codec, fix, action); in alc236_fixup_hp_mute_led()
4848 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec, in alc236_fixup_hp_micmute_led_vref() argument
4851 struct alc_spec *spec = codec->spec; in alc236_fixup_hp_micmute_led_vref()
4855 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc236_fixup_hp_micmute_led_vref()
4856 codec->power_filter = led_power_filter; in alc236_fixup_hp_micmute_led_vref()
4860 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec, in alc236_fixup_hp_mute_led_micmute_vref() argument
4863 alc236_fixup_hp_mute_led_coefbit(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4864 alc236_fixup_hp_micmute_led_vref(codec, fix, action); in alc236_fixup_hp_mute_led_micmute_vref()
4867 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec, in alc298_samsung_write_coef_pack() argument
4870 alc_write_coef_idx(codec, 0x23, coefs[0]); in alc298_samsung_write_coef_pack()
4871 alc_write_coef_idx(codec, 0x25, coefs[1]); in alc298_samsung_write_coef_pack()
4872 alc_write_coef_idx(codec, 0x26, 0xb011); in alc298_samsung_write_coef_pack()
4880 static void alc298_fixup_samsung_amp(struct hda_codec *codec, in alc298_fixup_samsung_amp() argument
4899 alc_write_coef_idx(codec, 0x22, amps[i].nid); in alc298_fixup_samsung_amp()
4902 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]); in alc298_fixup_samsung_amp()
4905 alc298_samsung_write_coef_pack(codec, init_seq[j]); in alc298_fixup_samsung_amp()
4949 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec) in alc298_samsung_v2_enable_amps() argument
4951 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_enable_amps()
4958 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_enable_amps()
4960 alc298_samsung_write_coef_pack(codec, enable_seq[j]); in alc298_samsung_v2_enable_amps()
4961 codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n", in alc298_samsung_v2_enable_amps()
4966 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec) in alc298_samsung_v2_disable_amps() argument
4968 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_disable_amps()
4975 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_disable_amps()
4977 alc298_samsung_write_coef_pack(codec, disable_seq[j]); in alc298_samsung_v2_disable_amps()
4978 codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n", in alc298_samsung_v2_disable_amps()
4984 struct hda_codec *codec, in alc298_samsung_v2_playback_hook() argument
4990 alc298_samsung_v2_enable_amps(codec); in alc298_samsung_v2_playback_hook()
4992 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_playback_hook()
4995 static void alc298_samsung_v2_init_amps(struct hda_codec *codec, in alc298_samsung_v2_init_amps() argument
4998 struct alc_spec *spec = codec->spec; in alc298_samsung_v2_init_amps()
5005 alc298_samsung_v2_disable_amps(codec); in alc298_samsung_v2_init_amps()
5009 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid); in alc298_samsung_v2_init_amps()
5011 alc298_samsung_write_coef_pack(codec, in alc298_samsung_v2_init_amps()
5014 alc_write_coef_idx(codec, 0x89, 0x0); in alc298_samsung_v2_init_amps()
5015 codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n", in alc298_samsung_v2_init_amps()
5023 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_2_amps() argument
5027 alc298_samsung_v2_init_amps(codec, 2); in alc298_fixup_samsung_amp_v2_2_amps()
5030 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec, in alc298_fixup_samsung_amp_v2_4_amps() argument
5034 alc298_samsung_v2_init_amps(codec, 4); in alc298_fixup_samsung_amp_v2_4_amps()
5037 static void gpio2_mic_hotkey_event(struct hda_codec *codec, in gpio2_mic_hotkey_event() argument
5040 struct alc_spec *spec = codec->spec; in gpio2_mic_hotkey_event()
5050 static int alc_register_micmute_input_device(struct hda_codec *codec) in alc_register_micmute_input_device() argument
5052 struct alc_spec *spec = codec->spec; in alc_register_micmute_input_device()
5057 codec_err(codec, "Out of memory (input_allocate_device)\n"); in alc_register_micmute_input_device()
5072 codec_err(codec, "input_register_device failed\n"); in alc_register_micmute_input_device()
5086 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec, in alc280_fixup_hp_gpio2_mic_hotkey() argument
5089 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_gpio2_mic_hotkey()
5091 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10); in alc280_fixup_hp_gpio2_mic_hotkey()
5094 if (alc_register_micmute_input_device(codec) != 0) in alc280_fixup_hp_gpio2_mic_hotkey()
5100 snd_hda_codec_write_cache(codec, codec->core.afg, 0, in alc280_fixup_hp_gpio2_mic_hotkey()
5102 snd_hda_jack_detect_enable_callback(codec, codec->core.afg, in alc280_fixup_hp_gpio2_mic_hotkey()
5120 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec, in alc233_fixup_lenovo_line2_mic_hotkey() argument
5123 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_line2_mic_hotkey()
5125 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc233_fixup_lenovo_line2_mic_hotkey()
5128 if (alc_register_micmute_input_device(codec) != 0) in alc233_fixup_lenovo_line2_mic_hotkey()
5131 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc233_fixup_lenovo_line2_mic_hotkey()
5146 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec, in alc269_fixup_hp_line1_mic1_led() argument
5149 struct alc_spec *spec = codec->spec; in alc269_fixup_hp_line1_mic1_led()
5151 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a); in alc269_fixup_hp_line1_mic1_led()
5154 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set); in alc269_fixup_hp_line1_mic1_led()
5158 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec, in alc233_fixup_lenovo_low_en_micmute_led() argument
5161 struct alc_spec *spec = codec->spec; in alc233_fixup_lenovo_low_en_micmute_led()
5165 alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action); in alc233_fixup_lenovo_low_en_micmute_led()
5168 static void alc_hp_mute_disable(struct hda_codec *codec, unsigned int delay) in alc_hp_mute_disable() argument
5172 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5175 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_mute_disable()
5180 static void alc_hp_enable_unmute(struct hda_codec *codec, unsigned int delay) in alc_hp_enable_unmute() argument
5184 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5187 snd_hda_codec_write(codec, 0x21, 0, in alc_hp_enable_unmute()
5203 static void alc_headset_mode_unplugged(struct hda_codec *codec) in alc_headset_mode_unplugged() argument
5205 struct alc_spec *spec = codec->spec; in alc_headset_mode_unplugged()
5281 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_headset_mode_unplugged()
5285 switch (codec->core.vendor_id) { in alc_headset_mode_unplugged()
5287 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_unplugged()
5293 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5294 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_unplugged()
5299 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_unplugged()
5303 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_unplugged()
5307 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5310 alc_process_coef_fw(codec, coef0298); in alc_headset_mode_unplugged()
5311 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_unplugged()
5314 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_unplugged()
5317 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_unplugged()
5320 alc_process_coef_fw(codec, coef0668); in alc_headset_mode_unplugged()
5328 alc_hp_mute_disable(codec, 75); in alc_headset_mode_unplugged()
5329 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_unplugged()
5330 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_unplugged()
5333 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_unplugged()
5336 codec_dbg(codec, "Headset jack set to unplugged mode.\n"); in alc_headset_mode_unplugged()
5340 static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, in alc_headset_mode_mic_in() argument
5400 switch (codec->core.vendor_id) { in alc_headset_mode_mic_in()
5402 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5403 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5404 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_mic_in()
5405 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5411 alc_write_coef_idx(codec, 0x45, 0xc489); in alc_headset_mode_mic_in()
5412 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5413 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_mic_in()
5414 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5419 alc_write_coef_idx(codec, 0x45, 0x4689); in alc_headset_mode_mic_in()
5420 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5421 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_mic_in()
5422 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5426 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5427 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5428 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_mic_in()
5429 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5434 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5435 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_mic_in()
5436 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5439 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5440 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_mic_in()
5444 alc_write_coef_idx(codec, 0x45, 0xc429); in alc_headset_mode_mic_in()
5445 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5446 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_mic_in()
5447 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5450 alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); in alc_headset_mode_mic_in()
5454 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5455 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5458 alc_write_coef_idx(codec, 0x11, 0x0001); in alc_headset_mode_mic_in()
5459 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5460 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_mic_in()
5461 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5469 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_mic_in()
5470 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x31<<10); in alc_headset_mode_mic_in()
5471 snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); in alc_headset_mode_mic_in()
5472 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_mic_in()
5473 snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); in alc_headset_mode_mic_in()
5476 codec_dbg(codec, "Headset jack set to mic-in mode.\n"); in alc_headset_mode_mic_in()
5479 static void alc_headset_mode_default(struct hda_codec *codec) in alc_headset_mode_default() argument
5545 switch (codec->core.vendor_id) { in alc_headset_mode_default()
5552 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_headset_mode_default()
5553 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_default()
5554 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5557 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_default()
5563 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_headset_mode_default()
5564 alc_write_coef_idx(codec, 0x45, 0xc089); in alc_headset_mode_default()
5566 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_default()
5567 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_default()
5572 alc_process_coef_fw(codec, coef0274); in alc_headset_mode_default()
5576 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_default()
5581 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_default()
5584 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_default()
5587 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_default()
5590 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_default()
5593 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_default()
5596 codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); in alc_headset_mode_default()
5600 static void alc_headset_mode_ctia(struct hda_codec *codec) in alc_headset_mode_ctia() argument
5656 switch (codec->core.vendor_id) { in alc_headset_mode_ctia()
5658 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_ctia()
5664 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_ctia()
5665 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5670 alc_write_coef_idx(codec, 0x45, 0xd689); in alc_headset_mode_ctia()
5674 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_ctia()
5677 val = alc_read_coef_idx(codec, 0x50); in alc_headset_mode_ctia()
5679 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_headset_mode_ctia()
5680 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5683 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_headset_mode_ctia()
5684 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5690 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xd400); in alc_headset_mode_ctia()
5692 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_ctia()
5695 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_ctia()
5698 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_ctia()
5701 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_ctia()
5709 val = alc_read_coef_idx(codec, 0x45); in alc_headset_mode_ctia()
5711 alc_process_coef_fw(codec, coef0225_2); in alc_headset_mode_ctia()
5713 alc_process_coef_fw(codec, coef0225_1); in alc_headset_mode_ctia()
5714 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_ctia()
5717 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_headset_mode_ctia()
5720 codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); in alc_headset_mode_ctia()
5724 static void alc_headset_mode_omtp(struct hda_codec *codec) in alc_headset_mode_omtp() argument
5773 switch (codec->core.vendor_id) { in alc_headset_mode_omtp()
5775 alc_process_coef_fw(codec, coef0255); in alc_headset_mode_omtp()
5781 alc_process_coef_fw(codec, coef0256); in alc_headset_mode_omtp()
5782 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5787 alc_write_coef_idx(codec, 0x45, 0xe689); in alc_headset_mode_omtp()
5791 alc_process_coef_fw(codec, coef0233); in alc_headset_mode_omtp()
5794 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010);/* Headset output enable */ in alc_headset_mode_omtp()
5795 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5800 alc_update_coef_idx(codec, 0x4f, 0xfcc0, 0xe400); in alc_headset_mode_omtp()
5802 alc_process_coef_fw(codec, coef0288); in alc_headset_mode_omtp()
5805 alc_process_coef_fw(codec, coef0292); in alc_headset_mode_omtp()
5808 alc_process_coef_fw(codec, coef0293); in alc_headset_mode_omtp()
5811 alc_process_coef_fw(codec, coef0688); in alc_headset_mode_omtp()
5819 alc_process_coef_fw(codec, coef0225); in alc_headset_mode_omtp()
5820 alc_hp_enable_unmute(codec, 75); in alc_headset_mode_omtp()
5823 codec_dbg(codec, "Headset jack set to Nokia-style headset mode.\n"); in alc_headset_mode_omtp()
5826 static void alc_determine_headset_type(struct hda_codec *codec) in alc_determine_headset_type() argument
5830 struct alc_spec *spec = codec->spec; in alc_determine_headset_type()
5870 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_determine_headset_type()
5874 switch (codec->core.vendor_id) { in alc_determine_headset_type()
5876 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5878 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5885 alc_write_coef_idx(codec, 0x1b, 0x0e4b); in alc_determine_headset_type()
5886 alc_write_coef_idx(codec, 0x06, 0x6104); in alc_determine_headset_type()
5887 alc_write_coefex_idx(codec, 0x57, 0x3, 0x09a3); in alc_determine_headset_type()
5889 alc_process_coef_fw(codec, coef0255); in alc_determine_headset_type()
5891 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5894 alc_write_coef_idx(codec, 0x45, 0xe089); in alc_determine_headset_type()
5896 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5902 alc_write_coefex_idx(codec, 0x57, 0x3, 0x0da3); in alc_determine_headset_type()
5903 alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); in alc_determine_headset_type()
5908 alc_process_coef_fw(codec, coef0274); in alc_determine_headset_type()
5910 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5915 alc_write_coef_idx(codec, 0x45, 0xd029); in alc_determine_headset_type()
5917 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5921 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5924 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5928 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5930 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0020); in alc_determine_headset_type()
5931 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5933 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5936 alc_update_coef_idx(codec, 0x8e, 0x0070, 0x0010); in alc_determine_headset_type()
5937 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5939 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5942 alc_process_coef_fw(codec, coef0298); in alc_determine_headset_type()
5943 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5946 snd_hda_codec_write(codec, 0x21, 0, in alc_determine_headset_type()
5951 alc_process_coef_fw(codec, coef0288); in alc_determine_headset_type()
5953 val = alc_read_coef_idx(codec, 0x50); in alc_determine_headset_type()
5957 alc_write_coef_idx(codec, 0x6b, 0xd429); in alc_determine_headset_type()
5959 val = alc_read_coef_idx(codec, 0x6c); in alc_determine_headset_type()
5963 alc_process_coef_fw(codec, coef0293); in alc_determine_headset_type()
5965 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5969 alc_process_coef_fw(codec, coef0688); in alc_determine_headset_type()
5971 val = alc_read_coef_idx(codec, 0xbe); in alc_determine_headset_type()
5980 alc_process_coef_fw(codec, alc225_pre_hsmode); in alc_determine_headset_type()
5981 alc_update_coef_idx(codec, 0x67, 0xf000, 0x1000); in alc_determine_headset_type()
5982 val = alc_read_coef_idx(codec, 0x45); in alc_determine_headset_type()
5984 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5985 alc_update_coef_idx(codec, 0x49, 3<<8, 2<<8); in alc_determine_headset_type()
5987 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5990 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x34<<10); in alc_determine_headset_type()
5991 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
5993 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
5997 alc_update_coef_idx(codec, 0x45, 0x3f<<10, 0x38<<10); in alc_determine_headset_type()
5998 alc_update_coef_idx(codec, 0x49, 3<<8, 1<<8); in alc_determine_headset_type()
6000 val = alc_read_coef_idx(codec, 0x46); in alc_determine_headset_type()
6006 alc_update_coef_idx(codec, 0x4a, 7<<6, 7<<6); in alc_determine_headset_type()
6007 alc_update_coef_idx(codec, 0x4a, 3<<4, 3<<4); in alc_determine_headset_type()
6008 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000); in alc_determine_headset_type()
6015 codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", in alc_determine_headset_type()
6020 static void alc_update_headset_mode(struct hda_codec *codec) in alc_update_headset_mode() argument
6022 struct alc_spec *spec = codec->spec; in alc_update_headset_mode()
6029 if (!snd_hda_jack_detect(codec, hp_pin)) in alc_update_headset_mode()
6039 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6045 alc_headset_mode_unplugged(codec); in alc_update_headset_mode()
6052 alc_determine_headset_type(codec); in alc_update_headset_mode()
6054 alc_headset_mode_ctia(codec); in alc_update_headset_mode()
6056 alc_headset_mode_omtp(codec); in alc_update_headset_mode()
6060 alc_headset_mode_mic_in(codec, hp_pin, spec->headphone_mic_pin); in alc_update_headset_mode()
6064 alc_headset_mode_default(codec); in alc_update_headset_mode()
6069 snd_hda_set_pin_ctl_cache(codec, hp_pin, in alc_update_headset_mode()
6072 snd_hda_set_pin_ctl_cache(codec, spec->headphone_mic_pin, in alc_update_headset_mode()
6077 snd_hda_gen_update_outputs(codec); in alc_update_headset_mode()
6080 static void alc_update_headset_mode_hook(struct hda_codec *codec, in alc_update_headset_mode_hook() argument
6084 alc_update_headset_mode(codec); in alc_update_headset_mode_hook()
6087 static void alc_update_headset_jack_cb(struct hda_codec *codec, in alc_update_headset_jack_cb() argument
6090 snd_hda_gen_hp_automute(codec, jack); in alc_update_headset_jack_cb()
6091 alc_update_headset_mode(codec); in alc_update_headset_jack_cb()
6094 static void alc_probe_headset_mode(struct hda_codec *codec) in alc_probe_headset_mode() argument
6097 struct alc_spec *spec = codec->spec; in alc_probe_headset_mode()
6114 static void alc_fixup_headset_mode(struct hda_codec *codec, in alc_fixup_headset_mode() argument
6117 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode()
6124 alc_probe_headset_mode(codec); in alc_fixup_headset_mode()
6127 if (is_s3_resume(codec) || is_s4_resume(codec)) { in alc_fixup_headset_mode()
6131 alc_update_headset_mode(codec); in alc_fixup_headset_mode()
6136 static void alc_fixup_headset_mode_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_no_hp_mic() argument
6140 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_no_hp_mic()
6144 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_no_hp_mic()
6147 static void alc255_set_default_jack_type(struct hda_codec *codec) in alc255_set_default_jack_type() argument
6166 switch (codec->core.vendor_id) { in alc255_set_default_jack_type()
6168 alc_process_coef_fw(codec, alc255fw); in alc255_set_default_jack_type()
6174 alc_process_coef_fw(codec, alc256fw); in alc255_set_default_jack_type()
6180 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec, in alc_fixup_headset_mode_alc255() argument
6184 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255()
6186 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255()
6189 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec, in alc_fixup_headset_mode_alc255_no_hp_mic() argument
6193 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc255_no_hp_mic()
6195 alc255_set_default_jack_type(codec); in alc_fixup_headset_mode_alc255_no_hp_mic()
6198 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc255_no_hp_mic()
6201 static void alc288_update_headset_jack_cb(struct hda_codec *codec, in alc288_update_headset_jack_cb() argument
6204 struct alc_spec *spec = codec->spec; in alc288_update_headset_jack_cb()
6206 alc_update_headset_jack_cb(codec, jack); in alc288_update_headset_jack_cb()
6208 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present); in alc288_update_headset_jack_cb()
6211 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec, in alc_fixup_headset_mode_dell_alc288() argument
6214 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_dell_alc288()
6216 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_dell_alc288()
6224 static void alc_fixup_auto_mute_via_amp(struct hda_codec *codec, in alc_fixup_auto_mute_via_amp() argument
6228 struct alc_spec *spec = codec->spec; in alc_fixup_auto_mute_via_amp()
6233 static void alc_fixup_no_shutup(struct hda_codec *codec, in alc_fixup_no_shutup() argument
6237 struct alc_spec *spec = codec->spec; in alc_fixup_no_shutup()
6242 static void alc_fixup_disable_aamix(struct hda_codec *codec, in alc_fixup_disable_aamix() argument
6246 struct alc_spec *spec = codec->spec; in alc_fixup_disable_aamix()
6253 static void alc_fixup_tpt440_dock(struct hda_codec *codec, in alc_fixup_tpt440_dock() argument
6261 struct alc_spec *spec = codec->spec; in alc_fixup_tpt440_dock()
6265 codec->power_save_node = 0; /* avoid click noises */ in alc_fixup_tpt440_dock()
6266 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt440_dock()
6270 static void alc_fixup_tpt470_dock(struct hda_codec *codec, in alc_fixup_tpt470_dock() argument
6278 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dock()
6282 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_tpt470_dock()
6285 snd_hda_codec_write(codec, 0x17, 0, in alc_fixup_tpt470_dock()
6288 snd_hda_codec_write(codec, 0x19, 0, in alc_fixup_tpt470_dock()
6293 static void alc_fixup_tpt470_dacs(struct hda_codec *codec, in alc_fixup_tpt470_dacs() argument
6298 * ALC298 codec in alc_fixup_tpt470_dacs()
6304 struct alc_spec *spec = codec->spec; in alc_fixup_tpt470_dacs()
6310 static void alc295_fixup_asus_dacs(struct hda_codec *codec, in alc295_fixup_asus_dacs() argument
6316 struct alc_spec *spec = codec->spec; in alc295_fixup_asus_dacs()
6322 static void alc_shutup_dell_xps13(struct hda_codec *codec) in alc_shutup_dell_xps13() argument
6324 struct alc_spec *spec = codec->spec; in alc_shutup_dell_xps13()
6328 snd_hda_codec_write(codec, hp_pin, 0, in alc_shutup_dell_xps13()
6333 static void alc_fixup_dell_xps13(struct hda_codec *codec, in alc_fixup_dell_xps13() argument
6336 struct alc_spec *spec = codec->spec; in alc_fixup_dell_xps13()
6345 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell_xps13()
6360 static void alc_fixup_headset_mode_alc662(struct hda_codec *codec, in alc_fixup_headset_mode_alc662() argument
6363 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mode_alc662()
6371 snd_hda_codec_write(codec, 0x1b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000); in alc_fixup_headset_mode_alc662()
6372 snd_hda_override_wcaps(codec, 0x1b, get_wcaps(codec, 0x1b) & ~AC_WCAP_IN_AMP); in alc_fixup_headset_mode_alc662()
6374 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc662()
6377 static void alc_fixup_headset_mode_alc668(struct hda_codec *codec, in alc_fixup_headset_mode_alc668() argument
6381 alc_write_coef_idx(codec, 0xc4, 0x8000); in alc_fixup_headset_mode_alc668()
6382 alc_update_coef_idx(codec, 0xc2, ~0xfe, 0); in alc_fixup_headset_mode_alc668()
6383 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc_fixup_headset_mode_alc668()
6385 alc_fixup_headset_mode(codec, fix, action); in alc_fixup_headset_mode_alc668()
6389 static int find_ext_mic_pin(struct hda_codec *codec) in find_ext_mic_pin() argument
6391 struct alc_spec *spec = codec->spec; in find_ext_mic_pin()
6401 defcfg = snd_hda_codec_get_pincfg(codec, nid); in find_ext_mic_pin()
6410 static void alc271_hp_gate_mic_jack(struct hda_codec *codec, in alc271_hp_gate_mic_jack() argument
6414 struct alc_spec *spec = codec->spec; in alc271_hp_gate_mic_jack()
6417 int mic_pin = find_ext_mic_pin(codec); in alc271_hp_gate_mic_jack()
6422 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin); in alc271_hp_gate_mic_jack()
6426 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec, in alc269_fixup_limit_int_mic_boost() argument
6430 struct alc_spec *spec = codec->spec; in alc269_fixup_limit_int_mic_boost()
6446 defcfg = snd_hda_codec_get_pincfg(codec, nid); in alc269_fixup_limit_int_mic_boost()
6450 snd_hda_override_amp_caps(codec, nid, HDA_INPUT, in alc269_fixup_limit_int_mic_boost()
6458 static void alc283_hp_automute_hook(struct hda_codec *codec, in alc283_hp_automute_hook() argument
6461 struct alc_spec *spec = codec->spec; in alc283_hp_automute_hook()
6465 snd_hda_gen_hp_automute(codec, jack); in alc283_hp_automute_hook()
6470 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc283_hp_automute_hook()
6474 static void alc283_fixup_chromebook(struct hda_codec *codec, in alc283_fixup_chromebook() argument
6477 struct alc_spec *spec = codec->spec; in alc283_fixup_chromebook()
6481 snd_hda_override_wcaps(codec, 0x03, 0); in alc283_fixup_chromebook()
6488 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_chromebook()
6490 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4); in alc283_fixup_chromebook()
6495 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec, in alc283_fixup_sense_combo_jack() argument
6498 struct alc_spec *spec = codec->spec; in alc283_fixup_sense_combo_jack()
6507 alc_update_coef_idx(codec, 0x06, 0x000c, 0); in alc283_fixup_sense_combo_jack()
6513 static void asus_tx300_automute(struct hda_codec *codec) in asus_tx300_automute() argument
6515 struct alc_spec *spec = codec->spec; in asus_tx300_automute()
6516 snd_hda_gen_update_outputs(codec); in asus_tx300_automute()
6517 if (snd_hda_jack_detect(codec, 0x1b)) in asus_tx300_automute()
6521 static void alc282_fixup_asus_tx300(struct hda_codec *codec, in alc282_fixup_asus_tx300() argument
6524 struct alc_spec *spec = codec->spec; in alc282_fixup_asus_tx300()
6534 alc_setup_gpio(codec, 0x04); in alc282_fixup_asus_tx300()
6535 snd_hda_apply_pincfgs(codec, dock_pins); in alc282_fixup_asus_tx300()
6538 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc282_fixup_asus_tx300()
6548 rename_ctl(codec, "Speaker Playback Switch", in alc282_fixup_asus_tx300()
6550 rename_ctl(codec, "Bass Speaker Playback Switch", in alc282_fixup_asus_tx300()
6556 static void alc290_fixup_mono_speakers(struct hda_codec *codec, in alc290_fixup_mono_speakers() argument
6564 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6565 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1); in alc290_fixup_mono_speakers()
6569 static void alc298_fixup_speaker_volume(struct hda_codec *codec, in alc298_fixup_speaker_volume() argument
6581 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1); in alc298_fixup_speaker_volume()
6586 static void alc295_fixup_disable_dac3(struct hda_codec *codec, in alc295_fixup_disable_dac3() argument
6591 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_disable_dac3()
6596 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec, in alc285_fixup_speaker2_to_dac1() argument
6601 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_speaker2_to_dac1()
6606 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec, in alc294_fixup_bass_speaker_15() argument
6611 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn); in alc294_fixup_bass_speaker_15()
6616 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec, in alc280_hp_gpio4_automute_hook() argument
6619 struct alc_spec *spec = codec->spec; in alc280_hp_gpio4_automute_hook()
6621 snd_hda_gen_hp_automute(codec, jack); in alc280_hp_gpio4_automute_hook()
6623 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity, in alc280_hp_gpio4_automute_hook()
6633 static void alc280_fixup_hp_9480m(struct hda_codec *codec, in alc280_fixup_hp_9480m() argument
6637 struct alc_spec *spec = codec->spec; in alc280_fixup_hp_9480m()
6639 alc_fixup_hp_gpio_led(codec, action, 0x08, 0); in alc280_fixup_hp_9480m()
6648 static void alc275_fixup_gpio4_off(struct hda_codec *codec, in alc275_fixup_gpio4_off() argument
6652 struct alc_spec *spec = codec->spec; in alc275_fixup_gpio4_off()
6667 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec, in alc285_fixup_thinkpad_x1_gen7() argument
6674 struct alc_spec *spec = codec->spec; in alc285_fixup_thinkpad_x1_gen7()
6678 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_thinkpad_x1_gen7()
6688 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6689 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume"); in alc285_fixup_thinkpad_x1_gen7()
6694 static void alc233_alc662_fixup_lenovo_dual_codecs(struct hda_codec *codec, in alc233_alc662_fixup_lenovo_dual_codecs() argument
6698 alc_fixup_dual_codecs(codec, fix, action); in alc233_alc662_fixup_lenovo_dual_codecs()
6702 strcpy(codec->card->longname, "HDAudio-Lenovo-DualCodecs"); in alc233_alc662_fixup_lenovo_dual_codecs()
6705 /* rename Capture controls depending on the codec */ in alc233_alc662_fixup_lenovo_dual_codecs()
6706 rename_ctl(codec, "Capture Volume", in alc233_alc662_fixup_lenovo_dual_codecs()
6707 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6710 rename_ctl(codec, "Capture Switch", in alc233_alc662_fixup_lenovo_dual_codecs()
6711 codec->addr == 0 ? in alc233_alc662_fixup_lenovo_dual_codecs()
6718 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec, in alc225_fixup_s3_pop_noise() argument
6724 codec->power_save_node = 1; in alc225_fixup_s3_pop_noise()
6728 static void alc274_fixup_bind_dacs(struct hda_codec *codec, in alc274_fixup_bind_dacs() argument
6731 struct alc_spec *spec = codec->spec; in alc274_fixup_bind_dacs()
6742 codec->power_save_node = 0; in alc274_fixup_bind_dacs()
6746 static void alc289_fixup_asus_ga401(struct hda_codec *codec, in alc289_fixup_asus_ga401() argument
6752 struct alc_spec *spec = codec->spec; in alc289_fixup_asus_ga401()
6759 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec, in alc285_fixup_invalidate_dacs() argument
6765 snd_hda_override_wcaps(codec, 0x03, 0); in alc285_fixup_invalidate_dacs()
6768 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec) in alc_combo_jack_hp_jd_restart() argument
6770 switch (codec->core.vendor_id) { in alc_combo_jack_hp_jd_restart()
6776 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6777 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6786 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */ in alc_combo_jack_hp_jd_restart()
6787 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15); in alc_combo_jack_hp_jd_restart()
6792 static void alc295_fixup_chromebook(struct hda_codec *codec, in alc295_fixup_chromebook() argument
6795 struct alc_spec *spec = codec->spec; in alc295_fixup_chromebook()
6802 alc_combo_jack_hp_jd_restart(codec); in alc295_fixup_chromebook()
6807 static void alc256_fixup_chromebook(struct hda_codec *codec, in alc256_fixup_chromebook() argument
6810 struct alc_spec *spec = codec->spec; in alc256_fixup_chromebook()
6821 static void alc_fixup_disable_mic_vref(struct hda_codec *codec, in alc_fixup_disable_mic_vref() argument
6825 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_disable_mic_vref()
6829 static void alc294_gx502_toggle_output(struct hda_codec *codec, in alc294_gx502_toggle_output() argument
6832 /* The Windows driver sets the codec up in a very different way where in alc294_gx502_toggle_output()
6835 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gx502_toggle_output()
6836 alc_write_coef_idx(codec, 0x10, 0x8a20); in alc294_gx502_toggle_output()
6838 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gx502_toggle_output()
6841 static void alc294_fixup_gx502_hp(struct hda_codec *codec, in alc294_fixup_gx502_hp() argument
6845 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gx502_hp()
6850 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gx502_hp()
6857 alc294_gx502_toggle_output(codec, NULL); in alc294_fixup_gx502_hp()
6862 static void alc294_gu502_toggle_output(struct hda_codec *codec, in alc294_gu502_toggle_output() argument
6868 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT) in alc294_gu502_toggle_output()
6869 alc_write_coef_idx(codec, 0x10, 0x8420); in alc294_gu502_toggle_output()
6871 alc_write_coef_idx(codec, 0x10, 0x0a20); in alc294_gu502_toggle_output()
6874 static void alc294_fixup_gu502_hp(struct hda_codec *codec, in alc294_fixup_gu502_hp() argument
6877 if (!is_jack_detectable(codec, 0x21)) in alc294_fixup_gu502_hp()
6882 snd_hda_jack_detect_enable_callback(codec, 0x21, in alc294_fixup_gu502_hp()
6886 alc294_gu502_toggle_output(codec, NULL); in alc294_fixup_gu502_hp()
6891 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec, in alc285_fixup_hp_gpio_amp_init() argument
6898 alc_write_coef_idx(codec, 0x65, 0x0); in alc285_fixup_hp_gpio_amp_init()
6901 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec, in alc274_fixup_hp_headset_mic() argument
6906 alc_combo_jack_hp_jd_restart(codec); in alc274_fixup_hp_headset_mic()
6911 static void alc_fixup_no_int_mic(struct hda_codec *codec, in alc_fixup_no_int_mic() argument
6914 struct alc_spec *spec = codec->spec; in alc_fixup_no_int_mic()
6919 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_no_int_mic()
6923 alc_combo_jack_hp_jd_restart(codec); in alc_fixup_no_int_mic()
6931 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360_eb1() argument
6936 struct alc_spec *spec = codec->spec; in alc285_fixup_hp_spectre_x360_eb1()
6944 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04); in alc285_fixup_hp_spectre_x360_eb1()
6952 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360_eb1()
6954 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6955 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360_eb1()
6959 alc_update_gpio_data(codec, 0x01, true); in alc285_fixup_hp_spectre_x360_eb1()
6961 alc_update_gpio_data(codec, 0x01, false); in alc285_fixup_hp_spectre_x360_eb1()
6966 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec, in alc285_fixup_hp_spectre_x360() argument
6977 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_spectre_x360()
6979 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc285_fixup_hp_spectre_x360()
6984 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec, in alc285_fixup_hp_envy_x360() argument
7010 snd_hda_apply_pincfgs(codec, pincfgs); in alc285_fixup_hp_envy_x360()
7013 alc295_fixup_disable_dac3(codec, fix, action); in alc285_fixup_hp_envy_x360()
7016 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0); in alc285_fixup_hp_envy_x360()
7019 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21); in alc285_fixup_hp_envy_x360()
7022 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50); in alc285_fixup_hp_envy_x360()
7025 alc_process_coef_fw(codec, coefs); in alc285_fixup_hp_envy_x360()
7028 rename_ctl(codec, "Bass Speaker Playback Volume", in alc285_fixup_hp_envy_x360()
7030 rename_ctl(codec, "Front Playback Switch", in alc285_fixup_hp_envy_x360()
7032 rename_ctl(codec, "Bass Speaker Playback Switch", in alc285_fixup_hp_envy_x360()
7038 static void alc285_fixup_hp_beep(struct hda_codec *codec, in alc285_fixup_hp_beep() argument
7042 codec->beep_just_power_on = true; in alc285_fixup_hp_beep()
7050 alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13)); in alc285_fixup_hp_beep()
7052 snd_hda_enable_beep_device(codec, 1); in alc285_fixup_hp_beep()
7055 dev_warn_once(hda_codec_dev(codec), in alc285_fixup_hp_beep()
7065 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, in alc_fixup_thinkpad_acpi() argument
7068 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */ in alc_fixup_thinkpad_acpi()
7069 hda_fixup_thinkpad_acpi(codec, fix, action); in alc_fixup_thinkpad_acpi()
7075 static void alc_fixup_ideapad_acpi(struct hda_codec *codec, in alc_fixup_ideapad_acpi() argument
7078 hda_fixup_ideapad_acpi(codec, fix, action); in alc_fixup_ideapad_acpi()
7082 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec, in alc287_fixup_legion_15imhg05_speakers() argument
7086 struct alc_spec *spec = codec->spec; in alc287_fixup_legion_15imhg05_speakers()
7237 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_two() argument
7239 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2); in cs35l41_fixup_spi_two()
7242 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action) in cs35l41_fixup_spi_four() argument
7244 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4); in cs35l41_fixup_spi_four()
7286 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec, in alc256_fixup_acer_sfg16_micmute_led() argument
7289 alc_fixup_hp_gpio_led(codec, action, 0, 0x04); in alc256_fixup_acer_sfg16_micmute_led()
7306 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec, in alc256_fixup_set_coef_defaults() argument
7318 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs); in alc256_fixup_set_coef_defaults()
7328 static void alc233_fixup_no_audio_jack(struct hda_codec *codec, in alc233_fixup_no_audio_jack() argument
7339 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs); in alc233_fixup_no_audio_jack()
7342 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec, in alc256_fixup_mic_no_presence_and_resume() argument
7347 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec, in alc256_fixup_mic_no_presence_and_resume()
7348 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec in alc256_fixup_mic_no_presence_and_resume()
7351 if (codec->core.vendor_id == 0x10ec0256) { in alc256_fixup_mic_no_presence_and_resume()
7352 alc_update_coef_idx(codec, 0x10, 1<<9, 0); in alc256_fixup_mic_no_presence_and_resume()
7353 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120); in alc256_fixup_mic_no_presence_and_resume()
7355 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c); in alc256_fixup_mic_no_presence_and_resume()
7359 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec, in alc256_decrease_headphone_amp_val() argument
7368 caps = query_amp_caps(codec, 0x3, HDA_OUTPUT); in alc256_decrease_headphone_amp_val()
7374 if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps)) in alc256_decrease_headphone_amp_val()
7375 codec_warn(codec, "failed to override amp caps for NID 0x3\n"); in alc256_decrease_headphone_amp_val()
7378 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec, in alc_fixup_dell4_mic_no_presence_quiet() argument
7382 struct alc_spec *spec = codec->spec; in alc_fixup_dell4_mic_no_presence_quiet()
7386 alc269_fixup_limit_int_mic_boost(codec, fix, action); in alc_fixup_dell4_mic_no_presence_quiet()
7395 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7396 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ); in alc_fixup_dell4_mic_no_presence_quiet()
7413 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec, in alc287_fixup_yoga9_14iap7_bass_spk_pin() argument
7439 struct alc_spec *spec = codec->spec; in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7443 snd_hda_apply_pincfgs(codec, pincfgs); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7444 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_yoga9_14iap7_bass_spk_pin()
7450 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec, in alc295_fixup_dell_inspiron_top_speakers() argument
7465 struct alc_spec *spec = codec->spec; in alc295_fixup_dell_inspiron_top_speakers()
7467 alc_fixup_no_shutup(codec, fix, action); in alc295_fixup_dell_inspiron_top_speakers()
7471 snd_hda_apply_pincfgs(codec, pincfgs); in alc295_fixup_dell_inspiron_top_speakers()
7472 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc295_fixup_dell_inspiron_top_speakers()
7479 static void alc287_fixup_bind_dacs(struct hda_codec *codec, in alc287_fixup_bind_dacs() argument
7482 struct alc_spec *spec = codec->spec; in alc287_fixup_bind_dacs()
7491 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc287_fixup_bind_dacs()
7495 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc287_fixup_bind_dacs()
7500 static void alc_fixup_headset_mic(struct hda_codec *codec, in alc_fixup_headset_mic() argument
7503 struct alc_spec *spec = codec->spec; in alc_fixup_headset_mic()
7511 snd_hda_apply_pincfgs(codec, pincfgs); in alc_fixup_headset_mic()
7512 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12); in alc_fixup_headset_mic()
7518 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_eu0xxx() argument
7540 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_eu0xxx()
7541 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_eu0xxx()
7545 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7546 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7547 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_eu0xxx()
7551 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec, in alc245_fixup_hp_spectre_x360_16_aa0xxx() argument
7560 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7577 snd_hda_apply_pincfgs(codec, pincfgs); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7578 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7582 alc_update_gpio_data(codec, 0x01, true); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7584 alc_update_gpio_data(codec, 0x01, false); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7588 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7589 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7590 alc245_fixup_hp_gpio_led(codec, fix, action); in alc245_fixup_hp_spectre_x360_16_aa0xxx()
7593 static void alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec *codec, in alc245_fixup_hp_zbook_firefly_g12a() argument
7596 struct alc_spec *spec = codec->spec; in alc245_fixup_hp_zbook_firefly_g12a()
7602 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn); in alc245_fixup_hp_zbook_firefly_g12a()
7606 cs35l41_fixup_i2c_two(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7607 alc245_fixup_hp_mute_led_coefbit(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7608 alc285_fixup_hp_coef_micmute_led(codec, fix, action); in alc245_fixup_hp_zbook_firefly_g12a()
7615 struct hda_codec *codec, in alc287_alc1318_playback_pcm_hook() argument
7621 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */ in alc287_alc1318_playback_pcm_hook()
7624 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_alc1318_playback_pcm_hook()
7629 static void alc287_s4_power_gpio3_default(struct hda_codec *codec) in alc287_s4_power_gpio3_default() argument
7631 if (is_s4_suspend(codec)) { in alc287_s4_power_gpio3_default()
7632 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */ in alc287_s4_power_gpio3_default()
7636 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec, in alc287_fixup_lenovo_thinkpad_with_alc1318() argument
7639 struct alc_spec *spec = codec->spec; in alc287_fixup_lenovo_thinkpad_with_alc1318()
7649 alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7650 alc_process_coef_fw(codec, coefs); in alc287_fixup_lenovo_thinkpad_with_alc1318()
7659 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec, in alc283_fixup_dell_hp_resume() argument
7663 alc_write_coef_idx(codec, 0xd, 0x2800); in alc283_fixup_dell_hp_resume()
7976 * depending on the codec ID
7978 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec, in alc298_fixup_lenovo_c940_duet7() argument
7984 if (codec->core.vendor_id == 0x10ec0298) in alc298_fixup_lenovo_c940_duet7()
7988 __snd_hda_apply_fixup(codec, id, action, 0); in alc298_fixup_lenovo_c940_duet7()
11932 * at most one tbl is allowed to define for the same vendor and same codec
11959 static void alc269_fill_coef(struct hda_codec *codec) in alc269_fill_coef() argument
11961 struct alc_spec *spec = codec->spec; in alc269_fill_coef()
11967 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { in alc269_fill_coef()
11968 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11969 alc_write_coef_idx(codec, 0xe, 0x8817); in alc269_fill_coef()
11972 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) { in alc269_fill_coef()
11973 alc_write_coef_idx(codec, 0xf, 0x960b); in alc269_fill_coef()
11974 alc_write_coef_idx(codec, 0xe, 0x8814); in alc269_fill_coef()
11977 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { in alc269_fill_coef()
11979 alc_update_coef_idx(codec, 0x04, 0, 1<<11); in alc269_fill_coef()
11982 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { in alc269_fill_coef()
11983 val = alc_read_coef_idx(codec, 0xd); in alc269_fill_coef()
11986 alc_write_coef_idx(codec, 0xd, val | (1<<10)); in alc269_fill_coef()
11988 val = alc_read_coef_idx(codec, 0x17); in alc269_fill_coef()
11991 alc_write_coef_idx(codec, 0x17, val | (1<<7)); in alc269_fill_coef()
11996 alc_update_coef_idx(codec, 0x4, 0, 1<<11); in alc269_fill_coef()
12001 static int patch_alc269(struct hda_codec *codec) in patch_alc269() argument
12006 err = alc_alloc_spec(codec, 0x0b); in patch_alc269()
12010 spec = codec->spec; in patch_alc269()
12012 codec->power_save_node = 0; in patch_alc269()
12015 codec->patch_ops.suspend = alc269_suspend; in patch_alc269()
12016 codec->patch_ops.resume = alc269_resume; in patch_alc269()
12020 switch (codec->core.vendor_id) { in patch_alc269()
12023 switch (alc_get_coef0(codec) & 0x00f0) { in patch_alc269()
12025 if (codec->bus->pci && in patch_alc269()
12026 codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc269()
12028 err = alc_codec_rename(codec, "ALC271X"); in patch_alc269()
12032 if (codec->bus->pci && in patch_alc269()
12033 codec->bus->pci->subsystem_vendor == 0x17aa && in patch_alc269()
12034 codec->bus->pci->subsystem_device == 0x21f3) in patch_alc269()
12035 err = alc_codec_rename(codec, "ALC3202"); in patch_alc269()
12042 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc269()
12048 alc269_fill_coef(codec); in patch_alc269()
12094 if (codec->core.vendor_id == 0x10ec0236 && in patch_alc269()
12095 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD) in patch_alc269()
12109 if (alc_get_coef0(codec) & 0x0010) in patch_alc269()
12136 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */ in patch_alc269()
12155 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */ in patch_alc269()
12161 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) { in patch_alc269()
12166 alc_pre_init(codec); in patch_alc269()
12168 snd_hda_pick_fixup(codec, alc269_fixup_models, in patch_alc269()
12174 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 && in patch_alc269()
12175 codec->core.vendor_id == 0x10ec0294) { in patch_alc269()
12176 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n"); in patch_alc269()
12177 codec->fixup_id = HDA_FIXUP_ID_NOT_SET; in patch_alc269()
12180 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true); in patch_alc269()
12181 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false); in patch_alc269()
12182 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl, in patch_alc269()
12189 find_cirrus_companion_amps(codec); in patch_alc269()
12191 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc269()
12193 alc_auto_parse_customize_define(codec); in patch_alc269()
12195 if (has_cdefine_beep(codec)) in patch_alc269()
12199 err = alc269_parse_auto_config(codec); in patch_alc269()
12209 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc269()
12214 alc_free(codec); in patch_alc269()
12222 static int alc861_parse_auto_config(struct hda_codec *codec) in alc861_parse_auto_config() argument
12226 return alc_parse_auto_config(codec, alc861_ignore, alc861_ssids); in alc861_parse_auto_config()
12239 static void alc861_fixup_asus_amp_vref_0f(struct hda_codec *codec, in alc861_fixup_asus_amp_vref_0f() argument
12242 struct alc_spec *spec = codec->spec; in alc861_fixup_asus_amp_vref_0f()
12247 val = snd_hda_codec_get_pin_target(codec, 0x0f); in alc861_fixup_asus_amp_vref_0f()
12251 snd_hda_set_pin_ctl(codec, 0x0f, val); in alc861_fixup_asus_amp_vref_0f()
12256 static void alc_fixup_no_jack_detect(struct hda_codec *codec, in alc_fixup_no_jack_detect() argument
12260 codec->no_jack_detect = 1; in alc_fixup_no_jack_detect()
12311 static int patch_alc861(struct hda_codec *codec) in patch_alc861() argument
12316 err = alc_alloc_spec(codec, 0x15); in patch_alc861()
12320 spec = codec->spec; in patch_alc861()
12321 if (has_cdefine_beep(codec)) in patch_alc861()
12326 alc_pre_init(codec); in patch_alc861()
12328 snd_hda_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups); in patch_alc861()
12329 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861()
12332 err = alc861_parse_auto_config(codec); in patch_alc861()
12342 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861()
12347 alc_free(codec); in patch_alc861()
12358 static int alc861vd_parse_auto_config(struct hda_codec *codec) in alc861vd_parse_auto_config() argument
12362 return alc_parse_auto_config(codec, alc861vd_ignore, alc861vd_ssids); in alc861vd_parse_auto_config()
12371 static void alc861vd_fixup_dallas(struct hda_codec *codec, in alc861vd_fixup_dallas() argument
12375 snd_hda_override_pin_caps(codec, 0x18, 0x00000734); in alc861vd_fixup_dallas()
12376 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c); in alc861vd_fixup_dallas()
12381 static void alc660vd_fixup_asus_gpio1(struct hda_codec *codec, in alc660vd_fixup_asus_gpio1() argument
12384 struct alc_spec *spec = codec->spec; in alc660vd_fixup_asus_gpio1()
12388 alc_fixup_gpio(codec, action, 0x01); in alc660vd_fixup_asus_gpio1()
12411 static int patch_alc861vd(struct hda_codec *codec) in patch_alc861vd() argument
12416 err = alc_alloc_spec(codec, 0x0b); in patch_alc861vd()
12420 spec = codec->spec; in patch_alc861vd()
12421 if (has_cdefine_beep(codec)) in patch_alc861vd()
12426 alc_pre_init(codec); in patch_alc861vd()
12428 snd_hda_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups); in patch_alc861vd()
12429 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc861vd()
12432 err = alc861vd_parse_auto_config(codec); in patch_alc861vd()
12442 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc861vd()
12447 alc_free(codec); in patch_alc861vd()
12467 static int alc662_parse_auto_config(struct hda_codec *codec) in alc662_parse_auto_config() argument
12474 if (codec->core.vendor_id == 0x10ec0272 || codec->core.vendor_id == 0x10ec0663 || in alc662_parse_auto_config()
12475 codec->core.vendor_id == 0x10ec0665 || codec->core.vendor_id == 0x10ec0670 || in alc662_parse_auto_config()
12476 codec->core.vendor_id == 0x10ec0671) in alc662_parse_auto_config()
12480 return alc_parse_auto_config(codec, alc662_ignore, ssids); in alc662_parse_auto_config()
12483 static void alc272_fixup_mario(struct hda_codec *codec, in alc272_fixup_mario() argument
12488 if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, in alc272_fixup_mario()
12493 codec_warn(codec, "failed to override amp caps for NID 0x2\n"); in alc272_fixup_mario()
12506 static void alc_fixup_bass_chmap(struct hda_codec *codec, in alc_fixup_bass_chmap() argument
12510 struct alc_spec *spec = codec->spec; in alc_fixup_bass_chmap()
12516 static unsigned int gpio_led_power_filter(struct hda_codec *codec, in gpio_led_power_filter() argument
12520 struct alc_spec *spec = codec->spec; in gpio_led_power_filter()
12521 if (nid == codec->core.afg && power_state == AC_PWRST_D3 && spec->gpio_data) in gpio_led_power_filter()
12526 static void alc662_fixup_led_gpio1(struct hda_codec *codec, in alc662_fixup_led_gpio1() argument
12529 struct alc_spec *spec = codec->spec; in alc662_fixup_led_gpio1()
12531 alc_fixup_hp_gpio_led(codec, action, 0x01, 0); in alc662_fixup_led_gpio1()
12534 codec->power_filter = gpio_led_power_filter; in alc662_fixup_led_gpio1()
12538 static void alc662_usi_automute_hook(struct hda_codec *codec, in alc662_usi_automute_hook() argument
12541 struct alc_spec *spec = codec->spec; in alc662_usi_automute_hook()
12544 snd_hda_gen_hp_automute(codec, jack); in alc662_usi_automute_hook()
12548 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, in alc662_usi_automute_hook()
12552 static void alc662_fixup_usi_headset_mic(struct hda_codec *codec, in alc662_fixup_usi_headset_mic() argument
12555 struct alc_spec *spec = codec->spec; in alc662_fixup_usi_headset_mic()
12562 static void alc662_aspire_ethos_mute_speakers(struct hda_codec *codec, in alc662_aspire_ethos_mute_speakers() argument
12571 if (snd_hda_jack_detect_state(codec, 0x1b) == HDA_JACK_PRESENT) { in alc662_aspire_ethos_mute_speakers()
12572 snd_hda_set_pin_ctl_cache(codec, 0x15, 0); in alc662_aspire_ethos_mute_speakers()
12573 snd_hda_set_pin_ctl_cache(codec, 0x18, 0); in alc662_aspire_ethos_mute_speakers()
12575 snd_hda_set_pin_ctl_cache(codec, 0x15, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12576 snd_hda_set_pin_ctl_cache(codec, 0x18, PIN_OUT); in alc662_aspire_ethos_mute_speakers()
12580 static void alc662_fixup_aspire_ethos_hp(struct hda_codec *codec, in alc662_fixup_aspire_ethos_hp() argument
12584 if (!is_jack_detectable(codec, 0x1b)) in alc662_fixup_aspire_ethos_hp()
12589 snd_hda_jack_detect_enable_callback(codec, 0x1b, in alc662_fixup_aspire_ethos_hp()
12592 alc_setup_gpio(codec, 0x02); in alc662_fixup_aspire_ethos_hp()
12598 alc662_aspire_ethos_mute_speakers(codec, NULL); in alc662_fixup_aspire_ethos_hp()
12603 static void alc671_fixup_hp_headset_mic2(struct hda_codec *codec, in alc671_fixup_hp_headset_mic2() argument
12606 struct alc_spec *spec = codec->spec; in alc671_fixup_hp_headset_mic2()
12618 snd_hda_apply_pincfgs(codec, pincfgs); in alc671_fixup_hp_headset_mic2()
12621 alc_write_coef_idx(codec, 0x19, 0xa054); in alc671_fixup_hp_headset_mic2()
12626 static void alc897_hp_automute_hook(struct hda_codec *codec, in alc897_hp_automute_hook() argument
12629 struct alc_spec *spec = codec->spec; in alc897_hp_automute_hook()
12632 snd_hda_gen_hp_automute(codec, jack); in alc897_hp_automute_hook()
12634 snd_hda_set_pin_ctl(codec, 0x1b, vref); in alc897_hp_automute_hook()
12637 static void alc897_fixup_lenovo_headset_mic(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mic() argument
12640 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mic()
12646 snd_hda_set_pin_ctl_cache(codec, 0x1a, PIN_IN | AC_PINCTL_VREF_100); in alc897_fixup_lenovo_headset_mic()
12650 static void alc897_fixup_lenovo_headset_mode(struct hda_codec *codec, in alc897_fixup_lenovo_headset_mode() argument
12653 struct alc_spec *spec = codec->spec; in alc897_fixup_lenovo_headset_mode()
12685 static void alc668_restore_default_value(struct hda_codec *codec) in alc668_restore_default_value() argument
12687 alc_process_coef_fw(codec, alc668_coefs); in alc668_restore_default_value()
13429 static int patch_alc662(struct hda_codec *codec) in patch_alc662() argument
13434 err = alc_alloc_spec(codec, 0x0b); in patch_alc662()
13438 spec = codec->spec; in patch_alc662()
13445 alc_fix_pll_init(codec, 0x20, 0x04, 15); in patch_alc662()
13447 switch (codec->core.vendor_id) { in patch_alc662()
13453 alc_pre_init(codec); in patch_alc662()
13455 snd_hda_pick_fixup(codec, alc662_fixup_models, in patch_alc662()
13457 snd_hda_pick_pin_fixup(codec, alc662_pin_fixup_tbl, alc662_fixups, true); in patch_alc662()
13458 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_alc662()
13460 alc_auto_parse_customize_define(codec); in patch_alc662()
13462 if (has_cdefine_beep(codec)) in patch_alc662()
13465 if ((alc_get_coef0(codec) & (1 << 14)) && in patch_alc662()
13466 codec->bus->pci && codec->bus->pci->subsystem_vendor == 0x1025 && in patch_alc662()
13468 err = alc_codec_rename(codec, "ALC272X"); in patch_alc662()
13474 err = alc662_parse_auto_config(codec); in patch_alc662()
13479 switch (codec->core.vendor_id) { in patch_alc662()
13497 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_alc662()
13502 alc_free(codec); in patch_alc662()
13510 static int alc680_parse_auto_config(struct hda_codec *codec) in alc680_parse_auto_config() argument
13512 return alc_parse_auto_config(codec, NULL, NULL); in alc680_parse_auto_config()
13517 static int patch_alc680(struct hda_codec *codec) in patch_alc680() argument
13522 err = alc_alloc_spec(codec, 0); in patch_alc680()
13527 err = alc680_parse_auto_config(codec); in patch_alc680()
13529 alc_free(codec); in patch_alc680()
13624 MODULE_DESCRIPTION("Realtek HD-audio codec");