Lines Matching +full:codec +full:- +full:0
1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright (c) 2005-2007 Takashi Iwai <tiwai@suse.de>
38 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
39 HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
44 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */
50 static int create_beep_ctls(struct hda_codec *codec) in create_beep_ctls() argument
52 struct ad198x_spec *spec = codec->spec; in create_beep_ctls()
55 if (!spec->beep_amp) in create_beep_ctls()
56 return 0; in create_beep_ctls()
58 for (knew = ad_beep_mixer ; knew->name; knew++) { in create_beep_ctls()
61 kctl = snd_ctl_new1(knew, codec); in create_beep_ctls()
63 return -ENOMEM; in create_beep_ctls()
64 kctl->private_value = spec->beep_amp; in create_beep_ctls()
65 err = snd_hda_ctl_add(codec, 0, kctl); in create_beep_ctls()
66 if (err < 0) in create_beep_ctls()
69 return 0; in create_beep_ctls()
72 #define create_beep_ctls(codec) 0 argument
76 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front, in ad198x_power_eapd_write() argument
79 if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
80 snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
81 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
82 if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD) in ad198x_power_eapd_write()
83 snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE, in ad198x_power_eapd_write()
84 !codec->inv_eapd ? 0x00 : 0x02); in ad198x_power_eapd_write()
87 static void ad198x_power_eapd(struct hda_codec *codec) in ad198x_power_eapd() argument
90 switch (codec->core.vendor_id) { in ad198x_power_eapd()
91 case 0x11d41882: in ad198x_power_eapd()
92 case 0x11d4882a: in ad198x_power_eapd()
93 case 0x11d41884: in ad198x_power_eapd()
94 case 0x11d41984: in ad198x_power_eapd()
95 case 0x11d41883: in ad198x_power_eapd()
96 case 0x11d4184a: in ad198x_power_eapd()
97 case 0x11d4194a: in ad198x_power_eapd()
98 case 0x11d4194b: in ad198x_power_eapd()
99 case 0x11d41988: in ad198x_power_eapd()
100 case 0x11d4198b: in ad198x_power_eapd()
101 case 0x11d4989a: in ad198x_power_eapd()
102 case 0x11d4989b: in ad198x_power_eapd()
103 ad198x_power_eapd_write(codec, 0x12, 0x11); in ad198x_power_eapd()
105 case 0x11d41981: in ad198x_power_eapd()
106 case 0x11d41983: in ad198x_power_eapd()
107 ad198x_power_eapd_write(codec, 0x05, 0x06); in ad198x_power_eapd()
109 case 0x11d41986: in ad198x_power_eapd()
110 ad198x_power_eapd_write(codec, 0x1b, 0x1a); in ad198x_power_eapd()
115 static void ad198x_shutup(struct hda_codec *codec) in ad198x_shutup() argument
117 snd_hda_shutup_pins(codec); in ad198x_shutup()
118 ad198x_power_eapd(codec); in ad198x_shutup()
122 static int ad198x_suspend(struct hda_codec *codec) in ad198x_suspend() argument
124 ad198x_shutup(codec); in ad198x_suspend()
125 return 0; in ad198x_suspend()
132 struct hda_codec *codec = private_data; in ad_vmaster_eapd_hook() local
133 struct ad198x_spec *spec = codec->spec; in ad_vmaster_eapd_hook()
135 if (!spec->eapd_nid) in ad_vmaster_eapd_hook()
137 if (codec->inv_eapd) in ad_vmaster_eapd_hook()
139 snd_hda_codec_write_cache(codec, spec->eapd_nid, 0, in ad_vmaster_eapd_hook()
141 enabled ? 0x02 : 0x00); in ad_vmaster_eapd_hook()
148 static int ad198x_auto_build_controls(struct hda_codec *codec) in ad198x_auto_build_controls() argument
152 err = snd_hda_gen_build_controls(codec); in ad198x_auto_build_controls()
153 if (err < 0) in ad198x_auto_build_controls()
155 err = create_beep_ctls(codec); in ad198x_auto_build_controls()
156 if (err < 0) in ad198x_auto_build_controls()
158 return 0; in ad198x_auto_build_controls()
175 static int ad198x_parse_auto_config(struct hda_codec *codec, bool indep_hp) in ad198x_parse_auto_config() argument
177 struct ad198x_spec *spec = codec->spec; in ad198x_parse_auto_config()
178 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in ad198x_parse_auto_config()
181 codec->spdif_status_reset = 1; in ad198x_parse_auto_config()
182 codec->no_trigger_sense = 1; in ad198x_parse_auto_config()
183 codec->no_sticky_stream = 1; in ad198x_parse_auto_config()
185 spec->gen.indep_hp = indep_hp; in ad198x_parse_auto_config()
186 if (!spec->gen.add_stereo_mix_input) in ad198x_parse_auto_config()
187 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in ad198x_parse_auto_config()
189 err = snd_hda_parse_pin_defcfg(codec, cfg, NULL, 0); in ad198x_parse_auto_config()
190 if (err < 0) in ad198x_parse_auto_config()
192 err = snd_hda_gen_parse_auto_config(codec, cfg); in ad198x_parse_auto_config()
193 if (err < 0) in ad198x_parse_auto_config()
196 return 0; in ad198x_parse_auto_config()
203 static int alloc_ad_spec(struct hda_codec *codec) in alloc_ad_spec() argument
209 return -ENOMEM; in alloc_ad_spec()
210 codec->spec = spec; in alloc_ad_spec()
211 snd_hda_gen_spec_init(&spec->gen); in alloc_ad_spec()
212 codec->patch_ops = ad198x_auto_patch_ops; in alloc_ad_spec()
213 return 0; in alloc_ad_spec()
220 /* Lenovo N100 seems to report the reversed bit for HP jack-sensing */
221 static void ad_fixup_inv_jack_detect(struct hda_codec *codec, in ad_fixup_inv_jack_detect() argument
224 struct ad198x_spec *spec = codec->spec; in ad_fixup_inv_jack_detect()
227 codec->inv_jack_detect = 1; in ad_fixup_inv_jack_detect()
228 spec->gen.keep_eapd_on = 1; in ad_fixup_inv_jack_detect()
229 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad_fixup_inv_jack_detect()
230 spec->eapd_nid = 0x1b; in ad_fixup_inv_jack_detect()
235 static void ad1986a_fixup_eapd(struct hda_codec *codec, in ad1986a_fixup_eapd() argument
238 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd()
241 codec->inv_eapd = 0; in ad1986a_fixup_eapd()
242 spec->gen.keep_eapd_on = 1; in ad1986a_fixup_eapd()
243 spec->eapd_nid = 0x1b; in ad1986a_fixup_eapd()
247 /* enable stereo-mix input for avoiding regression on KDE (bko#88251) */
248 static void ad1986a_fixup_eapd_mix_in(struct hda_codec *codec, in ad1986a_fixup_eapd_mix_in() argument
251 struct ad198x_spec *spec = codec->spec; in ad1986a_fixup_eapd_mix_in()
254 ad1986a_fixup_eapd(codec, fix, action); in ad1986a_fixup_eapd_mix_in()
255 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_ENABLE; in ad1986a_fixup_eapd_mix_in()
279 { 0x1b, 0x90170110 }, /* speaker */
280 { 0x1d, 0x90a7013e }, /* int mic */
287 { 0x1b, 0x90170110 }, /* speaker */
288 { 0x1d, 0x90a7013e }, /* int mic */
289 { 0x20, 0x411111f0 }, /* N/A */
290 { 0x24, 0x411111f0 }, /* N/A */
297 { 0x1a, 0x02214021 }, /* headphone */
298 { 0x1b, 0x01014011 }, /* front */
299 { 0x1c, 0x01813030 }, /* line-in */
300 { 0x1d, 0x01a19020 }, /* rear mic */
301 { 0x1e, 0x411111f0 }, /* N/A */
302 { 0x1f, 0x02a190f0 }, /* mic */
303 { 0x20, 0x411111f0 }, /* N/A */
310 { 0x1a, 0x02214021 }, /* headphone */
311 { 0x1b, 0x90170110 }, /* speaker */
312 { 0x1c, 0x411111f0 }, /* N/A */
313 { 0x1d, 0x411111f0 }, /* N/A */
314 { 0x1e, 0x411111f0 }, /* N/A */
315 { 0x1f, 0x02a191f0 }, /* mic */
316 { 0x20, 0x411111f0 }, /* N/A */
323 { 0x1d, 0x90a7013e }, /* int mic */
340 { 0x1a, 0x0421402f }, /* headphone */
341 { 0x1b, 0x90170110 }, /* speaker */
342 { 0x1c, 0x411111f0 }, /* N/A */
343 { 0x1d, 0x90a70130 }, /* int mic */
344 { 0x1e, 0x411111f0 }, /* N/A */
345 { 0x1f, 0x04a19040 }, /* mic */
346 { 0x20, 0x411111f0 }, /* N/A */
347 { 0x21, 0x411111f0 }, /* N/A */
348 { 0x22, 0x411111f0 }, /* N/A */
349 { 0x23, 0x411111f0 }, /* N/A */
350 { 0x24, 0x411111f0 }, /* N/A */
351 { 0x25, 0x411111f0 }, /* N/A */
360 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_FIXUP_LAPTOP_IMIC),
361 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9V", AD1986A_FIXUP_LAPTOP_IMIC),
362 SND_PCI_QUIRK(0x1043, 0x1443, "ASUS Z99He", AD1986A_FIXUP_EAPD),
363 SND_PCI_QUIRK(0x1043, 0x1447, "ASUS A8JN", AD1986A_FIXUP_EAPD),
364 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
365 SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
366 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
367 SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
368 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
369 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
370 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
371 SND_PCI_QUIRK(0x1631, 0xc022, "PackardBell EasyNote MX65", AD1986A_FIXUP_EASYNOTE),
372 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_FIXUP_INV_JACK_DETECT),
373 SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_FIXUP_3STACK),
374 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_FIXUP_3STACK),
381 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-imic" },
382 { .id = AD1986A_FIXUP_LAPTOP_IMIC, .name = "laptop-eapd" }, /* alias */
389 static int patch_ad1986a(struct hda_codec *codec) in patch_ad1986a() argument
394 0x1a, 0x03, in patch_ad1986a()
395 0x1b, 0x03, in patch_ad1986a()
396 0x1c, 0x04, in patch_ad1986a()
397 0x1d, 0x05, in patch_ad1986a()
398 0x1e, 0x03, in patch_ad1986a()
399 0 in patch_ad1986a()
402 err = alloc_ad_spec(codec); in patch_ad1986a()
403 if (err < 0) in patch_ad1986a()
405 spec = codec->spec; in patch_ad1986a()
408 codec->inv_eapd = 1; in patch_ad1986a()
410 spec->gen.mixer_nid = 0x07; in patch_ad1986a()
411 spec->gen.beep_nid = 0x19; in patch_ad1986a()
412 set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); in patch_ad1986a()
420 spec->gen.multiout.no_share_stream = 1; in patch_ad1986a()
422 spec->gen.preferred_dacs = preferred_pairs; in patch_ad1986a()
425 spec->gen.auto_mute_via_amp = 1; in patch_ad1986a()
427 snd_hda_pick_fixup(codec, ad1986a_fixup_models, ad1986a_fixup_tbl, in patch_ad1986a()
429 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1986a()
431 err = ad198x_parse_auto_config(codec, false); in patch_ad1986a()
432 if (err < 0) { in patch_ad1986a()
433 snd_hda_gen_free(codec); in patch_ad1986a()
437 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1986a()
439 return 0; in patch_ad1986a()
448 * SPDIF mux control for AD1983 auto-parser
453 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_info() local
454 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_info()
457 int num_conns = spec->num_smux_conns; in ad1983_auto_smux_enum_info()
464 return -EINVAL; in ad1983_auto_smux_enum_info()
470 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_get() local
471 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_get()
473 ucontrol->value.enumerated.item[0] = spec->cur_smux; in ad1983_auto_smux_enum_get()
474 return 0; in ad1983_auto_smux_enum_get()
480 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1983_auto_smux_enum_put() local
481 struct ad198x_spec *spec = codec->spec; in ad1983_auto_smux_enum_put()
482 unsigned int val = ucontrol->value.enumerated.item[0]; in ad1983_auto_smux_enum_put()
483 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid; in ad1983_auto_smux_enum_put()
484 int num_conns = spec->num_smux_conns; in ad1983_auto_smux_enum_put()
487 return -EINVAL; in ad1983_auto_smux_enum_put()
488 if (spec->cur_smux == val) in ad1983_auto_smux_enum_put()
489 return 0; in ad1983_auto_smux_enum_put()
490 spec->cur_smux = val; in ad1983_auto_smux_enum_put()
491 snd_hda_codec_write_cache(codec, dig_out, 0, in ad1983_auto_smux_enum_put()
504 static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) in ad1983_add_spdif_mux_ctl() argument
506 struct ad198x_spec *spec = codec->spec; in ad1983_add_spdif_mux_ctl()
507 hda_nid_t dig_out = spec->gen.multiout.dig_out_nid; in ad1983_add_spdif_mux_ctl()
511 return 0; in ad1983_add_spdif_mux_ctl()
512 num_conns = snd_hda_get_num_conns(codec, dig_out); in ad1983_add_spdif_mux_ctl()
514 return 0; in ad1983_add_spdif_mux_ctl()
515 spec->num_smux_conns = num_conns; in ad1983_add_spdif_mux_ctl()
516 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1983_auto_smux_mixer)) in ad1983_add_spdif_mux_ctl()
517 return -ENOMEM; in ad1983_add_spdif_mux_ctl()
518 return 0; in ad1983_add_spdif_mux_ctl()
521 static int patch_ad1983(struct hda_codec *codec) in patch_ad1983() argument
523 static const hda_nid_t conn_0c[] = { 0x08 }; in patch_ad1983()
524 static const hda_nid_t conn_0d[] = { 0x09 }; in patch_ad1983()
528 err = alloc_ad_spec(codec); in patch_ad1983()
529 if (err < 0) in patch_ad1983()
531 spec = codec->spec; in patch_ad1983()
533 spec->gen.mixer_nid = 0x0e; in patch_ad1983()
534 spec->gen.beep_nid = 0x10; in patch_ad1983()
535 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1983()
538 snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c); in patch_ad1983()
539 snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d); in patch_ad1983()
541 err = ad198x_parse_auto_config(codec, false); in patch_ad1983()
542 if (err < 0) in patch_ad1983()
544 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1983()
545 if (err < 0) in patch_ad1983()
547 return 0; in patch_ad1983()
550 snd_hda_gen_free(codec); in patch_ad1983()
559 static void ad1981_fixup_hp_eapd(struct hda_codec *codec, in ad1981_fixup_hp_eapd() argument
562 struct ad198x_spec *spec = codec->spec; in ad1981_fixup_hp_eapd()
565 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad1981_fixup_hp_eapd()
566 spec->eapd_nid = 0x05; in ad1981_fixup_hp_eapd()
570 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
573 static void ad1981_fixup_amp_override(struct hda_codec *codec, in ad1981_fixup_amp_override() argument
577 snd_hda_override_amp_caps(codec, 0x11, HDA_INPUT, in ad1981_fixup_amp_override()
578 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | in ad1981_fixup_amp_override()
579 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | in ad1981_fixup_amp_override()
580 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | in ad1981_fixup_amp_override()
603 SND_PCI_QUIRK_VENDOR(0x1014, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
604 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1981_FIXUP_HP_EAPD),
605 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", AD1981_FIXUP_AMP_OVERRIDE),
607 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_FIXUP_HP_EAPD),
611 static int patch_ad1981(struct hda_codec *codec) in patch_ad1981() argument
616 err = alloc_ad_spec(codec); in patch_ad1981()
617 if (err < 0) in patch_ad1981()
618 return -ENOMEM; in patch_ad1981()
619 spec = codec->spec; in patch_ad1981()
621 spec->gen.mixer_nid = 0x0e; in patch_ad1981()
622 spec->gen.beep_nid = 0x10; in patch_ad1981()
623 set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); in patch_ad1981()
625 snd_hda_pick_fixup(codec, NULL, ad1981_fixup_tbl, ad1981_fixups); in patch_ad1981()
626 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1981()
628 err = ad198x_parse_auto_config(codec, false); in patch_ad1981()
629 if (err < 0) in patch_ad1981()
631 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1981()
632 if (err < 0) in patch_ad1981()
635 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1981()
637 return 0; in patch_ad1981()
640 snd_hda_gen_free(codec); in patch_ad1981()
651 * port-A 0x11 (mute/hp) <- 0x22 <- 0x37 <- 03/04/06
652 * port-B 0x14 (mute/hp) <- 0x2b <- 0x30 <- 03/04/06
653 * port-C 0x15 (mute) <- 0x2c <- 0x31 <- 05/0a
654 * port-D 0x12 (mute/hp) <- 0x29 <- 04
655 * port-E 0x17 (mute/hp) <- 0x26 <- 0x32 <- 05/0a
656 * port-F 0x16 (mute) <- 0x2a <- 06
657 * port-G 0x24 (mute) <- 0x27 <- 05
658 * port-H 0x25 (mute) <- 0x28 <- 0a
659 * mono 0x13 (mute/amp)<- 0x1e <- 0x36 <- 03/04/06
661 * DAC0 = 03h, DAC1 = 04h, DAC2 = 05h, DAC3 = 06h, DAC4 = 0ah
667 * port-A 0x11 -> 0x38 -> mix 2, ADC 0
668 * port-B 0x14 -> 0x39 -> mix 0, ADC 1
669 * port-C 0x15 -> 0x3a -> 33:0 - mix 1, ADC 2
670 * port-D 0x12 -> 0x3d -> mix 3, ADC 8
671 * port-E 0x17 -> 0x3c -> 34:0 - mix 4, ADC 4
672 * port-F 0x16 -> 0x3b -> mix 5, ADC 3
673 * port-G 0x24 -> N/A -> 33:1 - mix 1, 34:1 - mix 4, ADC 6
674 * port-H 0x25 -> N/A -> 33:2 - mix 1, 34:2 - mix 4, ADC 7
678 * 6stack - front/surr/CLFE/side/opt DACs - 04/06/05/0a/03
679 * 3stack - front/surr/CLFE/opt DACs - 04/05/0a/03
681 * Inputs of Analog Mix (0x20)
682 * 0:Port-B (front mic)
683 * 1:Port-C/G/H (line-in)
684 * 2:Port-A
685 * 3:Port-D (line-in/2)
686 * 4:Port-E/G/H (mic-in)
687 * 5:Port-F (mic2-in)
692 * 0:Port-A
693 * 1:Port-B (front mic-in)
694 * 2:Port-C (line-in)
695 * 3:Port-F (mic2-in)
696 * 4:Port-E (mic-in)
698 * 6:Port-G
699 * 7:Port-H
700 * 8:Port-D (line-in/2)
705 * 6-stack
706 * Port-A front headphone
707 * B front mic-in
708 * C rear line-in
709 * D rear front-out
710 * E rear mic-in
715 * 3-stack
716 * Port-A front headphone
718 * C rear line-in/surround
719 * D rear front-out
720 * E rear mic-in/CLFE
723 * Port-A headphone
724 * B mic-in
733 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_info() local
734 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_info()
738 int num_conns = spec->num_smux_conns; in ad1988_auto_smux_enum_info()
748 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_get() local
749 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_get()
751 ucontrol->value.enumerated.item[0] = spec->cur_smux; in ad1988_auto_smux_enum_get()
752 return 0; in ad1988_auto_smux_enum_get()
758 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in ad1988_auto_smux_enum_put() local
759 struct ad198x_spec *spec = codec->spec; in ad1988_auto_smux_enum_put()
760 unsigned int val = ucontrol->value.enumerated.item[0]; in ad1988_auto_smux_enum_put()
762 int num_conns = spec->num_smux_conns; in ad1988_auto_smux_enum_put()
765 return -EINVAL; in ad1988_auto_smux_enum_put()
766 if (spec->cur_smux == val) in ad1988_auto_smux_enum_put()
767 return 0; in ad1988_auto_smux_enum_put()
769 mutex_lock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
770 path = snd_hda_get_path_from_idx(codec, in ad1988_auto_smux_enum_put()
771 spec->smux_paths[spec->cur_smux]); in ad1988_auto_smux_enum_put()
773 snd_hda_activate_path(codec, path, false, true); in ad1988_auto_smux_enum_put()
774 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[val]); in ad1988_auto_smux_enum_put()
776 snd_hda_activate_path(codec, path, true, true); in ad1988_auto_smux_enum_put()
777 spec->cur_smux = val; in ad1988_auto_smux_enum_put()
778 mutex_unlock(&codec->control_mutex); in ad1988_auto_smux_enum_put()
790 static int ad1988_auto_init(struct hda_codec *codec) in ad1988_auto_init() argument
792 struct ad198x_spec *spec = codec->spec; in ad1988_auto_init()
795 err = snd_hda_gen_init(codec); in ad1988_auto_init()
796 if (err < 0) in ad1988_auto_init()
798 if (!spec->gen.autocfg.dig_outs) in ad1988_auto_init()
799 return 0; in ad1988_auto_init()
801 for (i = 0; i < 4; i++) { in ad1988_auto_init()
803 path = snd_hda_get_path_from_idx(codec, spec->smux_paths[i]); in ad1988_auto_init()
805 snd_hda_activate_path(codec, path, path->active, false); in ad1988_auto_init()
808 return 0; in ad1988_auto_init()
811 static int ad1988_add_spdif_mux_ctl(struct hda_codec *codec) in ad1988_add_spdif_mux_ctl() argument
813 struct ad198x_spec *spec = codec->spec; in ad1988_add_spdif_mux_ctl()
821 .path = { 0x02, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
822 .idx = { 0, 0, 0 }, in ad1988_add_spdif_mux_ctl()
823 .multi = { 0, 0, 0 }, in ad1988_add_spdif_mux_ctl()
827 .path = { 0x08, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
828 .idx = { 0, 0, 1, 0 }, in ad1988_add_spdif_mux_ctl()
829 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
833 .path = { 0x09, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
834 .idx = { 0, 1, 1, 0 }, in ad1988_add_spdif_mux_ctl()
835 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
839 .path = { 0x0f, 0x0b, 0x1d, 0x1b }, in ad1988_add_spdif_mux_ctl()
840 .idx = { 0, 2, 1, 0 }, in ad1988_add_spdif_mux_ctl()
841 .multi = { 0, 1, 0, 0 }, in ad1988_add_spdif_mux_ctl()
846 if (!spec->gen.autocfg.dig_outs || in ad1988_add_spdif_mux_ctl()
847 get_wcaps_type(get_wcaps(codec, 0x1d)) != AC_WID_AUD_MIX) in ad1988_add_spdif_mux_ctl()
848 return 0; in ad1988_add_spdif_mux_ctl()
850 num_conns = snd_hda_get_num_conns(codec, 0x0b) + 1; in ad1988_add_spdif_mux_ctl()
852 return 0; in ad1988_add_spdif_mux_ctl()
853 spec->num_smux_conns = num_conns; in ad1988_add_spdif_mux_ctl()
855 for (i = 0; i < num_conns; i++) { in ad1988_add_spdif_mux_ctl()
856 struct nid_path *path = snd_array_new(&spec->gen.paths); in ad1988_add_spdif_mux_ctl()
858 return -ENOMEM; in ad1988_add_spdif_mux_ctl()
861 path->active = 1; in ad1988_add_spdif_mux_ctl()
862 spec->smux_paths[i] = snd_hda_get_path_idx(codec, path); in ad1988_add_spdif_mux_ctl()
865 if (!snd_hda_gen_add_kctl(&spec->gen, NULL, &ad1988_auto_smux_mixer)) in ad1988_add_spdif_mux_ctl()
866 return -ENOMEM; in ad1988_add_spdif_mux_ctl()
868 codec->patch_ops.init = ad1988_auto_init; in ad1988_add_spdif_mux_ctl()
870 return 0; in ad1988_add_spdif_mux_ctl()
884 { 0x11, 0x02214130 }, /* front-hp */
885 { 0x12, 0x01014010 }, /* line-out */
886 { 0x14, 0x02a19122 }, /* front-mic */
887 { 0x15, 0x01813021 }, /* line-in */
888 { 0x16, 0x01011012 }, /* line-out */
889 { 0x17, 0x01a19020 }, /* mic */
890 { 0x1b, 0x0145f1f0 }, /* SPDIF */
891 { 0x24, 0x01016011 }, /* line-out */
892 { 0x25, 0x01012013 }, /* line-out */
899 { .id = AD1988_FIXUP_6STACK_DIG, .name = "6stack-dig" },
903 static int patch_ad1988(struct hda_codec *codec) in patch_ad1988() argument
908 err = alloc_ad_spec(codec); in patch_ad1988()
909 if (err < 0) in patch_ad1988()
911 spec = codec->spec; in patch_ad1988()
913 spec->gen.mixer_nid = 0x20; in patch_ad1988()
914 spec->gen.mixer_merge_nid = 0x21; in patch_ad1988()
915 spec->gen.beep_nid = 0x10; in patch_ad1988()
916 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1988()
918 snd_hda_pick_fixup(codec, ad1988_fixup_models, NULL, ad1988_fixups); in patch_ad1988()
919 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1988()
921 err = ad198x_parse_auto_config(codec, true); in patch_ad1988()
922 if (err < 0) in patch_ad1988()
924 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1988()
925 if (err < 0) in patch_ad1988()
928 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1988()
930 return 0; in patch_ad1988()
933 snd_hda_gen_free(codec); in patch_ad1988()
941 * port-B - front line/mic-in
942 * port-E - aux in/out
943 * port-F - aux in/out
944 * port-C - rear line/mic-in
945 * port-D - rear line/hp-out
946 * port-A - front line/hp-out
948 * AD1984 = AD1884 + two digital mic-ins
952 * port-B (0x14) - front mic-in
953 * port-E (0x1c) - rear mic-in
954 * port-F (0x16) - CD / ext out
955 * port-C (0x15) - rear line-in
956 * port-D (0x12) - rear line-out
957 * port-A (0x11) - front hp-out
959 * AD1984A = AD1884A + digital-mic
961 * AD1984B = AD1984A + extra SPDIF-out
964 /* set the upper-limit for mixer amp to 0dB for avoiding the possible
967 static void ad1884_fixup_amp_override(struct hda_codec *codec, in ad1884_fixup_amp_override() argument
971 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, in ad1884_fixup_amp_override()
972 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | in ad1884_fixup_amp_override()
973 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | in ad1884_fixup_amp_override()
974 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | in ad1884_fixup_amp_override()
981 struct hda_codec *codec = private_data; in ad1884_vmaster_hp_gpio_hook() local
982 struct ad198x_spec *spec = codec->spec; in ad1884_vmaster_hp_gpio_hook()
984 if (spec->eapd_nid) in ad1884_vmaster_hp_gpio_hook()
986 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_vmaster_hp_gpio_hook()
988 enabled ? 0x00 : 0x02); in ad1884_vmaster_hp_gpio_hook()
991 static void ad1884_fixup_hp_eapd(struct hda_codec *codec, in ad1884_fixup_hp_eapd() argument
994 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_hp_eapd()
998 spec->gen.vmaster_mute.hook = ad1884_vmaster_hp_gpio_hook; in ad1884_fixup_hp_eapd()
999 spec->gen.own_eapd_ctl = 1; in ad1884_fixup_hp_eapd()
1000 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1001 AC_VERB_SET_GPIO_MASK, 0x02); in ad1884_fixup_hp_eapd()
1002 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1003 AC_VERB_SET_GPIO_DIRECTION, 0x02); in ad1884_fixup_hp_eapd()
1004 snd_hda_codec_write_cache(codec, 0x01, 0, in ad1884_fixup_hp_eapd()
1005 AC_VERB_SET_GPIO_DATA, 0x02); in ad1884_fixup_hp_eapd()
1008 if (spec->gen.autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT) in ad1884_fixup_hp_eapd()
1009 spec->eapd_nid = spec->gen.autocfg.line_out_pins[0]; in ad1884_fixup_hp_eapd()
1011 spec->eapd_nid = spec->gen.autocfg.speaker_pins[0]; in ad1884_fixup_hp_eapd()
1016 static void ad1884_fixup_thinkpad(struct hda_codec *codec, in ad1884_fixup_thinkpad() argument
1019 struct ad198x_spec *spec = codec->spec; in ad1884_fixup_thinkpad()
1022 spec->gen.keep_eapd_on = 1; in ad1884_fixup_thinkpad()
1023 spec->gen.vmaster_mute.hook = ad_vmaster_eapd_hook; in ad1884_fixup_thinkpad()
1024 spec->eapd_nid = 0x12; in ad1884_fixup_thinkpad()
1025 /* Analog PC Beeper - allow firmware/ACPI beeps */ in ad1884_fixup_thinkpad()
1026 spec->beep_amp = HDA_COMPOSE_AMP_VAL(0x20, 3, 3, HDA_INPUT); in ad1884_fixup_thinkpad()
1027 spec->gen.beep_nid = 0; /* no digital beep */ in ad1884_fixup_thinkpad()
1033 {0x01, AC_VERB_SET_COEF_INDEX, 0x13f7},
1034 {0x01, AC_VERB_SET_PROC_COEF, 0x08},
1076 SND_PCI_QUIRK(0x103c, 0x2a82, "HP Touchsmart", AD1884_FIXUP_HP_TOUCHSMART),
1077 SND_PCI_QUIRK_VENDOR(0x103c, "HP", AD1884_FIXUP_HP_EAPD),
1078 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1884_FIXUP_THINKPAD),
1083 static int patch_ad1884(struct hda_codec *codec) in patch_ad1884() argument
1088 err = alloc_ad_spec(codec); in patch_ad1884()
1089 if (err < 0) in patch_ad1884()
1091 spec = codec->spec; in patch_ad1884()
1093 spec->gen.mixer_nid = 0x20; in patch_ad1884()
1094 spec->gen.mixer_merge_nid = 0x21; in patch_ad1884()
1095 spec->gen.beep_nid = 0x10; in patch_ad1884()
1096 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1884()
1098 snd_hda_pick_fixup(codec, NULL, ad1884_fixup_tbl, ad1884_fixups); in patch_ad1884()
1099 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_ad1884()
1101 err = ad198x_parse_auto_config(codec, true); in patch_ad1884()
1102 if (err < 0) in patch_ad1884()
1104 err = ad1983_add_spdif_mux_ctl(codec); in patch_ad1884()
1105 if (err < 0) in patch_ad1884()
1108 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_ad1884()
1110 return 0; in patch_ad1884()
1113 snd_hda_gen_free(codec); in patch_ad1884()
1120 * port-A - front hp-out
1121 * port-B - front mic-in
1122 * port-C - rear line-in, shared surr-out (3stack)
1123 * port-D - rear line-out
1124 * port-E - rear mic-in, shared clfe-out (3stack)
1125 * port-F - rear surr-out (6stack)
1126 * port-G - rear clfe-out (6stack)
1129 static int patch_ad1882(struct hda_codec *codec) in patch_ad1882() argument
1134 err = alloc_ad_spec(codec); in patch_ad1882()
1135 if (err < 0) in patch_ad1882()
1137 spec = codec->spec; in patch_ad1882()
1139 spec->gen.mixer_nid = 0x20; in patch_ad1882()
1140 spec->gen.mixer_merge_nid = 0x21; in patch_ad1882()
1141 spec->gen.beep_nid = 0x10; in patch_ad1882()
1142 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); in patch_ad1882()
1143 err = ad198x_parse_auto_config(codec, true); in patch_ad1882()
1144 if (err < 0) in patch_ad1882()
1146 err = ad1988_add_spdif_mux_ctl(codec); in patch_ad1882()
1147 if (err < 0) in patch_ad1882()
1149 return 0; in patch_ad1882()
1152 snd_hda_gen_free(codec); in patch_ad1882()
1161 HDA_CODEC_ENTRY(0x11d4184a, "AD1884A", patch_ad1884),
1162 HDA_CODEC_ENTRY(0x11d41882, "AD1882", patch_ad1882),
1163 HDA_CODEC_ENTRY(0x11d41883, "AD1883", patch_ad1884),
1164 HDA_CODEC_ENTRY(0x11d41884, "AD1884", patch_ad1884),
1165 HDA_CODEC_ENTRY(0x11d4194a, "AD1984A", patch_ad1884),
1166 HDA_CODEC_ENTRY(0x11d4194b, "AD1984B", patch_ad1884),
1167 HDA_CODEC_ENTRY(0x11d41981, "AD1981", patch_ad1981),
1168 HDA_CODEC_ENTRY(0x11d41983, "AD1983", patch_ad1983),
1169 HDA_CODEC_ENTRY(0x11d41984, "AD1984", patch_ad1884),
1170 HDA_CODEC_ENTRY(0x11d41986, "AD1986A", patch_ad1986a),
1171 HDA_CODEC_ENTRY(0x11d41988, "AD1988", patch_ad1988),
1172 HDA_CODEC_ENTRY(0x11d4198b, "AD1988B", patch_ad1988),
1173 HDA_CODEC_ENTRY(0x11d4882a, "AD1882A", patch_ad1882),
1174 HDA_CODEC_ENTRY(0x11d4989a, "AD1989A", patch_ad1988),
1175 HDA_CODEC_ENTRY(0x11d4989b, "AD1989B", patch_ad1988),
1181 MODULE_DESCRIPTION("Analog Devices HD-audio codec");