Lines Matching +full:ext +full:- +full:gen

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Tobin Davis <tdavis@dsl-only.net>
31 struct hda_gen_spec gen; member
70 spec->gen.beep_nid = nid; in set_beep_amp()
72 knew = snd_hda_gen_add_kctl(&spec->gen, NULL, in set_beep_amp()
75 return -ENOMEM; in set_beep_amp()
76 knew->private_value = beep_amp; in set_beep_amp()
83 struct conexant_spec *spec = codec->spec; in cx_auto_parse_beep()
102 struct conexant_spec *spec = codec->spec; in cx_auto_parse_eapd()
110 spec->eapds[spec->num_eapds++] = nid; in cx_auto_parse_eapd()
111 if (spec->num_eapds >= ARRAY_SIZE(spec->eapds)) in cx_auto_parse_eapd()
121 if (spec->num_eapds > 2) in cx_auto_parse_eapd()
122 spec->dynamic_eapd = 1; in cx_auto_parse_eapd()
141 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_hook()
143 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); in cx_auto_vmaster_hook()
150 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cx_auto_vmaster_mute_led()
151 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_mute_led()
153 snd_hda_codec_write(codec, spec->mute_led_eapd, 0, in cx_auto_vmaster_mute_led()
161 struct conexant_spec *spec = codec->spec; in cxt_init_gpio_led()
162 unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask; in cxt_init_gpio_led()
170 spec->gpio_led); in cxt_init_gpio_led()
181 /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor in cx_fixup_headset_recog()
197 struct conexant_spec *spec = codec->spec; in cx_auto_init()
199 if (!spec->dynamic_eapd) in cx_auto_init()
200 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); in cx_auto_init()
205 if (spec->is_cx8070_sn6140) in cx_auto_init()
213 struct conexant_spec *spec = codec->spec; in cx_auto_shutdown()
217 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); in cx_auto_shutdown()
256 struct conexant_spec *spec = codec->spec; in cx_update_headset_mic_vref()
268 spec->headset_present_flag = CX_HEADSET_NOPRESENT; in cx_update_headset_mic_vref()
272 if (spec->headset_present_flag == CX_HEADSET_NOPRESENT) { in cx_update_headset_mic_vref()
273 spec->headset_present_flag = CX_HEADSET_PARTPRESENT; in cx_update_headset_mic_vref()
274 } else if (spec->headset_present_flag == CX_HEADSET_PARTPRESENT) { in cx_update_headset_mic_vref()
281 spec->headset_present_flag = CX_HEADSET_ALLPRESENT; in cx_update_headset_mic_vref()
289 struct conexant_spec *spec = codec->spec; in cx_jack_unsol_event()
291 if (spec->is_cx8070_sn6140) in cx_jack_unsol_event()
318 * pin fix-up
356 struct conexant_spec *spec = codec->spec; in cxt_fixup_stereo_dmic()
357 spec->gen.inv_dmic_split = 1; in cxt_fixup_stereo_dmic()
378 struct conexant_spec *spec = codec->spec; in cxt_update_headset_mode()
379 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in cxt_update_headset_mode()
381 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in cxt_update_headset_mode()
383 for (i = 0; i < cfg->num_inputs; i++) in cxt_update_headset_mode()
384 if (cfg->inputs[i].pin == mux_pin) { in cxt_update_headset_mode()
385 mic_mode = !!cfg->inputs[i].is_headphone_mic; in cxt_update_headset_mode()
390 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ in cxt_update_headset_mode()
391 spec->gen.hp_jack_present = false; in cxt_update_headset_mode()
393 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic … in cxt_update_headset_mode()
394 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); in cxt_update_headset_mode()
410 struct conexant_spec *spec = codec->spec; in cxt_fixup_headphone_mic()
414 spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; in cxt_fixup_headphone_mic()
415 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); in cxt_fixup_headphone_mic()
418 WARN_ON(spec->gen.cap_sync_hook); in cxt_fixup_headphone_mic()
419 spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; in cxt_fixup_headphone_mic()
420 spec->gen.automute_hook = cxt_update_headset_mode; in cxt_fixup_headphone_mic()
431 struct conexant_spec *spec = codec->spec; in cxt_fixup_headset_mic()
435 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in cxt_fixup_headset_mic()
442 /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
464 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_boost()
470 if (!spec->dc_enable) in olpc_xo_update_mic_boost()
479 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_pins()
483 cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; in olpc_xo_update_mic_pins()
485 /* Set up mic pins for port-B, C and F dynamically as the recording in olpc_xo_update_mic_pins()
488 if (!spec->dc_enable) { in olpc_xo_update_mic_pins()
491 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); in olpc_xo_update_mic_pins()
493 /* update port B (ext mic) and C (int mic) */ in olpc_xo_update_mic_pins()
500 update_mic_pin(codec, 0x1a, spec->recording ? in olpc_xo_update_mic_pins()
502 update_mic_pin(codec, 0x1b, spec->recording ? in olpc_xo_update_mic_pins()
519 if (spec->recording) in olpc_xo_update_mic_pins()
520 val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; in olpc_xo_update_mic_pins()
526 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); in olpc_xo_update_mic_pins()
527 snd_hda_activate_path(codec, spec->dc_mode_path, true, false); in olpc_xo_update_mic_pins()
535 struct conexant_spec *spec = codec->spec; in olpc_xo_automic()
538 if (!spec->dc_enable) in olpc_xo_automic()
541 if (spec->dc_enable) in olpc_xo_automic()
551 struct conexant_spec *spec = codec->spec; in olpc_xo_capture_hook()
553 /* toggle spec->recording flag and update mic pins accordingly in olpc_xo_capture_hook()
558 spec->recording = 1; in olpc_xo_capture_hook()
562 spec->recording = 0; in olpc_xo_capture_hook()
572 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_get()
573 ucontrol->value.integer.value[0] = spec->dc_enable; in olpc_xo_dc_mode_get()
581 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_put()
582 int dc_enable = !!ucontrol->value.integer.value[0]; in olpc_xo_dc_mode_put()
584 if (dc_enable == spec->dc_enable) in olpc_xo_dc_mode_put()
587 spec->dc_enable = dc_enable; in olpc_xo_dc_mode_put()
597 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_get()
598 ucontrol->value.enumerated.item[0] = spec->dc_input_bias; in olpc_xo_dc_bias_enum_get()
612 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_put()
616 idx = ucontrol->value.enumerated.item[0]; in olpc_xo_dc_bias_enum_put()
617 if (idx >= imux->num_items) in olpc_xo_dc_bias_enum_put()
618 idx = imux->num_items - 1; in olpc_xo_dc_bias_enum_put()
619 if (spec->dc_input_bias == idx) in olpc_xo_dc_bias_enum_put()
622 spec->dc_input_bias = idx; in olpc_xo_dc_bias_enum_put()
623 if (spec->dc_enable) in olpc_xo_dc_bias_enum_put()
653 struct conexant_spec *spec = codec->spec; in olpc_xo_mic_boost_put()
655 if (ret > 0 && spec->dc_enable) in olpc_xo_mic_boost_put()
663 struct conexant_spec *spec = codec->spec; in cxt_fixup_olpc_xo()
670 spec->gen.mic_autoswitch_hook = olpc_xo_automic; in cxt_fixup_olpc_xo()
671 spec->gen.pcm_capture_hook = olpc_xo_capture_hook; in cxt_fixup_olpc_xo()
672 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); in cxt_fixup_olpc_xo()
683 snd_array_for_each(&spec->gen.kctls, i, kctl) { in cxt_fixup_olpc_xo()
684 if (!strcmp(kctl->name, "Mic Boost Volume")) { in cxt_fixup_olpc_xo()
685 kctl->put = olpc_xo_mic_boost_put; in cxt_fixup_olpc_xo()
694 struct conexant_spec *spec = codec->spec; in cxt_fixup_mute_led_eapd()
697 spec->mute_led_eapd = 0x1b; in cxt_fixup_mute_led_eapd()
698 spec->dynamic_eapd = true; in cxt_fixup_mute_led_eapd()
746 struct conexant_spec *spec = codec->spec; in cxt_update_gpio_led()
747 unsigned int oldval = spec->gpio_led; in cxt_update_gpio_led()
749 if (spec->mute_led_polarity) in cxt_update_gpio_led()
753 spec->gpio_led |= mask; in cxt_update_gpio_led()
755 spec->gpio_led &= ~mask; in cxt_update_gpio_led()
757 mask, led_on, spec->gpio_led); in cxt_update_gpio_led()
758 if (spec->gpio_led != oldval) in cxt_update_gpio_led()
760 spec->gpio_led); in cxt_update_gpio_led()
767 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_mute_update()
768 struct conexant_spec *spec = codec->spec; in cxt_gpio_mute_update()
770 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness); in cxt_gpio_mute_update()
774 /* turn on/off mic-mute LED via GPIO per capture hook */
778 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_micmute_update()
779 struct conexant_spec *spec = codec->spec; in cxt_gpio_micmute_update()
781 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness); in cxt_gpio_micmute_update()
788 struct conexant_spec *spec = codec->spec; in cxt_setup_mute_led()
790 spec->gpio_led = 0; in cxt_setup_mute_led()
791 spec->mute_led_polarity = 0; in cxt_setup_mute_led()
794 spec->gpio_mute_led_mask = mute; in cxt_setup_mute_led()
798 spec->gpio_mic_led_mask = mic_mute; in cxt_setup_mute_led()
819 { 0x17, 0x21a11000 }, /* dock-mic */
820 { 0x19, 0x2121103f }, /* dock-HP */
828 { 0x1a, 0x21a190f0 }, /* dock-mic */
829 { 0x1c, 0x212140ff }, /* dock-HP */
845 /* SuoWoSi/South-holding JS201D with sn6140 */
946 { 0x12, 0x02a1901e }, /* ext mic */
971 { 0x16, 0x21011020 }, /* line-out */
972 { 0x18, 0x2181103f }, /* line-in */
1020 /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
1031 { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" },
1032 { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" },
1033 { .id = CXT_FIXUP_HP_530, .name = "hp-530" },
1045 { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" },
1056 { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" },
1089 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
1097 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
1099 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC),
1100 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
1106 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
1115 { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" },
1117 { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" },
1120 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
1121 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
1122 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
1123 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
1124 { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
1125 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
1126 { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" },
1127 { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" },
1128 { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" },
1129 { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" },
1133 /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
1138 struct conexant_spec *spec = codec->spec; in add_cx5051_fake_mutes()
1148 spec->gen.dac_min_mute = true; in add_cx5051_fake_mutes()
1156 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); in patch_conexant_auto()
1160 return -ENOMEM; in patch_conexant_auto()
1161 snd_hda_gen_spec_init(&spec->gen); in patch_conexant_auto()
1162 codec->spec = spec; in patch_conexant_auto()
1163 codec->patch_ops = cx_auto_patch_ops; in patch_conexant_auto()
1166 switch (codec->core.vendor_id) { in patch_conexant_auto()
1169 spec->is_cx8070_sn6140 = true; in patch_conexant_auto()
1170 spec->headset_present_flag = CX_HEADSET_NOPRESENT; in patch_conexant_auto()
1175 spec->gen.own_eapd_ctl = 1; in patch_conexant_auto()
1177 switch (codec->core.vendor_id) { in patch_conexant_auto()
1179 codec->single_adc_amp = 1; in patch_conexant_auto()
1180 spec->gen.mixer_nid = 0x17; in patch_conexant_auto()
1181 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1186 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1187 spec->gen.mixer_nid = 0x19; in patch_conexant_auto()
1188 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1194 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1199 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1200 spec->gen.mixer_nid = 0x22; in patch_conexant_auto()
1201 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1206 codec->power_save_node = 1; in patch_conexant_auto()
1209 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1215 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd) in patch_conexant_auto()
1216 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; in patch_conexant_auto()
1220 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, in patch_conexant_auto()
1221 spec->parse_flags); in patch_conexant_auto()
1229 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in patch_conexant_auto()
1234 * which falls into the single-cmd mode. in patch_conexant_auto()
1237 if (!codec->bus->core.sync_write) { in patch_conexant_auto()
1240 codec->bus->core.sync_write = 1; in patch_conexant_auto()
1241 codec->bus->allow_bus_reset = 1; in patch_conexant_auto()
1295 MODULE_DESCRIPTION("Conexant HD-audio codec");