Lines Matching +full:gen +full:- +full:2

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Tobin Davis <tdavis@dsl-only.net>
25 struct hda_gen_spec gen; member
63 spec->gen.beep_nid = nid; in set_beep_amp()
65 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, in set_beep_amp()
68 return -ENOMEM; in set_beep_amp()
69 knew->private_value = beep_amp; in set_beep_amp()
76 struct conexant_spec *spec = codec->spec; in cx_auto_parse_beep()
95 struct conexant_spec *spec = codec->spec; in cx_auto_parse_eapd()
103 spec->eapds[spec->num_eapds++] = nid; in cx_auto_parse_eapd()
104 if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) in cx_auto_parse_eapd()
114 if (spec->num_eapds > 2) in cx_auto_parse_eapd()
115 spec->dynamic_eapd = 1; in cx_auto_parse_eapd()
134 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_hook()
136 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); in cx_auto_vmaster_hook()
143 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cx_auto_vmaster_mute_led()
144 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_mute_led()
146 snd_hda_codec_write(codec, spec->mute_led_eapd, 0, in cx_auto_vmaster_mute_led()
154 struct conexant_spec *spec = codec->spec; in cxt_init_gpio_led()
155 unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; in cxt_init_gpio_led()
163 spec->gpio_led); in cxt_init_gpio_led()
169 struct conexant_spec *spec = codec->spec; in cx_auto_init()
171 if (!spec->dynamic_eapd) in cx_auto_init()
172 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); in cx_auto_init()
182 struct conexant_spec *spec = codec->spec; in cx_auto_shutdown()
186 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); in cx_auto_shutdown()
216 * pin fix-up
252 struct conexant_spec *spec = codec->spec; in cxt_fixup_stereo_dmic()
253 spec->gen.inv_dmic_split = 1; in cxt_fixup_stereo_dmic()
271 /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */ in cxt_update_headset_mode()
274 struct conexant_spec *spec = codec->spec; in cxt_update_headset_mode()
275 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in cxt_update_headset_mode()
277 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in cxt_update_headset_mode()
279 for (i = 0; i < cfg->num_inputs; i++) in cxt_update_headset_mode()
280 if (cfg->inputs[i].pin == mux_pin) { in cxt_update_headset_mode()
281 mic_mode = !!cfg->inputs[i].is_headphone_mic; in cxt_update_headset_mode()
286 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ in cxt_update_headset_mode()
287 spec->gen.hp_jack_present = false; in cxt_update_headset_mode()
289 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic … in cxt_update_headset_mode()
290 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); in cxt_update_headset_mode()
306 struct conexant_spec *spec = codec->spec; in cxt_fixup_headphone_mic()
310 spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; in cxt_fixup_headphone_mic()
311 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); in cxt_fixup_headphone_mic()
314 WARN_ON(spec->gen.cap_sync_hook); in cxt_fixup_headphone_mic()
315 spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; in cxt_fixup_headphone_mic()
316 spec->gen.automute_hook = cxt_update_headset_mode; in cxt_fixup_headphone_mic()
327 struct conexant_spec *spec = codec->spec; in cxt_fixup_headset_mic()
331 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in cxt_fixup_headset_mic()
338 /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
360 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_boost()
363 for (ch = 0; ch < 2; ch++) { in olpc_xo_update_mic_boost()
366 if (!spec->dc_enable) in olpc_xo_update_mic_boost()
375 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_pins()
379 cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; in olpc_xo_update_mic_pins()
381 /* Set up mic pins for port-B, C and F dynamically as the recording in olpc_xo_update_mic_pins()
384 if (!spec->dc_enable) { in olpc_xo_update_mic_pins()
387 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); in olpc_xo_update_mic_pins()
396 update_mic_pin(codec, 0x1a, spec->recording ? in olpc_xo_update_mic_pins()
398 update_mic_pin(codec, 0x1b, spec->recording ? in olpc_xo_update_mic_pins()
415 if (spec->recording) in olpc_xo_update_mic_pins()
416 val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; in olpc_xo_update_mic_pins()
422 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); in olpc_xo_update_mic_pins()
423 snd_hda_activate_path(codec, spec->dc_mode_path, true, false); in olpc_xo_update_mic_pins()
431 struct conexant_spec *spec = codec->spec; in olpc_xo_automic()
434 if (!spec->dc_enable) in olpc_xo_automic()
437 if (spec->dc_enable) in olpc_xo_automic()
447 struct conexant_spec *spec = codec->spec; in olpc_xo_capture_hook()
449 /* toggle spec->recording flag and update mic pins accordingly in olpc_xo_capture_hook()
454 spec->recording = 1; in olpc_xo_capture_hook()
458 spec->recording = 0; in olpc_xo_capture_hook()
468 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_get()
469 ucontrol->value.integer.value[0] = spec->dc_enable; in olpc_xo_dc_mode_get()
477 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_put()
478 int dc_enable = !!ucontrol->value.integer.value[0]; in olpc_xo_dc_mode_put()
480 if (dc_enable == spec->dc_enable) in olpc_xo_dc_mode_put()
483 spec->dc_enable = dc_enable; in olpc_xo_dc_mode_put()
493 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_get()
494 ucontrol->value.enumerated.item[0] = spec->dc_input_bias; in olpc_xo_dc_bias_enum_get()
508 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_put()
512 idx = ucontrol->value.enumerated.item[0]; in olpc_xo_dc_bias_enum_put()
513 if (idx >= imux->num_items) in olpc_xo_dc_bias_enum_put()
514 idx = imux->num_items - 1; in olpc_xo_dc_bias_enum_put()
515 if (spec->dc_input_bias == idx) in olpc_xo_dc_bias_enum_put()
518 spec->dc_input_bias = idx; in olpc_xo_dc_bias_enum_put()
519 if (spec->dc_enable) in olpc_xo_dc_bias_enum_put()
549 struct conexant_spec *spec = codec->spec; in olpc_xo_mic_boost_put()
551 if (ret > 0 && spec->dc_enable) in olpc_xo_mic_boost_put()
559 struct conexant_spec *spec = codec->spec; in cxt_fixup_olpc_xo()
566 spec->gen.mic_autoswitch_hook = olpc_xo_automic; in cxt_fixup_olpc_xo()
567 spec->gen.pcm_capture_hook = olpc_xo_capture_hook; in cxt_fixup_olpc_xo()
568 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); in cxt_fixup_olpc_xo()
579 snd_array_for_each(&spec->gen.kctls, i, kctl) { in cxt_fixup_olpc_xo()
580 if (!strcmp(kctl->name, "Mic Boost Volume")) { in cxt_fixup_olpc_xo()
581 kctl->put = olpc_xo_mic_boost_put; in cxt_fixup_olpc_xo()
590 struct conexant_spec *spec = codec->spec; in cxt_fixup_mute_led_eapd()
593 spec->mute_led_eapd = 0x1b; in cxt_fixup_mute_led_eapd()
594 spec->dynamic_eapd = true; in cxt_fixup_mute_led_eapd()
642 struct conexant_spec *spec = codec->spec; in cxt_update_gpio_led()
643 unsigned int oldval = spec->gpio_led; in cxt_update_gpio_led()
645 if (spec->mute_led_polarity) in cxt_update_gpio_led()
649 spec->gpio_led |= mask; in cxt_update_gpio_led()
651 spec->gpio_led &= ~mask; in cxt_update_gpio_led()
653 mask, led_on, spec->gpio_led); in cxt_update_gpio_led()
654 if (spec->gpio_led != oldval) in cxt_update_gpio_led()
656 spec->gpio_led); in cxt_update_gpio_led()
663 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_mute_update()
664 struct conexant_spec *spec = codec->spec; in cxt_gpio_mute_update()
666 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness); in cxt_gpio_mute_update()
670 /* turn on/off mic-mute LED via GPIO per capture hook */
674 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_micmute_update()
675 struct conexant_spec *spec = codec->spec; in cxt_gpio_micmute_update()
677 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness); in cxt_gpio_micmute_update()
684 struct conexant_spec *spec = codec->spec; in cxt_setup_mute_led()
686 spec->gpio_led = 0; in cxt_setup_mute_led()
687 spec->mute_led_polarity = 0; in cxt_setup_mute_led()
690 spec->gpio_mute_led_mask = mute; in cxt_setup_mute_led()
694 spec->gpio_mic_led_mask = mic_mute; in cxt_setup_mute_led()
715 { 0x17, 0x21a11000 }, /* dock-mic */
716 { 0x19, 0x2121103f }, /* dock-HP */
724 { 0x1a, 0x21a190f0 }, /* dock-mic */
725 { 0x1c, 0x212140ff }, /* dock-HP */
848 { 0x16, 0x21011020 }, /* line-out */
849 { 0x18, 0x2181103f }, /* line-in */
893 /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
904 { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" },
905 { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" },
906 { .id = CXT_FIXUP_HP_530, .name = "hp-530" },
918 { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" },
929 { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" },
960 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
968 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
970 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC),
971 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
974 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
983 { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" },
985 { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" },
988 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
989 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
990 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
991 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
992 { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
993 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
994 { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" },
995 { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" },
999 /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
1004 struct conexant_spec *spec = codec->spec; in add_cx5051_fake_mutes()
1014 spec->gen.dac_min_mute = true; in add_cx5051_fake_mutes()
1022 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); in patch_conexant_auto()
1026 return -ENOMEM; in patch_conexant_auto()
1027 snd_hda_gen_spec_init(&spec->gen); in patch_conexant_auto()
1028 codec->spec = spec; in patch_conexant_auto()
1029 codec->patch_ops = cx_auto_patch_ops; in patch_conexant_auto()
1032 spec->gen.own_eapd_ctl = 1; in patch_conexant_auto()
1034 switch (codec->core.vendor_id) { in patch_conexant_auto()
1036 codec->single_adc_amp = 1; in patch_conexant_auto()
1037 spec->gen.mixer_nid = 0x17; in patch_conexant_auto()
1038 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1043 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1044 spec->gen.mixer_nid = 0x19; in patch_conexant_auto()
1045 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1051 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1056 codec->power_save_node = 1; in patch_conexant_auto()
1059 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1065 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd) in patch_conexant_auto()
1066 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; in patch_conexant_auto()
1070 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, in patch_conexant_auto()
1071 spec->parse_flags); in patch_conexant_auto()
1075 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in patch_conexant_auto()
1084 * which falls into the single-cmd mode. in patch_conexant_auto()
1087 if (!codec->bus->core.sync_write) { in patch_conexant_auto()
1090 codec->bus->core.sync_write = 1; in patch_conexant_auto()
1091 codec->bus->allow_bus_reset = 1; in patch_conexant_auto()
1131 HDA_CODEC_ENTRY(0x14f1510f, "CX20751/2", patch_conexant_auto),
1132 HDA_CODEC_ENTRY(0x14f15110, "CX20751/2", patch_conexant_auto),
1143 MODULE_DESCRIPTION("Conexant HD-audio codec");