Lines Matching +full:mic +full:- +full:offset
1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Tobin Davis <tdavis@dsl-only.net>
38 unsigned int dc_input_bias; /* offset into olpc_xo_dc_bias */
63 spec->gen.beep_nid = nid;
65 knew = snd_hda_gen_add_kctl(&spec->gen, NULL,
68 return -ENOMEM;
69 knew->private_value = beep_amp;
76 struct conexant_spec *spec = codec->spec;
95 struct conexant_spec *spec = codec->spec;
103 spec->eapds[spec->num_eapds++] = nid;
104 if (spec->num_eapds >= ARRAY_SIZE(spec->eapds))
114 if (spec->num_eapds > 2)
115 spec->dynamic_eapd = 1;
134 struct conexant_spec *spec = codec->spec;
136 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled);
143 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
144 struct conexant_spec *spec = codec->spec;
146 snd_hda_codec_write(codec, spec->mute_led_eapd, 0,
154 struct conexant_spec *spec = codec->spec;
155 unsigned int mask = spec->gpio_mute_led_mask | spec->gpio_mic_led_mask;
163 spec->gpio_led);
174 /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias registor
181 /* enable headset mic VREF */
184 /* disable headset mic VREF */
190 struct conexant_spec *spec = codec->spec;
192 if (!spec->dynamic_eapd)
193 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true);
198 if (spec->is_cx8070_sn6140)
206 struct conexant_spec *spec = codec->spec;
210 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
252 * Check hp&mic tag to process headset pulgin&plugout.
255 if (!(mic_present & AC_PINSENSE_PRESENCE)) /* mic plugout */
282 * pin fix-up
323 struct conexant_spec *spec = codec->spec;
324 spec->gen.inv_dmic_split = 1;
358 struct conexant_spec *spec = codec->spec;
359 struct auto_pin_cfg *cfg = &spec->gen.autocfg;
361 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]];
363 for (i = 0; i < cfg->num_inputs; i++)
364 if (cfg->inputs[i].pin == mux_pin) {
365 mic_mode = !!cfg->inputs[i].is_headphone_mic;
370 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */
371 spec->gen.hp_jack_present = false;
373 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic */
374 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]);
390 struct conexant_spec *spec = codec->spec;
394 spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC;
395 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410);
398 WARN_ON(spec->gen.cap_sync_hook);
399 spec->gen.cap_sync_hook = cxt_update_headset_mode_hook;
400 spec->gen.automute_hook = cxt_update_headset_mode;
411 struct conexant_spec *spec = codec->spec;
415 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
422 /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
444 struct conexant_spec *spec = codec->spec;
450 if (!spec->dc_enable)
459 struct conexant_spec *spec = codec->spec;
463 cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]];
465 /* Set up mic pins for port-B, C and F dynamically as the recording
468 if (!spec->dc_enable) {
471 snd_hda_activate_path(codec, spec->dc_mode_path, false, false);
473 /* update port B (ext mic) and C (int mic) */
474 /* OLPC defers mic widget control until when capture is
480 update_mic_pin(codec, 0x1a, spec->recording ?
482 update_mic_pin(codec, 0x1b, spec->recording ?
484 /* enable normal mic path */
489 /* disable normal mic path */
499 if (spec->recording)
500 val = olpc_xo_dc_bias.items[spec->dc_input_bias].index;
506 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0);
507 snd_hda_activate_path(codec, spec->dc_mode_path, true, false);
515 struct conexant_spec *spec = codec->spec;
518 if (!spec->dc_enable)
521 if (spec->dc_enable)
531 struct conexant_spec *spec = codec->spec;
533 /* toggle spec->recording flag and update mic pins accordingly
538 spec->recording = 1;
542 spec->recording = 0;
552 struct conexant_spec *spec = codec->spec;
553 ucontrol->value.integer.value[0] = spec->dc_enable;
561 struct conexant_spec *spec = codec->spec;
562 int dc_enable = !!ucontrol->value.integer.value[0];
564 if (dc_enable == spec->dc_enable)
567 spec->dc_enable = dc_enable;
577 struct conexant_spec *spec = codec->spec;
578 ucontrol->value.enumerated.item[0] = spec->dc_input_bias;
592 struct conexant_spec *spec = codec->spec;
596 idx = ucontrol->value.enumerated.item[0];
597 if (idx >= imux->num_items)
598 idx = imux->num_items - 1;
599 if (spec->dc_input_bias == idx)
602 spec->dc_input_bias = idx;
603 if (spec->dc_enable)
626 /* overriding mic boost put callback; update mic boost volume only when
633 struct conexant_spec *spec = codec->spec;
635 if (ret > 0 && spec->dc_enable)
643 struct conexant_spec *spec = codec->spec;
650 spec->gen.mic_autoswitch_hook = olpc_xo_automic;
651 spec->gen.pcm_capture_hook = olpc_xo_capture_hook;
652 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0);
657 * therefore we use a 50% mic bias in order to center the input signal
662 /* override mic boost control */
663 snd_array_for_each(&spec->gen.kctls, i, kctl) {
664 if (!strcmp(kctl->name, "Mic Boost Volume")) {
665 kctl->put = olpc_xo_mic_boost_put;
674 struct conexant_spec *spec = codec->spec;
677 spec->mute_led_eapd = 0x1b;
678 spec->dynamic_eapd = true;
685 * (originally it has 0x2b steps with 0dB offset 0x14)
699 * (originally it has 0x1e steps with 0 dB offset 0x17)
715 /* the mic pin (0x19) doesn't give an unsolicited event;
716 * probe the mic pin together with the headphone pin (0x16)
726 struct conexant_spec *spec = codec->spec;
727 unsigned int oldval = spec->gpio_led;
729 if (spec->mute_led_polarity)
733 spec->gpio_led |= mask;
735 spec->gpio_led &= ~mask;
737 mask, led_on, spec->gpio_led);
738 if (spec->gpio_led != oldval)
740 spec->gpio_led);
747 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
748 struct conexant_spec *spec = codec->spec;
750 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness);
754 /* turn on/off mic-mute LED via GPIO per capture hook */
758 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
759 struct conexant_spec *spec = codec->spec;
761 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness);
768 struct conexant_spec *spec = codec->spec;
770 spec->gpio_led = 0;
771 spec->mute_led_polarity = 0;
774 spec->gpio_mute_led_mask = mute;
778 spec->gpio_mic_led_mask = mic_mute;
820 { 0x17, 0x21a11000 }, /* dock-mic */
821 { 0x19, 0x2121103f }, /* dock-HP */
829 { 0x1a, 0x21a190f0 }, /* dock-mic */
830 { 0x1c, 0x212140ff }, /* dock-HP */
836 { 0x1a, 0x90a10020 }, /* Internal mic */
837 { 0x1b, 0x03a11020 }, /* External mic */
846 /* SuoWoSi/South-holding JS201D with sn6140 */
850 { 0x18, 0x95a70130 }, /* Internal mic */
851 { 0x19, 0x03a11020 }, /* Headset Mic */
881 /* 0x17 was falsely set up as a mic, it should 0x1d */
908 { 0x18, 0x03a1913d }, /* use as headphone mic, without its own jack detect */
947 { 0x12, 0x02a1901e }, /* ext mic */
948 { 0x14, 0x95a70110 }, /* int mic */
955 { 0x12, 0x90a60160 }, /* int mic */
972 { 0x16, 0x21011020 }, /* line-out */
973 { 0x18, 0x2181103f }, /* line-in */
1036 /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
1047 { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" },
1048 { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" },
1049 { .id = CXT_FIXUP_HP_530, .name = "hp-530" },
1061 { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" },
1072 { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" },
1105 SND_PCI_QUIRK(0x14f1, 0x0252, "MBX-Z60MR100", CXT_FIXUP_HP_A_U),
1107 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
1115 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
1117 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC),
1118 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
1124 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
1135 { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" },
1137 { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" },
1140 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
1141 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
1142 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
1143 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
1144 { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
1145 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
1146 { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" },
1147 { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" },
1148 { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" },
1149 { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" },
1150 { .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" },
1151 { .id = CXT_FIXUP_HP_A_U, .name = "HP-U-support" },
1155 /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
1160 struct conexant_spec *spec = codec->spec;
1170 spec->gen.dac_min_mute = true;
1178 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1182 return -ENOMEM;
1183 snd_hda_gen_spec_init(&spec->gen);
1184 codec->spec = spec;
1185 codec->patch_ops = cx_auto_patch_ops;
1188 switch (codec->core.vendor_id) {
1191 spec->is_cx8070_sn6140 = true;
1197 spec->gen.own_eapd_ctl = 1;
1199 switch (codec->core.vendor_id) {
1201 codec->single_adc_amp = 1;
1202 spec->gen.mixer_nid = 0x17;
1203 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1208 codec->pin_amp_workaround = 1;
1209 spec->gen.mixer_nid = 0x19;
1210 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1216 codec->pin_amp_workaround = 1;
1221 codec->pin_amp_workaround = 1;
1222 spec->gen.mixer_nid = 0x22;
1223 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO;
1228 codec->power_save_node = 1;
1231 codec->pin_amp_workaround = 1;
1237 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd)
1238 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook;
1242 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1243 spec->parse_flags);
1251 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1256 * which falls into the single-cmd mode.
1259 if (!codec->bus->core.sync_write) {
1262 codec->bus->core.sync_write = 1;
1263 codec->bus->allow_bus_reset = 1;
1317 MODULE_DESCRIPTION("Conexant HD-audio codec");