Lines Matching defs:codec

50 static int alc269_parse_auto_config(struct hda_codec *codec)
55 struct alc_spec *spec = codec->spec;
90 return alc_parse_auto_config(codec, alc269_ignore, ssids);
101 static void alc_headset_btn_callback(struct hda_codec *codec,
120 snd_hda_jack_set_button_state(codec, jack->nid, report);
123 static void alc_disable_headset_jack_key(struct hda_codec *codec)
125 struct alc_spec *spec = codec->spec;
130 switch (codec->core.vendor_id) {
138 alc_write_coef_idx(codec, 0x48, 0x0);
139 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
140 alc_update_coef_idx(codec, 0x44, 0x0045 << 8, 0x0);
147 alc_write_coef_idx(codec, 0x48, 0x0);
148 alc_update_coef_idx(codec, 0x49, 0x0045, 0x0);
153 static void alc_enable_headset_jack_key(struct hda_codec *codec)
155 struct alc_spec *spec = codec->spec;
160 switch (codec->core.vendor_id) {
168 alc_write_coef_idx(codec, 0x48, 0xd011);
169 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
170 alc_update_coef_idx(codec, 0x44, 0x007f << 8, 0x0045 << 8);
177 alc_write_coef_idx(codec, 0x48, 0xd011);
178 alc_update_coef_idx(codec, 0x49, 0x007f, 0x0045);
183 static void alc_fixup_headset_jack(struct hda_codec *codec,
186 struct alc_spec *spec = codec->spec;
192 snd_hda_jack_detect_enable_callback(codec, 0x55,
197 if (!hp_pin || snd_hda_jack_bind_keymap(codec, 0x55,
200 snd_hda_jack_add_kctl(codec, 0x55, "Headset Jack",
204 alc_enable_headset_jack_key(codec);
209 static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
211 alc_update_coef_idx(codec, 0x04, 1 << 11, power_up ? (1 << 11) : 0);
214 static void alc269_shutup(struct hda_codec *codec)
216 struct alc_spec *spec = codec->spec;
219 alc269vb_toggle_power_output(codec, 0);
221 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
224 alc_shutup_pins(codec);
260 static void alc282_restore_default_value(struct hda_codec *codec)
262 alc_process_coef_fw(codec, alc282_coefs);
265 static void alc282_init(struct hda_codec *codec)
267 struct alc_spec *spec = codec->spec;
272 alc282_restore_default_value(codec);
276 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
277 coef78 = alc_read_coef_idx(codec, 0x78);
281 alc_write_coef_idx(codec, 0x78, 0x9004);
286 snd_hda_codec_write(codec, hp_pin, 0,
292 snd_hda_codec_write(codec, hp_pin, 0,
299 alc_write_coef_idx(codec, 0x78, coef78);
302 static void alc282_shutup(struct hda_codec *codec)
304 struct alc_spec *spec = codec->spec;
310 alc269_shutup(codec);
314 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
315 coef78 = alc_read_coef_idx(codec, 0x78);
316 alc_write_coef_idx(codec, 0x78, 0x9004);
321 snd_hda_codec_write(codec, hp_pin, 0,
328 snd_hda_codec_write(codec, hp_pin, 0,
334 alc_auto_setup_eapd(codec, false);
335 alc_shutup_pins(codec);
336 alc_write_coef_idx(codec, 0x78, coef78);
376 static void alc283_restore_default_value(struct hda_codec *codec)
378 alc_process_coef_fw(codec, alc283_coefs);
381 static void alc283_init(struct hda_codec *codec)
383 struct alc_spec *spec = codec->spec;
387 alc283_restore_default_value(codec);
393 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
397 alc_write_coef_idx(codec, 0x43, 0x9004);
399 snd_hda_codec_write(codec, hp_pin, 0,
405 snd_hda_codec_write(codec, hp_pin, 0,
412 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
414 alc_write_coef_idx(codec, 0x43, 0x9614);
417 static void alc283_shutup(struct hda_codec *codec)
419 struct alc_spec *spec = codec->spec;
424 alc269_shutup(codec);
428 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
430 alc_write_coef_idx(codec, 0x43, 0x9004);
433 alc_write_coef_idx(codec, 0x06, 0x2100);
435 snd_hda_codec_write(codec, hp_pin, 0,
442 snd_hda_codec_write(codec, hp_pin, 0,
445 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
449 alc_auto_setup_eapd(codec, false);
450 alc_shutup_pins(codec);
451 alc_write_coef_idx(codec, 0x43, 0x9614);
454 static void alc256_init(struct hda_codec *codec)
456 struct alc_spec *spec = codec->spec;
461 alc_update_coef_idx(codec, 0x03, 1<<1, 1<<1);
462 alc_update_coef_idx(codec, 0x08, 3<<2, 3<<2);
463 alc_update_coef_idx(codec, 0x08, 7<<4, 0);
464 alc_update_coef_idx(codec, 0x3b, 1<<15, 0);
465 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
474 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
478 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
480 snd_hda_codec_write(codec, hp_pin, 0,
485 snd_hda_codec_write(codec, hp_pin, 0,
489 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
491 alc_update_coef_idx(codec, 0x46, 3 << 12, 0);
492 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 1 << 15); /* Clear bit */
493 alc_update_coefex_idx(codec, 0x53, 0x02, 0x8000, 0 << 15);
500 alc_write_coef_idx(codec, 0x36, 0x5757);
503 static void alc256_shutup(struct hda_codec *codec)
505 struct alc_spec *spec = codec->spec;
512 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
515 /* NOTE: call this before clearing the pin, otherwise codec stalls */
517 * when booting with headset plugged. So skip setting it for the codec alc257
520 alc_update_coef_idx(codec, 0x46, 0, 3 << 12);
522 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
527 snd_hda_codec_write(codec, hp_pin, 0,
533 snd_hda_codec_write(codec, hp_pin, 0,
539 alc_auto_setup_eapd(codec, false);
540 alc_shutup_pins(codec);
543 alc_update_coef_idx(codec, 0x03, 1<<1, 0);
544 alc_update_coef_idx(codec, 0x08, 7<<4, 7<<4);
545 alc_update_coef_idx(codec, 0x08, 3<<2, 0);
546 alc_update_coef_idx(codec, 0x3b, 1<<15, 1<<15);
547 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
552 static void alc285_hp_init(struct hda_codec *codec)
554 struct alc_spec *spec = codec->spec;
559 alc_write_coefex_idx(codec, 0x58, 0x00, 0x1888); /* write default value */
560 alc_update_coef_idx(codec, 0x4a, 1<<15, 1<<15); /* Reset HP JD */
561 coef38 = alc_read_coef_idx(codec, 0x38); /* Amp control */
562 coef0d = alc_read_coef_idx(codec, 0x0d); /* Digital Misc control */
563 coef36 = alc_read_coef_idx(codec, 0x36); /* Passthrough Control */
564 alc_update_coef_idx(codec, 0x38, 1<<4, 0x0);
565 alc_update_coef_idx(codec, 0x0d, 0x110, 0x0);
567 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
570 snd_hda_codec_write(codec, hp_pin, 0,
574 alc_update_coef_idx(codec, 0x36, 1<<14, 1<<14);
575 alc_update_coef_idx(codec, 0x36, 1<<13, 0x0);
578 snd_hda_codec_write(codec, hp_pin, 0,
581 alc_write_coef_idx(codec, 0x67, 0x0); /* Set HP depop to manual mode */
582 alc_write_coefex_idx(codec, 0x58, 0x00, 0x7880);
583 alc_write_coefex_idx(codec, 0x58, 0x0f, 0xf049);
584 alc_update_coefex_idx(codec, 0x58, 0x03, 0x00f0, 0x00c0);
586 alc_write_coefex_idx(codec, 0x58, 0x00, 0xf888); /* HP depop procedure start */
587 val = alc_read_coefex_idx(codec, 0x58, 0x00);
590 val = alc_read_coefex_idx(codec, 0x58, 0x00);
593 alc_write_coefex_idx(codec, 0x58, 0x00, val); /* write back the result */
594 alc_update_coef_idx(codec, 0x38, 1<<4, coef38);
595 alc_update_coef_idx(codec, 0x0d, 0x110, coef0d);
596 alc_update_coef_idx(codec, 0x36, 3<<13, coef36);
599 alc_update_coef_idx(codec, 0x4a, 1<<15, 0);
602 static void alc225_init(struct hda_codec *codec)
604 struct alc_spec *spec = codec->spec;
609 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 3<<2);
610 alc_update_coef_idx(codec, 0x0e, 7<<6, 7<<6);
611 alc_update_coef_idx(codec, 0x33, 1<<11, 0);
619 is_s3_resume(codec) ||
620 is_s4_resume(codec)) {
621 alc285_hp_init(codec);
629 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
630 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
634 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x1); /* Low power */
637 snd_hda_codec_write(codec, hp_pin, 0,
640 snd_hda_codec_write(codec, 0x16, 0,
645 snd_hda_codec_write(codec, hp_pin, 0,
648 snd_hda_codec_write(codec, 0x16, 0,
652 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
653 alc_update_coefex_idx(codec, 0x57, 0x04, 0x0007, 0x4); /* Hight power */
657 static void alc225_shutup(struct hda_codec *codec)
659 struct alc_spec *spec = codec->spec;
666 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
667 hp2_pin_sense = snd_hda_jack_detect(codec, 0x16);
670 alc_disable_headset_jack_key(codec);
672 alc_update_coef_idx(codec, 0x4a, 0, 3 << 10);
676 snd_hda_codec_write(codec, hp_pin, 0,
679 snd_hda_codec_write(codec, 0x16, 0,
685 snd_hda_codec_write(codec, hp_pin, 0,
688 snd_hda_codec_write(codec, 0x16, 0,
692 alc_update_coef_idx(codec, 0x4a, 3 << 10, 0);
693 alc_enable_headset_jack_key(codec);
695 alc_auto_setup_eapd(codec, false);
696 alc_shutup_pins(codec);
699 alc_update_coef_idx(codec, 0x08, 0x0f << 2, 0x0c << 2);
700 alc_update_coef_idx(codec, 0x0e, 7<<6, 0);
701 alc_update_coef_idx(codec, 0x33, 1<<11, 1<<11);
702 alc_update_coef_idx(codec, 0x4a, 3<<4, 2<<4);
707 static void alc222_init(struct hda_codec *codec)
709 struct alc_spec *spec = codec->spec;
718 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
719 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
725 snd_hda_codec_write(codec, hp_pin, 0,
728 snd_hda_codec_write(codec, 0x14, 0,
733 snd_hda_codec_write(codec, hp_pin, 0,
736 snd_hda_codec_write(codec, 0x14, 0,
743 static void alc222_shutup(struct hda_codec *codec)
745 struct alc_spec *spec = codec->spec;
752 hp1_pin_sense = snd_hda_jack_detect(codec, hp_pin);
753 hp2_pin_sense = snd_hda_jack_detect(codec, 0x14);
759 snd_hda_codec_write(codec, hp_pin, 0,
762 snd_hda_codec_write(codec, 0x14, 0,
768 snd_hda_codec_write(codec, hp_pin, 0,
771 snd_hda_codec_write(codec, 0x14, 0,
776 alc_auto_setup_eapd(codec, false);
777 alc_shutup_pins(codec);
780 static void alc_default_init(struct hda_codec *codec)
782 struct alc_spec *spec = codec->spec;
791 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
796 snd_hda_codec_write(codec, hp_pin, 0,
801 snd_hda_codec_write(codec, hp_pin, 0,
807 static void alc_default_shutup(struct hda_codec *codec)
809 struct alc_spec *spec = codec->spec;
814 alc269_shutup(codec);
818 hp_pin_sense = snd_hda_jack_detect(codec, hp_pin);
823 snd_hda_codec_write(codec, hp_pin, 0,
829 snd_hda_codec_write(codec, hp_pin, 0,
834 alc_auto_setup_eapd(codec, false);
835 alc_shutup_pins(codec);
838 static void alc294_hp_init(struct hda_codec *codec)
840 struct alc_spec *spec = codec->spec;
847 snd_hda_codec_write(codec, hp_pin, 0,
853 snd_hda_codec_write(codec, hp_pin, 0,
856 alc_update_coef_idx(codec, 0x6f, 0x000f, 0);/* Set HP depop to manual mode */
857 alc_update_coefex_idx(codec, 0x58, 0x00, 0x8000, 0x8000); /* HP depop procedure start */
860 val = alc_read_coefex_idx(codec, 0x58, 0x01);
863 val = alc_read_coefex_idx(codec, 0x58, 0x01);
866 alc_update_coef_idx(codec, 0x6f, 0x000f, 0x000b);
870 static void alc294_init(struct hda_codec *codec)
872 struct alc_spec *spec = codec->spec;
876 codec->core.dev.power.power_state.event == PM_EVENT_RESTORE) {
877 alc294_hp_init(codec);
880 alc_default_init(codec);
883 static void alc5505_coef_set(struct hda_codec *codec, unsigned int index_reg,
886 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
887 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val & 0xffff); /* LSB */
888 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_PROC_COEF, val >> 16); /* MSB */
891 static int alc5505_coef_get(struct hda_codec *codec, unsigned int index_reg)
895 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_COEF_INDEX, index_reg >> 1);
896 val = snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
898 val |= snd_hda_codec_read(codec, 0x51, 0, AC_VERB_GET_PROC_COEF, 0)
903 static void alc5505_dsp_halt(struct hda_codec *codec)
907 alc5505_coef_set(codec, 0x3000, 0x000c); /* DSP CPU stop */
908 alc5505_coef_set(codec, 0x880c, 0x0008); /* DDR enter self refresh */
909 alc5505_coef_set(codec, 0x61c0, 0x11110080); /* Clock control for PLL and CPU */
910 alc5505_coef_set(codec, 0x6230, 0xfc0d4011); /* Disable Input OP */
911 alc5505_coef_set(codec, 0x61b4, 0x040a2b03); /* Stop PLL2 */
912 alc5505_coef_set(codec, 0x61b0, 0x00005b17); /* Stop PLL1 */
913 alc5505_coef_set(codec, 0x61b8, 0x04133303); /* Stop PLL3 */
914 val = alc5505_coef_get(codec, 0x6220);
915 alc5505_coef_set(codec, 0x6220, (val | 0x3000)); /* switch Ringbuffer clock to DBUS clock */
918 static void alc5505_dsp_back_from_halt(struct hda_codec *codec)
920 alc5505_coef_set(codec, 0x61b8, 0x04133302);
921 alc5505_coef_set(codec, 0x61b0, 0x00005b16);
922 alc5505_coef_set(codec, 0x61b4, 0x040a2b02);
923 alc5505_coef_set(codec, 0x6230, 0xf80d4011);
924 alc5505_coef_set(codec, 0x6220, 0x2002010f);
925 alc5505_coef_set(codec, 0x880c, 0x00000004);
928 static void alc5505_dsp_init(struct hda_codec *codec)
932 alc5505_dsp_halt(codec);
933 alc5505_dsp_back_from_halt(codec);
934 alc5505_coef_set(codec, 0x61b0, 0x5b14); /* PLL1 control */
935 alc5505_coef_set(codec, 0x61b0, 0x5b16);
936 alc5505_coef_set(codec, 0x61b4, 0x04132b00); /* PLL2 control */
937 alc5505_coef_set(codec, 0x61b4, 0x04132b02);
938 alc5505_coef_set(codec, 0x61b8, 0x041f3300); /* PLL3 control*/
939 alc5505_coef_set(codec, 0x61b8, 0x041f3302);
940 snd_hda_codec_write(codec, 0x51, 0, AC_VERB_SET_CODEC_RESET, 0); /* Function reset */
941 alc5505_coef_set(codec, 0x61b8, 0x041b3302);
942 alc5505_coef_set(codec, 0x61b8, 0x04173302);
943 alc5505_coef_set(codec, 0x61b8, 0x04163302);
944 alc5505_coef_set(codec, 0x8800, 0x348b328b); /* DRAM control */
945 alc5505_coef_set(codec, 0x8808, 0x00020022); /* DRAM control */
946 alc5505_coef_set(codec, 0x8818, 0x00000400); /* DRAM control */
948 val = alc5505_coef_get(codec, 0x6200) >> 16; /* Read revision ID */
950 alc5505_coef_set(codec, 0x6220, 0x2002010f); /* I/O PAD Configuration */
952 alc5505_coef_set(codec, 0x6220, 0x6002018f);
954 alc5505_coef_set(codec, 0x61ac, 0x055525f0); /**/
955 alc5505_coef_set(codec, 0x61c0, 0x12230080); /* Clock control */
956 alc5505_coef_set(codec, 0x61b4, 0x040e2b02); /* PLL2 control */
957 alc5505_coef_set(codec, 0x61bc, 0x010234f8); /* OSC Control */
958 alc5505_coef_set(codec, 0x880c, 0x00000004); /* DRAM Function control */
959 alc5505_coef_set(codec, 0x880c, 0x00000003);
960 alc5505_coef_set(codec, 0x880c, 0x00000010);
963 alc5505_dsp_halt(codec);
968 #define alc5505_dsp_suspend(codec) do { } while (0) /* NOP */
969 #define alc5505_dsp_resume(codec) do { } while (0) /* NOP */
971 #define alc5505_dsp_suspend(codec) alc5505_dsp_halt(codec)
972 #define alc5505_dsp_resume(codec) alc5505_dsp_back_from_halt(codec)
975 static int alc269_suspend(struct hda_codec *codec)
977 struct alc_spec *spec = codec->spec;
980 alc5505_dsp_suspend(codec);
982 return alc_suspend(codec);
985 static int alc269_resume(struct hda_codec *codec)
987 struct alc_spec *spec = codec->spec;
990 alc269vb_toggle_power_output(codec, 0);
992 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
996 snd_hda_codec_init(codec);
999 alc269vb_toggle_power_output(codec, 1);
1001 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
1005 snd_hda_regmap_sync(codec);
1006 hda_call_check_power_status(codec, 0x01);
1008 /* on some machine, the BIOS will clear the codec gpio data when enter
1013 alc_write_gpio_data(codec);
1016 alc5505_dsp_resume(codec);
1021 static void alc269_fixup_pincfg_no_hp_to_lineout(struct hda_codec *codec,
1024 struct alc_spec *spec = codec->spec;
1030 static void alc269_fixup_pincfg_U7x7_headset_mic(struct hda_codec *codec,
1034 unsigned int cfg_headphone = snd_hda_codec_get_pincfg(codec, 0x21);
1035 unsigned int cfg_headset_mic = snd_hda_codec_get_pincfg(codec, 0x19);
1038 snd_hda_codec_set_pincfg(codec, 0x19,
1043 static void alc269_fixup_hweq(struct hda_codec *codec,
1047 alc_update_coef_idx(codec, 0x1e, 0, 0x80);
1050 static void alc271_fixup_dmic(struct hda_codec *codec,
1060 if (strcmp(codec->core.chip_name, "ALC271X") &&
1061 strcmp(codec->core.chip_name, "ALC269VB"))
1063 cfg = snd_hda_codec_get_pincfg(codec, 0x12);
1065 snd_hda_sequence_write(codec, verbs);
1069 static void alc269vb_fixup_aspire_e1_coef(struct hda_codec *codec,
1074 alc_update_coef_idx(codec, 0x0d, 0x6000, 0x6000);
1077 static void alc269_fixup_pcm_44k(struct hda_codec *codec,
1080 struct alc_spec *spec = codec->spec;
1092 static void alc269_fixup_stereo_dmic(struct hda_codec *codec,
1101 alc_update_coef_idx(codec, 0x07, 0, 0x80);
1104 static void alc269_quanta_automute(struct hda_codec *codec)
1106 snd_hda_gen_update_outputs(codec);
1108 alc_write_coef_idx(codec, 0x0c, 0x680);
1109 alc_write_coef_idx(codec, 0x0c, 0x480);
1112 static void alc269_fixup_quanta_mute(struct hda_codec *codec,
1115 struct alc_spec *spec = codec->spec;
1121 static void alc269_x101_hp_automute_hook(struct hda_codec *codec,
1124 struct alc_spec *spec = codec->spec;
1127 snd_hda_gen_hp_automute(codec, jack);
1131 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
1134 snd_hda_codec_write(codec, 0x18, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
1146 static void alc298_huawei_mbx_stereo_seq(struct hda_codec *codec,
1150 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x0);
1151 alc_write_coef_idx(codec, 0x26, 0xb000);
1154 snd_hda_codec_write(codec, 0x21, 0, AC_VERB_GET_PIN_SENSE, 0x0);
1156 snd_hda_codec_write(codec, 0x6, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
1157 alc_write_coef_idx(codec, 0x26, 0xf000);
1158 alc_write_coef_idx(codec, 0x23, initval->value_0x23);
1161 alc_write_coef_idx(codec, 0x25, initval->value_0x25);
1163 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
1164 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
1167 static void alc298_fixup_huawei_mbx_stereo(struct hda_codec *codec,
1191 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x00);
1192 snd_hda_codec_write(codec, 0x06, 0, AC_VERB_SET_DIGI_CONVERT_3, 0x80);
1193 alc_write_coef_idx(codec, 0x26, 0xf000);
1194 alc_write_coef_idx(codec, 0x22, 0x31);
1195 alc_write_coef_idx(codec, 0x23, 0x0b);
1196 alc_write_coef_idx(codec, 0x25, 0x00);
1197 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0x26);
1198 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, 0xb010);
1201 alc298_huawei_mbx_stereo_seq(codec, seq, seq == dac_init);
1204 static void alc269_fixup_x101_headset_mic(struct hda_codec *codec,
1207 struct alc_spec *spec = codec->spec;
1214 static void alc_update_vref_led(struct hda_codec *codec, hda_nid_t pin,
1223 pinval = snd_hda_codec_get_pin_target(codec, pin);
1227 snd_hda_power_up_pm(codec);
1228 snd_hda_set_pin_ctl_cache(codec, pin, pinval);
1229 snd_hda_power_down_pm(codec);
1236 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
1237 struct alc_spec *spec = codec->spec;
1239 alc_update_vref_led(codec, spec->mute_led_nid,
1245 static unsigned int led_power_filter(struct hda_codec *codec,
1249 struct alc_spec *spec = codec->spec;
1256 snd_hda_set_pin_ctl(codec, nid,
1257 snd_hda_codec_get_pin_target(codec, nid));
1259 return snd_hda_gen_path_power_filter(codec, nid, power_state);
1262 static void alc269_fixup_hp_mute_led(struct hda_codec *codec,
1265 struct alc_spec *spec = codec->spec;
1279 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
1280 codec->power_filter = led_power_filter;
1281 codec_dbg(codec,
1288 static void alc269_fixup_hp_mute_led_micx(struct hda_codec *codec,
1292 struct alc_spec *spec = codec->spec;
1297 snd_hda_gen_add_mute_led_cdev(codec, vref_mute_led_set);
1298 codec->power_filter = led_power_filter;
1302 static void alc269_fixup_hp_mute_led_mic1(struct hda_codec *codec,
1305 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x18);
1308 static void alc269_fixup_hp_mute_led_mic2(struct hda_codec *codec,
1311 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x19);
1314 static void alc269_fixup_hp_mute_led_mic3(struct hda_codec *codec,
1317 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1b);
1320 static void alc236_fixup_hp_gpio_led(struct hda_codec *codec,
1323 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x01);
1326 static void alc269_fixup_hp_gpio_led(struct hda_codec *codec,
1329 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
1332 static void alc285_fixup_hp_gpio_led(struct hda_codec *codec,
1335 alc_fixup_hp_gpio_led(codec, action, 0x04, 0x01);
1338 static void alc286_fixup_hp_gpio_led(struct hda_codec *codec,
1341 alc_fixup_hp_gpio_led(codec, action, 0x02, 0x20);
1344 static void alc287_fixup_hp_gpio_led(struct hda_codec *codec,
1347 alc_fixup_hp_gpio_led(codec, action, 0x10, 0);
1350 static void alc245_fixup_hp_gpio_led(struct hda_codec *codec,
1353 struct alc_spec *spec = codec->spec;
1357 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
1364 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
1365 struct alc_spec *spec = codec->spec;
1367 alc_update_vref_led(codec, spec->cap_mute_led_nid,
1372 static void alc269_fixup_hp_gpio_mic1_led(struct hda_codec *codec,
1375 struct alc_spec *spec = codec->spec;
1377 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
1385 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
1386 codec->power_filter = led_power_filter;
1390 static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
1393 struct alc_spec *spec = codec->spec;
1395 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
1398 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
1399 codec->power_filter = led_power_filter;
1406 static void alc245_fixup_hp_x360_amp(struct hda_codec *codec,
1409 struct alc_spec *spec = codec->spec;
1418 alc_update_gpio_data(codec, 0x01, true);
1420 alc_update_gpio_data(codec, 0x01, false);
1427 struct hda_codec *codec,
1433 alc_update_gpio_data(codec, 0x04, true);
1436 alc_update_gpio_data(codec, 0x04, false);
1441 static void alc274_fixup_hp_envy_gpio(struct hda_codec *codec,
1445 struct alc_spec *spec = codec->spec;
1454 static void alc_update_coef_led(struct hda_codec *codec,
1461 alc_update_coef_idx(codec, led->idx, led->mask,
1469 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
1470 struct alc_spec *spec = codec->spec;
1472 alc_update_coef_led(codec, &spec->mute_led_coef,
1477 static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
1481 struct alc_spec *spec = codec->spec;
1489 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1493 static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
1497 struct alc_spec *spec = codec->spec;
1505 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1509 static void alc236_fixup_hp_mute_led_coefbit2(struct hda_codec *codec,
1512 struct alc_spec *spec = codec->spec;
1520 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1524 static void alc245_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
1528 struct alc_spec *spec = codec->spec;
1536 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1540 static void alc245_fixup_hp_mute_led_v1_coefbit(struct hda_codec *codec,
1544 struct alc_spec *spec = codec->spec;
1552 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1560 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
1561 struct alc_spec *spec = codec->spec;
1563 alc_update_coef_led(codec, &spec->mic_led_coef,
1568 static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
1571 struct alc_spec *spec = codec->spec;
1578 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
1582 static void alc285_fixup_hp_gpio_micmute_led(struct hda_codec *codec,
1585 struct alc_spec *spec = codec->spec;
1589 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
1592 static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
1595 struct alc_spec *spec = codec->spec;
1602 snd_hda_gen_add_micmute_led_cdev(codec, coef_micmute_led_set);
1606 static void alc295_fixup_hp_mute_led_coefbit11(struct hda_codec *codec,
1609 struct alc_spec *spec = codec->spec;
1617 snd_hda_gen_add_mute_led_cdev(codec, coef_mute_led_set);
1621 static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
1624 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
1625 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
1628 static void alc285_fixup_hp_spectre_x360_mute_led(struct hda_codec *codec,
1631 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
1632 alc285_fixup_hp_gpio_micmute_led(codec, fix, action);
1635 static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
1638 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
1639 alc236_fixup_hp_coef_micmute_led(codec, fix, action);
1642 static void alc236_fixup_hp_micmute_led_vref(struct hda_codec *codec,
1645 struct alc_spec *spec = codec->spec;
1649 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
1650 codec->power_filter = led_power_filter;
1654 static void alc236_fixup_hp_mute_led_micmute_vref(struct hda_codec *codec,
1657 alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
1658 alc236_fixup_hp_micmute_led_vref(codec, fix, action);
1661 static inline void alc298_samsung_write_coef_pack(struct hda_codec *codec,
1664 alc_write_coef_idx(codec, 0x23, coefs[0]);
1665 alc_write_coef_idx(codec, 0x25, coefs[1]);
1666 alc_write_coef_idx(codec, 0x26, 0xb011);
1674 static void alc298_fixup_samsung_amp(struct hda_codec *codec,
1693 alc_write_coef_idx(codec, 0x22, amps[i].nid);
1696 alc298_samsung_write_coef_pack(codec, amps[i].init_seq[j]);
1699 alc298_samsung_write_coef_pack(codec, init_seq[j]);
1743 static void alc298_samsung_v2_enable_amps(struct hda_codec *codec)
1745 struct alc_spec *spec = codec->spec;
1752 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
1754 alc298_samsung_write_coef_pack(codec, enable_seq[j]);
1755 codec_dbg(codec, "alc298_samsung_v2: Enabled speaker amp 0x%02x\n",
1760 static void alc298_samsung_v2_disable_amps(struct hda_codec *codec)
1762 struct alc_spec *spec = codec->spec;
1769 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
1771 alc298_samsung_write_coef_pack(codec, disable_seq[j]);
1772 codec_dbg(codec, "alc298_samsung_v2: Disabled speaker amp 0x%02x\n",
1778 struct hda_codec *codec,
1784 alc298_samsung_v2_enable_amps(codec);
1786 alc298_samsung_v2_disable_amps(codec);
1789 static void alc298_samsung_v2_init_amps(struct hda_codec *codec,
1792 struct alc_spec *spec = codec->spec;
1799 alc298_samsung_v2_disable_amps(codec);
1803 alc_write_coef_idx(codec, 0x22, alc298_samsung_v2_amp_desc_tbl[i].nid);
1805 alc298_samsung_write_coef_pack(codec,
1808 alc_write_coef_idx(codec, 0x89, 0x0);
1809 codec_dbg(codec, "alc298_samsung_v2: Initialized speaker amp 0x%02x\n",
1817 static void alc298_fixup_samsung_amp_v2_2_amps(struct hda_codec *codec,
1821 alc298_samsung_v2_init_amps(codec, 2);
1824 static void alc298_fixup_samsung_amp_v2_4_amps(struct hda_codec *codec,
1828 alc298_samsung_v2_init_amps(codec, 4);
1831 static void gpio2_mic_hotkey_event(struct hda_codec *codec,
1834 struct alc_spec *spec = codec->spec;
1844 static int alc_register_micmute_input_device(struct hda_codec *codec)
1846 struct alc_spec *spec = codec->spec;
1851 codec_err(codec, "Out of memory (input_allocate_device)\n");
1866 codec_err(codec, "input_register_device failed\n");
1880 static void alc280_fixup_hp_gpio2_mic_hotkey(struct hda_codec *codec,
1883 struct alc_spec *spec = codec->spec;
1885 alc_fixup_hp_gpio_led(codec, action, 0x08, 0x10);
1888 if (alc_register_micmute_input_device(codec) != 0)
1894 snd_hda_codec_write_cache(codec, codec->core.afg, 0,
1896 snd_hda_jack_detect_enable_callback(codec, codec->core.afg,
1914 static void alc233_fixup_lenovo_line2_mic_hotkey(struct hda_codec *codec,
1917 struct alc_spec *spec = codec->spec;
1919 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
1922 if (alc_register_micmute_input_device(codec) != 0)
1925 snd_hda_jack_detect_enable_callback(codec, 0x1b,
1940 static void alc269_fixup_hp_line1_mic1_led(struct hda_codec *codec,
1943 struct alc_spec *spec = codec->spec;
1945 alc269_fixup_hp_mute_led_micx(codec, fix, action, 0x1a);
1948 snd_hda_gen_add_micmute_led_cdev(codec, vref_micmute_led_set);
1952 static void alc233_fixup_lenovo_low_en_micmute_led(struct hda_codec *codec,
1955 struct alc_spec *spec = codec->spec;
1959 alc233_fixup_lenovo_line2_mic_hotkey(codec, fix, action);
1962 static void alc255_set_default_jack_type(struct hda_codec *codec)
1981 switch (codec->core.vendor_id) {
1983 alc_process_coef_fw(codec, alc255fw);
1989 alc_process_coef_fw(codec, alc256fw);
1995 static void alc_fixup_headset_mode_alc255(struct hda_codec *codec,
1999 alc255_set_default_jack_type(codec);
2001 alc_fixup_headset_mode(codec, fix, action);
2004 static void alc_fixup_headset_mode_alc255_no_hp_mic(struct hda_codec *codec,
2008 struct alc_spec *spec = codec->spec;
2010 alc255_set_default_jack_type(codec);
2013 alc_fixup_headset_mode(codec, fix, action);
2016 static void alc288_update_headset_jack_cb(struct hda_codec *codec,
2019 struct alc_spec *spec = codec->spec;
2021 alc_update_headset_jack_cb(codec, jack);
2023 alc_update_gpio_data(codec, 0x40, spec->gen.hp_jack_present);
2026 static void alc_fixup_headset_mode_dell_alc288(struct hda_codec *codec,
2029 alc_fixup_headset_mode(codec, fix, action);
2031 struct alc_spec *spec = codec->spec;
2039 static void alc_fixup_no_shutup(struct hda_codec *codec,
2043 struct alc_spec *spec = codec->spec;
2049 static void alc_fixup_tpt440_dock(struct hda_codec *codec,
2057 struct alc_spec *spec = codec->spec;
2061 codec->power_save_node = 0; /* avoid click noises */
2062 snd_hda_apply_pincfgs(codec, pincfgs);
2066 static void alc_fixup_tpt470_dock(struct hda_codec *codec,
2074 struct alc_spec *spec = codec->spec;
2078 snd_hda_apply_pincfgs(codec, pincfgs);
2081 snd_hda_codec_write(codec, 0x17, 0,
2084 snd_hda_codec_write(codec, 0x19, 0,
2089 static void alc_fixup_tpt470_dacs(struct hda_codec *codec,
2094 * ALC298 codec
2100 struct alc_spec *spec = codec->spec;
2106 static void alc295_fixup_asus_dacs(struct hda_codec *codec,
2112 struct alc_spec *spec = codec->spec;
2118 static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
2122 struct alc_spec *spec = codec->spec;
2125 int mic_pin = alc_find_ext_mic_pin(codec);
2130 snd_hda_jack_set_gating_jack(codec, mic_pin, hp_pin);
2134 static void alc269_fixup_limit_int_mic_boost(struct hda_codec *codec,
2138 struct alc_spec *spec = codec->spec;
2154 defcfg = snd_hda_codec_get_pincfg(codec, nid);
2158 snd_hda_override_amp_caps(codec, nid, HDA_INPUT,
2166 static void alc283_hp_automute_hook(struct hda_codec *codec,
2169 struct alc_spec *spec = codec->spec;
2173 snd_hda_gen_hp_automute(codec, jack);
2178 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
2182 static void alc283_fixup_chromebook(struct hda_codec *codec,
2185 struct alc_spec *spec = codec->spec;
2189 snd_hda_override_wcaps(codec, 0x03, 0);
2196 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
2198 alc_update_coef_idx(codec, 0x1a, 0, 1 << 4);
2203 static void alc283_fixup_sense_combo_jack(struct hda_codec *codec,
2206 struct alc_spec *spec = codec->spec;
2215 alc_update_coef_idx(codec, 0x06, 0x000c, 0);
2221 static void asus_tx300_automute(struct hda_codec *codec)
2223 struct alc_spec *spec = codec->spec;
2224 snd_hda_gen_update_outputs(codec);
2225 if (snd_hda_jack_detect(codec, 0x1b))
2229 static void alc282_fixup_asus_tx300(struct hda_codec *codec,
2232 struct alc_spec *spec = codec->spec;
2242 alc_setup_gpio(codec, 0x04);
2243 snd_hda_apply_pincfgs(codec, dock_pins);
2246 snd_hda_jack_detect_enable_callback(codec, 0x1b,
2256 rename_ctl(codec, "Speaker Playback Switch",
2258 rename_ctl(codec, "Bass Speaker Playback Switch",
2264 static void alc290_fixup_mono_speakers(struct hda_codec *codec,
2272 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn1), conn1);
2273 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn1), conn1);
2277 static void alc298_fixup_speaker_volume(struct hda_codec *codec,
2289 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn1), conn1);
2294 static void alc295_fixup_disable_dac3(struct hda_codec *codec,
2299 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2304 static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
2309 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2314 static void alc294_fixup_bass_speaker_15(struct hda_codec *codec,
2319 snd_hda_override_conn_list(codec, 0x15, ARRAY_SIZE(conn), conn);
2320 snd_hda_gen_add_micmute_led_cdev(codec, NULL);
2325 static void alc280_hp_gpio4_automute_hook(struct hda_codec *codec,
2328 struct alc_spec *spec = codec->spec;
2330 snd_hda_gen_hp_automute(codec, jack);
2332 alc_update_gpio_led(codec, 0x10, spec->mute_led_polarity,
2342 static void alc280_fixup_hp_9480m(struct hda_codec *codec,
2346 struct alc_spec *spec = codec->spec;
2348 alc_fixup_hp_gpio_led(codec, action, 0x08, 0);
2357 static void alc275_fixup_gpio4_off(struct hda_codec *codec,
2361 struct alc_spec *spec = codec->spec;
2376 static void alc285_fixup_thinkpad_x1_gen7(struct hda_codec *codec,
2383 struct alc_spec *spec = codec->spec;
2387 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2397 rename_ctl(codec, "Front Playback Volume", "DAC1 Playback Volume");
2398 rename_ctl(codec, "Bass Speaker Playback Volume", "DAC2 Playback Volume");
2403 static void alc225_fixup_s3_pop_noise(struct hda_codec *codec,
2409 codec->power_save_node = 1;
2413 static void alc274_fixup_bind_dacs(struct hda_codec *codec,
2416 struct alc_spec *spec = codec->spec;
2427 codec->power_save_node = 0;
2431 static void alc274_fixup_hp_aio_bind_dacs(struct hda_codec *codec,
2443 struct alc_spec *spec = codec->spec;
2445 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2450 static void alc289_fixup_asus_ga401(struct hda_codec *codec,
2456 struct alc_spec *spec = codec->spec;
2463 static void alc285_fixup_invalidate_dacs(struct hda_codec *codec,
2469 snd_hda_override_wcaps(codec, 0x03, 0);
2472 static void alc_combo_jack_hp_jd_restart(struct hda_codec *codec)
2474 switch (codec->core.vendor_id) {
2480 alc_update_coef_idx(codec, 0x4a, 0x8000, 1 << 15); /* Reset HP JD */
2481 alc_update_coef_idx(codec, 0x4a, 0x8000, 0 << 15);
2490 alc_update_coef_idx(codec, 0x1b, 0x8000, 1 << 15); /* Reset HP JD */
2491 alc_update_coef_idx(codec, 0x1b, 0x8000, 0 << 15);
2496 static void alc295_fixup_chromebook(struct hda_codec *codec,
2499 struct alc_spec *spec = codec->spec;
2506 alc_combo_jack_hp_jd_restart(codec);
2511 static void alc256_fixup_chromebook(struct hda_codec *codec,
2514 struct alc_spec *spec = codec->spec;
2518 if (codec->core.subsystem_id == 0x10280d76)
2528 static void alc_fixup_disable_mic_vref(struct hda_codec *codec,
2532 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
2536 static void alc294_gx502_toggle_output(struct hda_codec *codec,
2539 /* The Windows driver sets the codec up in a very different way where
2542 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
2543 alc_write_coef_idx(codec, 0x10, 0x8a20);
2545 alc_write_coef_idx(codec, 0x10, 0x0a20);
2548 static void alc294_fixup_gx502_hp(struct hda_codec *codec,
2552 if (!is_jack_detectable(codec, 0x21))
2557 snd_hda_jack_detect_enable_callback(codec, 0x21,
2564 alc294_gx502_toggle_output(codec, NULL);
2569 static void alc294_gu502_toggle_output(struct hda_codec *codec,
2575 if (snd_hda_jack_detect_state(codec, 0x21) == HDA_JACK_PRESENT)
2576 alc_write_coef_idx(codec, 0x10, 0x8420);
2578 alc_write_coef_idx(codec, 0x10, 0x0a20);
2581 static void alc294_fixup_gu502_hp(struct hda_codec *codec,
2584 if (!is_jack_detectable(codec, 0x21))
2589 snd_hda_jack_detect_enable_callback(codec, 0x21,
2593 alc294_gu502_toggle_output(codec, NULL);
2598 static void alc285_fixup_hp_gpio_amp_init(struct hda_codec *codec,
2605 alc_write_coef_idx(codec, 0x65, 0x0);
2608 static void alc274_fixup_hp_headset_mic(struct hda_codec *codec,
2613 alc_combo_jack_hp_jd_restart(codec);
2618 static void alc_fixup_no_int_mic(struct hda_codec *codec,
2621 struct alc_spec *spec = codec->spec;
2626 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
2630 alc_combo_jack_hp_jd_restart(codec);
2638 static void alc285_fixup_hp_spectre_x360_eb1(struct hda_codec *codec,
2643 struct alc_spec *spec = codec->spec;
2651 alc_fixup_hp_gpio_led(codec, action, 0x00, 0x04);
2659 snd_hda_apply_pincfgs(codec, pincfgs);
2661 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2662 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2666 alc_update_gpio_data(codec, 0x01, true);
2668 alc_update_gpio_data(codec, 0x01, false);
2674 static void alc285_fixup_hp_spectre_x360_df1(struct hda_codec *codec,
2678 struct alc_spec *spec = codec->spec;
2687 alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
2694 snd_hda_apply_pincfgs(codec, pincfgs);
2696 snd_hda_override_conn_list(codec, 0x14, ARRAY_SIZE(conn), conn);
2697 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2701 alc_update_gpio_data(codec, 0x01, true);
2703 alc_update_gpio_data(codec, 0x01, false);
2708 static void alc285_fixup_hp_spectre_x360(struct hda_codec *codec,
2719 snd_hda_apply_pincfgs(codec, pincfgs);
2721 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
2726 static void alc285_fixup_hp_envy_x360(struct hda_codec *codec,
2752 snd_hda_apply_pincfgs(codec, pincfgs);
2755 alc295_fixup_disable_dac3(codec, fix, action);
2758 snd_hda_codec_amp_stereo(codec, 0x21, HDA_OUTPUT, 0, -1, 0);
2761 snd_hda_jack_set_gating_jack(codec, 0x19, 0x21);
2764 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREF50);
2767 alc_process_coef_fw(codec, coefs);
2770 rename_ctl(codec, "Bass Speaker Playback Volume",
2772 rename_ctl(codec, "Front Playback Switch",
2774 rename_ctl(codec, "Bass Speaker Playback Switch",
2780 static void alc285_fixup_hp_beep(struct hda_codec *codec,
2784 codec->beep_just_power_on = true;
2792 alc_update_coef_idx(codec, 0x36, 0x7070, BIT(13));
2794 snd_hda_enable_beep_device(codec, 1);
2797 dev_warn_once(hda_codec_dev(codec),
2807 static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
2810 alc_fixup_no_shutup(codec, fix, action); /* reduce click noise */
2811 hda_fixup_thinkpad_acpi(codec, fix, action);
2817 static void alc_fixup_ideapad_acpi(struct hda_codec *codec,
2820 hda_fixup_ideapad_acpi(codec, fix, action);
2824 static void alc287_fixup_legion_15imhg05_speakers(struct hda_codec *codec,
2828 struct alc_spec *spec = codec->spec;
2979 static void cs35l41_fixup_spi_two(struct hda_codec *codec, const struct hda_fixup *fix, int action)
2981 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 2);
2984 static void cs35l41_fixup_spi_one(struct hda_codec *codec, const struct hda_fixup *fix, int action)
2986 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 1);
2989 static void cs35l41_fixup_spi_four(struct hda_codec *codec, const struct hda_fixup *fix, int action)
2991 comp_generic_fixup(codec, action, "spi", "CSC3551", "-%s:00-cs35l41-hda.%d", 4);
3039 static void alc256_fixup_acer_sfg16_micmute_led(struct hda_codec *codec,
3042 alc_fixup_hp_gpio_led(codec, action, 0, 0x04);
3059 static void alc256_fixup_set_coef_defaults(struct hda_codec *codec,
3071 alc_process_coef_fw(codec, alc256_fixup_set_coef_defaults_coefs);
3081 static void alc233_fixup_no_audio_jack(struct hda_codec *codec,
3092 alc_process_coef_fw(codec, alc233_fixup_no_audio_jack_coefs);
3095 static void alc256_fixup_mic_no_presence_and_resume(struct hda_codec *codec,
3100 * The Clevo NJ51CU comes either with the ALC293 or the ALC256 codec,
3101 * but uses the 0x8686 subproduct id in both cases. The ALC256 codec
3104 if (codec->core.vendor_id == 0x10ec0256) {
3105 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
3106 snd_hda_codec_set_pincfg(codec, 0x19, 0x04a11120);
3108 snd_hda_codec_set_pincfg(codec, 0x1a, 0x04a1113c);
3112 static void alc256_decrease_headphone_amp_val(struct hda_codec *codec,
3121 caps = query_amp_caps(codec, 0x3, HDA_OUTPUT);
3127 if (snd_hda_override_amp_caps(codec, 0x3, HDA_OUTPUT, caps))
3128 codec_warn(codec, "failed to override amp caps for NID 0x3\n");
3131 static void alc_fixup_dell4_mic_no_presence_quiet(struct hda_codec *codec,
3135 struct alc_spec *spec = codec->spec;
3139 alc269_fixup_limit_int_mic_boost(codec, fix, action);
3148 snd_hda_codec_set_pin_target(codec, 0x19, PIN_VREFHIZ);
3149 snd_hda_codec_set_pin_target(codec, 0x1b, PIN_VREFHIZ);
3166 static void alc287_fixup_yoga9_14iap7_bass_spk_pin(struct hda_codec *codec,
3192 struct alc_spec *spec = codec->spec;
3195 hda_fixup_ideapad_acpi(codec, fix, action);
3199 snd_hda_apply_pincfgs(codec, pincfgs);
3200 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3206 static void alc295_fixup_dell_inspiron_top_speakers(struct hda_codec *codec,
3221 struct alc_spec *spec = codec->spec;
3223 alc_fixup_no_shutup(codec, fix, action);
3227 snd_hda_apply_pincfgs(codec, pincfgs);
3228 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3235 static void alc287_fixup_bind_dacs(struct hda_codec *codec,
3238 struct alc_spec *spec = codec->spec;
3247 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3251 snd_hda_codec_write_cache(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
3257 static void alc2xx_fixup_headset_mic(struct hda_codec *codec,
3260 struct alc_spec *spec = codec->spec;
3268 snd_hda_apply_pincfgs(codec, pincfgs);
3269 alc_update_coef_idx(codec, 0x45, 0xf<<12 | 1<<10, 5<<12);
3275 static void alc245_fixup_hp_spectre_x360_eu0xxx(struct hda_codec *codec,
3297 snd_hda_apply_pincfgs(codec, pincfgs);
3298 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3302 cs35l41_fixup_i2c_two(codec, fix, action);
3303 alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
3304 alc245_fixup_hp_gpio_led(codec, fix, action);
3308 static void alc245_fixup_hp_spectre_x360_16_aa0xxx(struct hda_codec *codec,
3317 struct alc_spec *spec = codec->spec;
3334 snd_hda_apply_pincfgs(codec, pincfgs);
3335 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3339 alc_update_gpio_data(codec, 0x01, true);
3341 alc_update_gpio_data(codec, 0x01, false);
3345 cs35l41_fixup_i2c_two(codec, fix, action);
3346 alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
3347 alc245_fixup_hp_gpio_led(codec, fix, action);
3350 static void alc245_fixup_hp_zbook_firefly_g12a(struct hda_codec *codec,
3353 struct alc_spec *spec = codec->spec;
3359 snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
3363 cs35l41_fixup_i2c_two(codec, fix, action);
3364 alc245_fixup_hp_mute_led_coefbit(codec, fix, action);
3365 alc285_fixup_hp_coef_micmute_led(codec, fix, action);
3372 struct hda_codec *codec,
3378 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x954f); /* write gpio3 to high */
3381 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
3386 static void alc287_s4_power_gpio3_default(struct hda_codec *codec)
3388 if (is_s4_suspend(codec)) {
3389 alc_write_coefex_idx(codec, 0x5a, 0x00, 0x554f); /* write gpio3 as default value */
3393 static void alc287_fixup_lenovo_thinkpad_with_alc1318(struct hda_codec *codec,
3396 struct alc_spec *spec = codec->spec;
3406 alc_update_coef_idx(codec, 0x10, 1<<11, 1<<11);
3407 alc_process_coef_fw(codec, coefs);
3416 static void alc283_fixup_dell_hp_resume(struct hda_codec *codec,
3420 alc_write_coef_idx(codec, 0xd, 0x2800);
3743 * depending on the codec ID
3745 static void alc298_fixup_lenovo_c940_duet7(struct hda_codec *codec,
3751 if (codec->core.vendor_id == 0x10ec0298)
3755 __snd_hda_apply_fixup(codec, id, action, 0);
7805 * at most one tbl is allowed to define for the same vendor and same codec
7832 static void alc269_fill_coef(struct hda_codec *codec)
7834 struct alc_spec *spec = codec->spec;
7840 if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
7841 alc_write_coef_idx(codec, 0xf, 0x960b);
7842 alc_write_coef_idx(codec, 0xe, 0x8817);
7845 if ((alc_get_coef0(codec) & 0x00ff) == 0x016) {
7846 alc_write_coef_idx(codec, 0xf, 0x960b);
7847 alc_write_coef_idx(codec, 0xe, 0x8814);
7850 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
7852 alc_update_coef_idx(codec, 0x04, 0, 1<<11);
7855 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
7856 val = alc_read_coef_idx(codec, 0xd);
7859 alc_write_coef_idx(codec, 0xd, val | (1<<10));
7861 val = alc_read_coef_idx(codec, 0x17);
7864 alc_write_coef_idx(codec, 0x17, val | (1<<7));
7869 alc_update_coef_idx(codec, 0x4, 0, 1<<11);
7872 static void alc269_remove(struct hda_codec *codec)
7874 struct alc_spec *spec = codec->spec;
7879 snd_hda_gen_remove(codec);
7884 static int alc269_probe(struct hda_codec *codec, const struct hda_device_id *id)
7889 err = alc_alloc_spec(codec, 0x0b);
7893 spec = codec->spec;
7895 codec->power_save_node = 0;
7901 switch (codec->core.vendor_id) {
7904 switch (alc_get_coef0(codec) & 0x00f0) {
7906 if (codec->bus->pci &&
7907 codec->bus->pci->subsystem_vendor == 0x1025 &&
7909 err = alc_codec_rename(codec, "ALC271X");
7913 if (codec->bus->pci &&
7914 codec->bus->pci->subsystem_vendor == 0x17aa &&
7915 codec->bus->pci->subsystem_device == 0x21f3)
7916 err = alc_codec_rename(codec, "ALC3202");
7923 alc_fix_pll_init(codec, 0x20, 0x04, 15);
7929 alc269_fill_coef(codec);
7975 if (codec->core.vendor_id == 0x10ec0236 &&
7976 codec->bus->pci->vendor != PCI_VENDOR_ID_AMD)
7990 if (alc_get_coef0(codec) & 0x0010)
8017 alc_update_coef_idx(codec, 0x6b, 0x0018, (1<<4) | (1<<3)); /* UAJ MIC Vref control by verb */
8036 alc_update_coef_idx(codec, 0x4a, 1 << 15, 0); /* Combo jack auto trigger control */
8042 if (snd_hda_codec_read(codec, 0x51, 0, AC_VERB_PARAMETERS, 0) == 0x10ec5505) {
8047 alc_pre_init(codec);
8049 snd_hda_pick_fixup(codec, alc269_fixup_models,
8055 if (codec->fixup_id == ALC282_FIXUP_ASUS_TX300 &&
8056 codec->core.vendor_id == 0x10ec0294) {
8057 codec_dbg(codec, "Clear wrong fixup for ASUS ROG Strix G17\n");
8058 codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
8061 snd_hda_pick_pin_fixup(codec, alc269_pin_fixup_tbl, alc269_fixups, true);
8062 snd_hda_pick_pin_fixup(codec, alc269_fallback_pin_fixup_tbl, alc269_fixups, false);
8063 snd_hda_pick_fixup(codec, NULL, alc269_fixup_vendor_tbl,
8070 find_cirrus_companion_amps(codec);
8072 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
8074 alc_auto_parse_customize_define(codec);
8076 if (has_cdefine_beep(codec))
8080 err = alc269_parse_auto_config(codec);
8090 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
8095 alc269_remove(codec);