Lines Matching +full:codec +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * HD audio interface patch for Conexant HDA audio codec
7 * Tobin Davis <tdavis@dsl-only.net>
52 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
53 HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
60 unsigned int beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir); in set_beep_amp()
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()
74 static int cx_auto_parse_beep(struct hda_codec *codec) in cx_auto_parse_beep() argument
76 struct conexant_spec *spec = codec->spec; in cx_auto_parse_beep()
79 for_each_hda_codec_node(nid, codec) in cx_auto_parse_beep()
80 if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) in cx_auto_parse_beep()
85 #define cx_auto_parse_beep(codec) 0 argument
93 static void cx_auto_parse_eapd(struct hda_codec *codec) in cx_auto_parse_eapd() argument
95 struct conexant_spec *spec = codec->spec; in cx_auto_parse_eapd()
98 for_each_hda_codec_node(nid, codec) { in cx_auto_parse_eapd()
99 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in cx_auto_parse_eapd()
101 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) 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()
118 static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, in cx_auto_turn_eapd() argument
123 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) in cx_auto_turn_eapd()
124 snd_hda_codec_write(codec, pins[i], 0, in cx_auto_turn_eapd()
133 struct hda_codec *codec = private_data; in cx_auto_vmaster_hook() local
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() local
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()
152 static void cxt_init_gpio_led(struct hda_codec *codec) in cxt_init_gpio_led() argument
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()
158 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, in cxt_init_gpio_led()
160 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, in cxt_init_gpio_led()
162 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cxt_init_gpio_led()
163 spec->gpio_led); in cxt_init_gpio_led()
167 static void cx_fixup_headset_recog(struct hda_codec *codec) in cx_fixup_headset_recog() argument
173 snd_hda_codec_write(codec, 0x1c, 0, 0x320, 0x010); in cx_fixup_headset_recog()
174 /* set OFF voltage for DFET from -1.2V to -0.8V, set headset micbias register in cx_fixup_headset_recog()
177 snd_hda_codec_write(codec, 0x1c, 0, 0x3b0, 0xe10); in cx_fixup_headset_recog()
179 mic_present = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); in cx_fixup_headset_recog()
182 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_fixup_headset_recog()
185 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); in cx_fixup_headset_recog()
188 static int cx_auto_init(struct hda_codec *codec) in cx_auto_init() argument
190 struct conexant_spec *spec = codec->spec; in cx_auto_init()
191 snd_hda_gen_init(codec); in cx_auto_init()
192 if (!spec->dynamic_eapd) in cx_auto_init()
193 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); in cx_auto_init()
195 cxt_init_gpio_led(codec); in cx_auto_init()
196 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in cx_auto_init()
198 if (spec->is_cx8070_sn6140) in cx_auto_init()
199 cx_fixup_headset_recog(codec); in cx_auto_init()
204 static void cx_auto_shutdown(struct hda_codec *codec) in cx_auto_shutdown() argument
206 struct conexant_spec *spec = codec->spec; in cx_auto_shutdown()
208 snd_hda_gen_shutup_speakers(codec); in cx_auto_shutdown()
210 /* Turn the problematic codec into D3 to avoid spurious noises in cx_auto_shutdown()
212 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); in cx_auto_shutdown()
215 static void cx_auto_free(struct hda_codec *codec) in cx_auto_free() argument
217 cx_auto_shutdown(codec); in cx_auto_free()
218 snd_hda_gen_free(codec); in cx_auto_free()
221 static void cx_process_headset_plugin(struct hda_codec *codec) in cx_process_headset_plugin() argument
228 val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0); in cx_process_headset_plugin()
230 codec_dbg(codec, "headset type detect done!\n"); in cx_process_headset_plugin()
236 val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0); in cx_process_headset_plugin()
238 codec_dbg(codec, "headset plugin, type is CTIA\n"); in cx_process_headset_plugin()
239 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_process_headset_plugin()
241 codec_dbg(codec, "headset plugin, type is OMTP\n"); in cx_process_headset_plugin()
242 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_process_headset_plugin()
244 codec_dbg(codec, "headphone plugin\n"); in cx_process_headset_plugin()
248 static void cx_update_headset_mic_vref(struct hda_codec *codec, struct hda_jack_callback *event) in cx_update_headset_mic_vref() argument
256 mic_present = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); in cx_update_headset_mic_vref()
258 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); in cx_update_headset_mic_vref()
260 cx_process_headset_plugin(codec); in cx_update_headset_mic_vref()
263 static int cx_auto_suspend(struct hda_codec *codec) in cx_auto_suspend() argument
265 cx_auto_shutdown(codec); in cx_auto_suspend()
280 * pin fix-up
317 static void cxt_fixup_stereo_dmic(struct hda_codec *codec, in cxt_fixup_stereo_dmic() argument
320 struct conexant_spec *spec = codec->spec; in cxt_fixup_stereo_dmic()
321 spec->gen.inv_dmic_split = 1; in cxt_fixup_stereo_dmic()
325 static void cxt_fixup_update_pinctl(struct hda_codec *codec, in cxt_fixup_update_pinctl() argument
330 * This is the value stored in the codec register after in cxt_fixup_update_pinctl()
333 snd_hda_set_pin_ctl_cache(codec, 0x1d, AC_PINCTL_HP_EN); in cxt_fixup_update_pinctl()
337 static void cxt5066_increase_mic_boost(struct hda_codec *codec, in cxt5066_increase_mic_boost() argument
343 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, in cxt5066_increase_mic_boost()
350 static void cxt_update_headset_mode(struct hda_codec *codec) in cxt_update_headset_mode() argument
352 /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */ in cxt_update_headset_mode()
355 struct conexant_spec *spec = codec->spec; in cxt_update_headset_mode()
356 struct auto_pin_cfg *cfg = &spec->gen.autocfg; in cxt_update_headset_mode()
358 hda_nid_t mux_pin = spec->gen.imux_pins[spec->gen.cur_mux[0]]; in cxt_update_headset_mode()
360 for (i = 0; i < cfg->num_inputs; i++) in cxt_update_headset_mode()
361 if (cfg->inputs[i].pin == mux_pin) { in cxt_update_headset_mode()
362 mic_mode = !!cfg->inputs[i].is_headphone_mic; in cxt_update_headset_mode()
367 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ in cxt_update_headset_mode()
368 spec->gen.hp_jack_present = false; in cxt_update_headset_mode()
370 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic … in cxt_update_headset_mode()
371 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); in cxt_update_headset_mode()
374 snd_hda_gen_update_outputs(codec); in cxt_update_headset_mode()
377 static void cxt_update_headset_mode_hook(struct hda_codec *codec, in cxt_update_headset_mode_hook() argument
381 cxt_update_headset_mode(codec); in cxt_update_headset_mode_hook()
384 static void cxt_fixup_headphone_mic(struct hda_codec *codec, in cxt_fixup_headphone_mic() argument
387 struct conexant_spec *spec = codec->spec; in cxt_fixup_headphone_mic()
391 spec->parse_flags |= HDA_PINCFG_HEADPHONE_MIC; in cxt_fixup_headphone_mic()
392 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); in cxt_fixup_headphone_mic()
395 WARN_ON(spec->gen.cap_sync_hook); in cxt_fixup_headphone_mic()
396 spec->gen.cap_sync_hook = cxt_update_headset_mode_hook; in cxt_fixup_headphone_mic()
397 spec->gen.automute_hook = cxt_update_headset_mode; in cxt_fixup_headphone_mic()
400 cxt_update_headset_mode(codec); in cxt_fixup_headphone_mic()
405 static void cxt_fixup_headset_mic(struct hda_codec *codec, in cxt_fixup_headset_mic() argument
408 struct conexant_spec *spec = codec->spec; in cxt_fixup_headset_mic()
412 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC; in cxt_fixup_headset_mic()
419 /* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
426 #define update_mic_pin(codec, nid, val) \ argument
427 snd_hda_codec_write_cache(codec, nid, 0, \
439 static void olpc_xo_update_mic_boost(struct hda_codec *codec) in olpc_xo_update_mic_boost() argument
441 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_boost()
447 if (!spec->dc_enable) in olpc_xo_update_mic_boost()
448 val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); in olpc_xo_update_mic_boost()
449 snd_hda_codec_write(codec, 0x17, 0, in olpc_xo_update_mic_boost()
454 static void olpc_xo_update_mic_pins(struct hda_codec *codec) in olpc_xo_update_mic_pins() argument
456 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_pins()
460 cur_input = spec->gen.input_paths[0][spec->gen.cur_mux[0]]; in olpc_xo_update_mic_pins()
462 /* Set up mic pins for port-B, C and F dynamically as the recording in olpc_xo_update_mic_pins()
465 if (!spec->dc_enable) { in olpc_xo_update_mic_pins()
467 update_mic_pin(codec, 0x1e, 0); in olpc_xo_update_mic_pins()
468 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); in olpc_xo_update_mic_pins()
477 update_mic_pin(codec, 0x1a, spec->recording ? in olpc_xo_update_mic_pins()
478 snd_hda_codec_get_pin_target(codec, 0x1a) : 0); in olpc_xo_update_mic_pins()
479 update_mic_pin(codec, 0x1b, spec->recording ? in olpc_xo_update_mic_pins()
480 snd_hda_codec_get_pin_target(codec, 0x1b) : 0); in olpc_xo_update_mic_pins()
482 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
484 snd_hda_activate_path(codec, path, true, false); in olpc_xo_update_mic_pins()
487 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
489 snd_hda_activate_path(codec, path, false, false); in olpc_xo_update_mic_pins()
496 if (spec->recording) in olpc_xo_update_mic_pins()
497 val = olpc_xo_dc_bias.items[spec->dc_input_bias].index; in olpc_xo_update_mic_pins()
500 update_mic_pin(codec, 0x1a, val); in olpc_xo_update_mic_pins()
501 update_mic_pin(codec, 0x1b, 0); in olpc_xo_update_mic_pins()
503 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); in olpc_xo_update_mic_pins()
504 snd_hda_activate_path(codec, spec->dc_mode_path, true, false); in olpc_xo_update_mic_pins()
509 static void olpc_xo_automic(struct hda_codec *codec, in olpc_xo_automic() argument
512 struct conexant_spec *spec = codec->spec; in olpc_xo_automic()
515 if (!spec->dc_enable) in olpc_xo_automic()
516 snd_hda_gen_mic_autoswitch(codec, jack); in olpc_xo_automic()
517 olpc_xo_update_mic_pins(codec); in olpc_xo_automic()
518 if (spec->dc_enable) in olpc_xo_automic()
519 olpc_xo_update_mic_boost(codec); in olpc_xo_automic()
524 struct hda_codec *codec, in olpc_xo_capture_hook() argument
528 struct conexant_spec *spec = codec->spec; in olpc_xo_capture_hook()
530 /* toggle spec->recording flag and update mic pins accordingly in olpc_xo_capture_hook()
535 spec->recording = 1; in olpc_xo_capture_hook()
536 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
539 spec->recording = 0; in olpc_xo_capture_hook()
540 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
548 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_get() local
549 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_get()
550 ucontrol->value.integer.value[0] = spec->dc_enable; in olpc_xo_dc_mode_get()
557 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_put() local
558 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_put()
559 int dc_enable = !!ucontrol->value.integer.value[0]; in olpc_xo_dc_mode_put()
561 if (dc_enable == spec->dc_enable) in olpc_xo_dc_mode_put()
564 spec->dc_enable = dc_enable; in olpc_xo_dc_mode_put()
565 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_mode_put()
566 olpc_xo_update_mic_boost(codec); in olpc_xo_dc_mode_put()
567 return 1; in olpc_xo_dc_mode_put()
573 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_get() local
574 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_get()
575 ucontrol->value.enumerated.item[0] = spec->dc_input_bias; in olpc_xo_dc_bias_enum_get()
588 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_put() local
589 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_put()
593 idx = ucontrol->value.enumerated.item[0]; in olpc_xo_dc_bias_enum_put()
594 if (idx >= imux->num_items) in olpc_xo_dc_bias_enum_put()
595 idx = imux->num_items - 1; in olpc_xo_dc_bias_enum_put()
596 if (spec->dc_input_bias == idx) in olpc_xo_dc_bias_enum_put()
599 spec->dc_input_bias = idx; in olpc_xo_dc_bias_enum_put()
600 if (spec->dc_enable) in olpc_xo_dc_bias_enum_put()
601 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_bias_enum_put()
602 return 1; in olpc_xo_dc_bias_enum_put()
629 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_mic_boost_put() local
630 struct conexant_spec *spec = codec->spec; in olpc_xo_mic_boost_put()
632 if (ret > 0 && spec->dc_enable) in olpc_xo_mic_boost_put()
633 olpc_xo_update_mic_boost(codec); in olpc_xo_mic_boost_put()
637 static void cxt_fixup_olpc_xo(struct hda_codec *codec, in cxt_fixup_olpc_xo() argument
640 struct conexant_spec *spec = codec->spec; in cxt_fixup_olpc_xo()
647 spec->gen.mic_autoswitch_hook = olpc_xo_automic; in cxt_fixup_olpc_xo()
648 spec->gen.pcm_capture_hook = olpc_xo_capture_hook; in cxt_fixup_olpc_xo()
649 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); in cxt_fixup_olpc_xo()
651 snd_hda_add_new_ctls(codec, olpc_xo_mixers); in cxt_fixup_olpc_xo()
655 * with the DC input range of the codec. in cxt_fixup_olpc_xo()
657 snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); in cxt_fixup_olpc_xo()
660 snd_array_for_each(&spec->gen.kctls, i, kctl) { in cxt_fixup_olpc_xo()
661 if (!strcmp(kctl->name, "Mic Boost Volume")) { in cxt_fixup_olpc_xo()
662 kctl->put = olpc_xo_mic_boost_put; in cxt_fixup_olpc_xo()
668 static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, in cxt_fixup_mute_led_eapd() argument
671 struct conexant_spec *spec = codec->spec; in cxt_fixup_mute_led_eapd()
674 spec->mute_led_eapd = 0x1b; in cxt_fixup_mute_led_eapd()
675 spec->dynamic_eapd = true; in cxt_fixup_mute_led_eapd()
676 snd_hda_gen_add_mute_led_cdev(codec, cx_auto_vmaster_mute_led); in cxt_fixup_mute_led_eapd()
684 static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, in cxt_fixup_cap_mix_amp() argument
687 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, in cxt_fixup_cap_mix_amp()
691 (1 << AC_AMPCAP_MUTE_SHIFT)); in cxt_fixup_cap_mix_amp()
698 static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, in cxt_fixup_cap_mix_amp_5047() argument
701 snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, in cxt_fixup_cap_mix_amp_5047()
705 (1 << AC_AMPCAP_MUTE_SHIFT)); in cxt_fixup_cap_mix_amp_5047()
708 static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, in cxt_fixup_hp_gate_mic_jack() argument
716 snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); in cxt_fixup_hp_gate_mic_jack()
720 static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, in cxt_update_gpio_led() argument
723 struct conexant_spec *spec = codec->spec; in cxt_update_gpio_led()
724 unsigned int oldval = spec->gpio_led; in cxt_update_gpio_led()
726 if (spec->mute_led_polarity) in cxt_update_gpio_led()
730 spec->gpio_led |= mask; in cxt_update_gpio_led()
732 spec->gpio_led &= ~mask; in cxt_update_gpio_led()
733 codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", in cxt_update_gpio_led()
734 mask, led_on, spec->gpio_led); in cxt_update_gpio_led()
735 if (spec->gpio_led != oldval) in cxt_update_gpio_led()
736 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cxt_update_gpio_led()
737 spec->gpio_led); in cxt_update_gpio_led()
744 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_mute_update() local
745 struct conexant_spec *spec = codec->spec; in cxt_gpio_mute_update()
747 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness); in cxt_gpio_mute_update()
751 /* turn on/off mic-mute LED via GPIO per capture hook */
755 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_micmute_update() local
756 struct conexant_spec *spec = codec->spec; in cxt_gpio_micmute_update()
758 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness); in cxt_gpio_micmute_update()
762 static void cxt_setup_mute_led(struct hda_codec *codec, in cxt_setup_mute_led() argument
765 struct conexant_spec *spec = codec->spec; in cxt_setup_mute_led()
767 spec->gpio_led = 0; in cxt_setup_mute_led()
768 spec->mute_led_polarity = 0; in cxt_setup_mute_led()
770 snd_hda_gen_add_mute_led_cdev(codec, cxt_gpio_mute_update); in cxt_setup_mute_led()
771 spec->gpio_mute_led_mask = mute; in cxt_setup_mute_led()
774 snd_hda_gen_add_micmute_led_cdev(codec, cxt_gpio_micmute_update); in cxt_setup_mute_led()
775 spec->gpio_mic_led_mask = mic_mute; in cxt_setup_mute_led()
779 static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, in cxt_fixup_mute_led_gpio() argument
783 cxt_setup_mute_led(codec, 0x01, 0x02); in cxt_fixup_mute_led_gpio()
786 static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec, in cxt_fixup_hp_zbook_mute_led() argument
790 cxt_setup_mute_led(codec, 0x10, 0x20); in cxt_fixup_hp_zbook_mute_led()
796 { 0x17, 0x21a11000 }, /* dock-mic */
797 { 0x19, 0x2121103f }, /* dock-HP */
805 { 0x1a, 0x21a190f0 }, /* dock-mic */
806 { 0x1c, 0x212140ff }, /* dock-HP */
822 /* SuoWoSi/South-holding JS201D with sn6140 */
835 * which has incompatible pin setup, so we check the codec SSID (luckily
838 static void cxt_fixup_sirius_top_speaker(struct hda_codec *codec, in cxt_fixup_sirius_top_speaker() argument
842 /* ignore for incorrectly picked-up pang14 */ in cxt_fixup_sirius_top_speaker()
843 if (codec->core.subsystem_id == 0x278212b3) in cxt_fixup_sirius_top_speaker()
847 snd_hda_codec_set_pincfg(codec, 0x1d, 0x82170111); in cxt_fixup_sirius_top_speaker()
965 { 0x16, 0x21011020 }, /* line-out */
966 { 0x18, 0x2181103f }, /* line-in */
1022 /* HP, Packard Bell, Fujitsu-Siemens & Lenovo laptops have
1033 { .id = CXT_FIXUP_CAP_MIX_AMP, .name = "cap-mix-amp" },
1034 { .id = CXT_FIXUP_TOSHIBA_P105, .name = "toshiba-p105" },
1035 { .id = CXT_FIXUP_HP_530, .name = "hp-530" },
1047 { .id = CXT_FIXUP_CAP_MIX_AMP_5047, .name = "cap-mix-amp" },
1058 { .id = CXT_PINCFG_LENOVO_X200, .name = "lenovo-x200" },
1092 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
1100 SND_PCI_QUIRK(0x17aa, 0x21db, "Lenovo X220-tablet", CXT_PINCFG_LENOVO_TP410),
1102 SND_PCI_QUIRK(0x17aa, 0x3905, "Lenovo G50-30", CXT_FIXUP_STEREO_DMIC),
1103 SND_PCI_QUIRK(0x17aa, 0x390b, "Lenovo G50-80", CXT_FIXUP_STEREO_DMIC),
1109 SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo G50-70", CXT_FIXUP_STEREO_DMIC),
1120 { .id = CXT_FIXUP_STEREO_DMIC, .name = "stereo-dmic" },
1122 { .id = CXT_FIXUP_HEADPHONE_MIC_PIN, .name = "headphone-mic-pin" },
1125 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
1126 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
1127 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
1128 { .id = CXT_FIXUP_MUTE_LED_EAPD, .name = "mute-led-eapd" },
1129 { .id = CXT_FIXUP_HP_DOCK, .name = "hp-dock" },
1130 { .id = CXT_FIXUP_MUTE_LED_GPIO, .name = "mute-led-gpio" },
1131 { .id = CXT_FIXUP_HP_ZBOOK_MUTE_LED, .name = "hp-zbook-mute-led" },
1132 { .id = CXT_FIXUP_HP_MIC_NO_PRESENCE, .name = "hp-mic-fix" },
1133 { .id = CXT_PINCFG_LENOVO_NOTEBOOK, .name = "lenovo-20149" },
1134 { .id = CXT_PINCFG_SWS_JS201D, .name = "sws-js201d" },
1135 { .id = CXT_PINCFG_TOP_SPEAKER, .name = "sirius-top-speaker" },
1139 /* add "fake" mute amp-caps to DACs on cx5051 so that mixer mute switches
1142 static void add_cx5051_fake_mutes(struct hda_codec *codec) in add_cx5051_fake_mutes() argument
1144 struct conexant_spec *spec = codec->spec; in add_cx5051_fake_mutes()
1151 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, in add_cx5051_fake_mutes()
1153 query_amp_caps(codec, *p, HDA_OUTPUT)); in add_cx5051_fake_mutes()
1154 spec->gen.dac_min_mute = true; in add_cx5051_fake_mutes()
1157 static int patch_conexant_auto(struct hda_codec *codec) in patch_conexant_auto() argument
1162 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); in patch_conexant_auto()
1166 return -ENOMEM; in patch_conexant_auto()
1167 snd_hda_gen_spec_init(&spec->gen); in patch_conexant_auto()
1168 codec->spec = spec; in patch_conexant_auto()
1169 codec->patch_ops = cx_auto_patch_ops; in patch_conexant_auto()
1172 switch (codec->core.vendor_id) { in patch_conexant_auto()
1175 spec->is_cx8070_sn6140 = true; in patch_conexant_auto()
1176 snd_hda_jack_detect_enable_callback(codec, 0x19, cx_update_headset_mic_vref); in patch_conexant_auto()
1180 cx_auto_parse_eapd(codec); in patch_conexant_auto()
1181 spec->gen.own_eapd_ctl = 1; in patch_conexant_auto()
1183 switch (codec->core.vendor_id) { in patch_conexant_auto()
1185 codec->single_adc_amp = 1; in patch_conexant_auto()
1186 spec->gen.mixer_nid = 0x17; in patch_conexant_auto()
1187 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1188 snd_hda_pick_fixup(codec, cxt5045_fixup_models, in patch_conexant_auto()
1192 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1193 spec->gen.mixer_nid = 0x19; in patch_conexant_auto()
1194 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1195 snd_hda_pick_fixup(codec, cxt5047_fixup_models, in patch_conexant_auto()
1199 add_cx5051_fake_mutes(codec); in patch_conexant_auto()
1200 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1201 snd_hda_pick_fixup(codec, cxt5051_fixup_models, in patch_conexant_auto()
1205 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1206 spec->gen.mixer_nid = 0x22; in patch_conexant_auto()
1207 spec->gen.add_stereo_mix_input = HDA_HINT_STEREO_MIX_AUTO; in patch_conexant_auto()
1208 snd_hda_pick_fixup(codec, cxt5066_fixup_models, in patch_conexant_auto()
1212 codec->power_save_node = 1; in patch_conexant_auto()
1215 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1216 snd_hda_pick_fixup(codec, cxt5066_fixup_models, in patch_conexant_auto()
1221 if (!spec->gen.vmaster_mute.hook && spec->dynamic_eapd) in patch_conexant_auto()
1222 spec->gen.vmaster_mute.hook = cx_auto_vmaster_hook; in patch_conexant_auto()
1224 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_conexant_auto()
1226 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, in patch_conexant_auto()
1227 spec->parse_flags); in patch_conexant_auto()
1231 err = cx_auto_parse_beep(codec); in patch_conexant_auto()
1235 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in patch_conexant_auto()
1240 * which falls into the single-cmd mode. in patch_conexant_auto()
1243 if (!codec->bus->core.sync_write) { in patch_conexant_auto()
1244 codec_info(codec, in patch_conexant_auto()
1246 codec->bus->core.sync_write = 1; in patch_conexant_auto()
1247 codec->bus->allow_bus_reset = 1; in patch_conexant_auto()
1250 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_conexant_auto()
1255 cx_auto_free(codec); in patch_conexant_auto()
1301 MODULE_DESCRIPTION("Conexant HD-audio codec");