Lines Matching refs:codec
81 static int cx_auto_parse_beep(struct hda_codec *codec) in cx_auto_parse_beep() argument
83 struct conexant_spec *spec = codec->spec; in cx_auto_parse_beep()
86 for_each_hda_codec_node(nid, codec) in cx_auto_parse_beep()
87 if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) in cx_auto_parse_beep()
92 #define cx_auto_parse_beep(codec) 0 argument
100 static void cx_auto_parse_eapd(struct hda_codec *codec) in cx_auto_parse_eapd() argument
102 struct conexant_spec *spec = codec->spec; in cx_auto_parse_eapd()
105 for_each_hda_codec_node(nid, codec) { in cx_auto_parse_eapd()
106 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in cx_auto_parse_eapd()
108 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) in cx_auto_parse_eapd()
125 static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, in cx_auto_turn_eapd() argument
130 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) in cx_auto_turn_eapd()
131 snd_hda_codec_write(codec, pins[i], 0, in cx_auto_turn_eapd()
140 struct hda_codec *codec = private_data; in cx_auto_vmaster_hook() local
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() local
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()
159 static void cxt_init_gpio_led(struct hda_codec *codec) in cxt_init_gpio_led() argument
161 struct conexant_spec *spec = codec->spec; in cxt_init_gpio_led()
165 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, in cxt_init_gpio_led()
167 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION, in cxt_init_gpio_led()
169 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cxt_init_gpio_led()
174 static void cx_fixup_headset_recog(struct hda_codec *codec) in cx_fixup_headset_recog() argument
180 snd_hda_codec_write(codec, 0x1c, 0, 0x320, 0x010); in cx_fixup_headset_recog()
184 snd_hda_codec_write(codec, 0x1c, 0, 0x3b0, 0xe10); in cx_fixup_headset_recog()
186 mic_persent = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0x0); in cx_fixup_headset_recog()
189 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_fixup_headset_recog()
192 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); in cx_fixup_headset_recog()
195 static int cx_auto_init(struct hda_codec *codec) in cx_auto_init() argument
197 struct conexant_spec *spec = codec->spec; in cx_auto_init()
198 snd_hda_gen_init(codec); in cx_auto_init()
200 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); in cx_auto_init()
202 cxt_init_gpio_led(codec); in cx_auto_init()
203 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in cx_auto_init()
206 cx_fixup_headset_recog(codec); in cx_auto_init()
211 static void cx_auto_shutdown(struct hda_codec *codec) in cx_auto_shutdown() argument
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()
220 static void cx_auto_free(struct hda_codec *codec) in cx_auto_free() argument
222 cx_auto_shutdown(codec); in cx_auto_free()
223 snd_hda_gen_free(codec); in cx_auto_free()
226 static void cx_process_headset_plugin(struct hda_codec *codec) in cx_process_headset_plugin() argument
233 val = snd_hda_codec_read(codec, 0x1c, 0, 0xca0, 0x0); in cx_process_headset_plugin()
235 codec_dbg(codec, "headset type detect done!\n"); in cx_process_headset_plugin()
241 val = snd_hda_codec_read(codec, 0x1c, 0, 0xcb0, 0x0); in cx_process_headset_plugin()
243 codec_dbg(codec, "headset plugin, type is CTIA\n"); in cx_process_headset_plugin()
244 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_process_headset_plugin()
246 codec_dbg(codec, "headset plugin, type is OMTP\n"); in cx_process_headset_plugin()
247 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24); in cx_process_headset_plugin()
249 codec_dbg(codec, "headphone plugin\n"); in cx_process_headset_plugin()
253 static void cx_update_headset_mic_vref(struct hda_codec *codec, unsigned int res) in cx_update_headset_mic_vref() argument
256 struct conexant_spec *spec = codec->spec; in cx_update_headset_mic_vref()
262 phone_tag = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); in cx_update_headset_mic_vref()
263 mic_tag = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_UNSOLICITED_RESPONSE, 0x0); in cx_update_headset_mic_vref()
266 phone_present = snd_hda_codec_read(codec, 0x16, 0, AC_VERB_GET_PIN_SENSE, 0x0); in cx_update_headset_mic_vref()
269 snd_hda_codec_write(codec, 0x19, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20); in cx_update_headset_mic_vref()
275 mic_persent = snd_hda_codec_read(codec, 0x19, 0, in cx_update_headset_mic_vref()
280 cx_process_headset_plugin(codec); in cx_update_headset_mic_vref()
287 static void cx_jack_unsol_event(struct hda_codec *codec, unsigned int res) in cx_jack_unsol_event() argument
289 struct conexant_spec *spec = codec->spec; in cx_jack_unsol_event()
292 cx_update_headset_mic_vref(codec, res); in cx_jack_unsol_event()
294 snd_hda_jack_unsol_event(codec, res); in cx_jack_unsol_event()
298 static int cx_auto_suspend(struct hda_codec *codec) in cx_auto_suspend() argument
300 cx_auto_shutdown(codec); in cx_auto_suspend()
353 static void cxt_fixup_stereo_dmic(struct hda_codec *codec, in cxt_fixup_stereo_dmic() argument
356 struct conexant_spec *spec = codec->spec; in cxt_fixup_stereo_dmic()
360 static void cxt5066_increase_mic_boost(struct hda_codec *codec, in cxt5066_increase_mic_boost() argument
366 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, in cxt5066_increase_mic_boost()
373 static void cxt_update_headset_mode(struct hda_codec *codec) in cxt_update_headset_mode() argument
378 struct conexant_spec *spec = codec->spec; 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()
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()
397 snd_hda_gen_update_outputs(codec); in cxt_update_headset_mode()
400 static void cxt_update_headset_mode_hook(struct hda_codec *codec, in cxt_update_headset_mode_hook() argument
404 cxt_update_headset_mode(codec); in cxt_update_headset_mode_hook()
407 static void cxt_fixup_headphone_mic(struct hda_codec *codec, in cxt_fixup_headphone_mic() argument
410 struct conexant_spec *spec = codec->spec; in cxt_fixup_headphone_mic()
415 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); in cxt_fixup_headphone_mic()
423 cxt_update_headset_mode(codec); in cxt_fixup_headphone_mic()
428 static void cxt_fixup_headset_mic(struct hda_codec *codec, in cxt_fixup_headset_mic() argument
431 struct conexant_spec *spec = codec->spec; in cxt_fixup_headset_mic()
449 #define update_mic_pin(codec, nid, val) \ argument
450 snd_hda_codec_write_cache(codec, nid, 0, \
462 static void olpc_xo_update_mic_boost(struct hda_codec *codec) in olpc_xo_update_mic_boost() argument
464 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_boost()
471 val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); in olpc_xo_update_mic_boost()
472 snd_hda_codec_write(codec, 0x17, 0, in olpc_xo_update_mic_boost()
477 static void olpc_xo_update_mic_pins(struct hda_codec *codec) in olpc_xo_update_mic_pins() argument
479 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_pins()
490 update_mic_pin(codec, 0x1e, 0); in olpc_xo_update_mic_pins()
491 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); in olpc_xo_update_mic_pins()
500 update_mic_pin(codec, 0x1a, spec->recording ? in olpc_xo_update_mic_pins()
501 snd_hda_codec_get_pin_target(codec, 0x1a) : 0); in olpc_xo_update_mic_pins()
502 update_mic_pin(codec, 0x1b, spec->recording ? in olpc_xo_update_mic_pins()
503 snd_hda_codec_get_pin_target(codec, 0x1b) : 0); in olpc_xo_update_mic_pins()
505 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
507 snd_hda_activate_path(codec, path, true, false); in olpc_xo_update_mic_pins()
510 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
512 snd_hda_activate_path(codec, path, false, false); in olpc_xo_update_mic_pins()
523 update_mic_pin(codec, 0x1a, val); in olpc_xo_update_mic_pins()
524 update_mic_pin(codec, 0x1b, 0); 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()
532 static void olpc_xo_automic(struct hda_codec *codec, in olpc_xo_automic() argument
535 struct conexant_spec *spec = codec->spec; in olpc_xo_automic()
539 snd_hda_gen_mic_autoswitch(codec, jack); in olpc_xo_automic()
540 olpc_xo_update_mic_pins(codec); in olpc_xo_automic()
542 olpc_xo_update_mic_boost(codec); in olpc_xo_automic()
547 struct hda_codec *codec, in olpc_xo_capture_hook() argument
551 struct conexant_spec *spec = codec->spec; in olpc_xo_capture_hook()
559 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
563 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
571 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_get() local
572 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_get()
580 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_put() local
581 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_put()
588 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_mode_put()
589 olpc_xo_update_mic_boost(codec); in olpc_xo_dc_mode_put()
596 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_get() local
597 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_get()
611 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_put() local
612 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_put()
624 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_bias_enum_put()
652 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_mic_boost_put() local
653 struct conexant_spec *spec = codec->spec; in olpc_xo_mic_boost_put()
656 olpc_xo_update_mic_boost(codec); in olpc_xo_mic_boost_put()
660 static void cxt_fixup_olpc_xo(struct hda_codec *codec, in cxt_fixup_olpc_xo() argument
663 struct conexant_spec *spec = codec->spec; in cxt_fixup_olpc_xo()
672 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); in cxt_fixup_olpc_xo()
674 snd_hda_add_new_ctls(codec, olpc_xo_mixers); in cxt_fixup_olpc_xo()
680 snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); in cxt_fixup_olpc_xo()
691 static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, in cxt_fixup_mute_led_eapd() argument
694 struct conexant_spec *spec = codec->spec; in cxt_fixup_mute_led_eapd()
699 snd_hda_gen_add_mute_led_cdev(codec, cx_auto_vmaster_mute_led); in cxt_fixup_mute_led_eapd()
707 static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, in cxt_fixup_cap_mix_amp() argument
710 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, in cxt_fixup_cap_mix_amp()
721 static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, in cxt_fixup_cap_mix_amp_5047() argument
724 snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, in cxt_fixup_cap_mix_amp_5047()
731 static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec, in cxt_fixup_hp_gate_mic_jack() argument
739 snd_hda_jack_set_gating_jack(codec, 0x19, 0x16); in cxt_fixup_hp_gate_mic_jack()
743 static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask, in cxt_update_gpio_led() argument
746 struct conexant_spec *spec = codec->spec; in cxt_update_gpio_led()
756 codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n", in cxt_update_gpio_led()
759 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, in cxt_update_gpio_led()
767 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_mute_update() local
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()
778 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent); in cxt_gpio_micmute_update() local
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()
785 static void cxt_setup_mute_led(struct hda_codec *codec, in cxt_setup_mute_led() argument
788 struct conexant_spec *spec = codec->spec; in cxt_setup_mute_led()
793 snd_hda_gen_add_mute_led_cdev(codec, cxt_gpio_mute_update); in cxt_setup_mute_led()
797 snd_hda_gen_add_micmute_led_cdev(codec, cxt_gpio_micmute_update); in cxt_setup_mute_led()
802 static void cxt_fixup_mute_led_gpio(struct hda_codec *codec, in cxt_fixup_mute_led_gpio() argument
806 cxt_setup_mute_led(codec, 0x01, 0x02); in cxt_fixup_mute_led_gpio()
809 static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec, in cxt_fixup_hp_zbook_mute_led() argument
813 cxt_setup_mute_led(codec, 0x10, 0x20); in cxt_fixup_hp_zbook_mute_led()
1136 static void add_cx5051_fake_mutes(struct hda_codec *codec) in add_cx5051_fake_mutes() argument
1138 struct conexant_spec *spec = codec->spec; in add_cx5051_fake_mutes()
1145 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, in add_cx5051_fake_mutes()
1147 query_amp_caps(codec, *p, HDA_OUTPUT)); in add_cx5051_fake_mutes()
1151 static int patch_conexant_auto(struct hda_codec *codec) in patch_conexant_auto() argument
1156 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); 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()
1174 cx_auto_parse_eapd(codec); in patch_conexant_auto()
1177 switch (codec->core.vendor_id) { in patch_conexant_auto()
1179 codec->single_adc_amp = 1; in patch_conexant_auto()
1182 snd_hda_pick_fixup(codec, cxt5045_fixup_models, in patch_conexant_auto()
1186 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1189 snd_hda_pick_fixup(codec, cxt5047_fixup_models, in patch_conexant_auto()
1193 add_cx5051_fake_mutes(codec); in patch_conexant_auto()
1194 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1195 snd_hda_pick_fixup(codec, cxt5051_fixup_models, in patch_conexant_auto()
1199 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1202 snd_hda_pick_fixup(codec, cxt5066_fixup_models, in patch_conexant_auto()
1206 codec->power_save_node = 1; in patch_conexant_auto()
1209 codec->pin_amp_workaround = 1; in patch_conexant_auto()
1210 snd_hda_pick_fixup(codec, cxt5066_fixup_models, in patch_conexant_auto()
1218 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_conexant_auto()
1220 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, in patch_conexant_auto()
1225 err = cx_auto_parse_beep(codec); in patch_conexant_auto()
1229 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in patch_conexant_auto()
1237 if (!codec->bus->core.sync_write) { in patch_conexant_auto()
1238 codec_info(codec, 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()
1244 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_conexant_auto()
1249 cx_auto_free(codec); in patch_conexant_auto()