Lines Matching refs:codec
73 static int add_beep_ctls(struct hda_codec *codec) in add_beep_ctls() argument
75 struct conexant_spec *spec = codec->spec; in add_beep_ctls()
82 kctl = snd_ctl_new1(knew, codec); in add_beep_ctls()
86 err = snd_hda_ctl_add(codec, 0, kctl); in add_beep_ctls()
95 #define add_beep_ctls(codec) 0 argument
103 static void cx_auto_parse_beep(struct hda_codec *codec) in cx_auto_parse_beep() argument
105 struct conexant_spec *spec = codec->spec; in cx_auto_parse_beep()
108 for_each_hda_codec_node(nid, codec) in cx_auto_parse_beep()
109 if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP) { in cx_auto_parse_beep()
115 #define cx_auto_parse_beep(codec) argument
119 static void cx_auto_parse_eapd(struct hda_codec *codec) in cx_auto_parse_eapd() argument
121 struct conexant_spec *spec = codec->spec; in cx_auto_parse_eapd()
124 for_each_hda_codec_node(nid, codec) { in cx_auto_parse_eapd()
125 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) in cx_auto_parse_eapd()
127 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) in cx_auto_parse_eapd()
144 static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins, in cx_auto_turn_eapd() argument
149 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD) in cx_auto_turn_eapd()
150 snd_hda_codec_write(codec, pins[i], 0, in cx_auto_turn_eapd()
159 struct hda_codec *codec = private_data; in cx_auto_vmaster_hook() local
160 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_hook()
162 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, enabled); in cx_auto_vmaster_hook()
168 struct hda_codec *codec = private_data; in cx_auto_vmaster_hook_mute_led() local
169 struct conexant_spec *spec = codec->spec; in cx_auto_vmaster_hook_mute_led()
171 snd_hda_codec_write(codec, spec->mute_led_eapd, 0, in cx_auto_vmaster_hook_mute_led()
176 static int cx_auto_build_controls(struct hda_codec *codec) in cx_auto_build_controls() argument
180 err = snd_hda_gen_build_controls(codec); in cx_auto_build_controls()
184 err = add_beep_ctls(codec); in cx_auto_build_controls()
191 static int cx_auto_init(struct hda_codec *codec) in cx_auto_init() argument
193 struct conexant_spec *spec = codec->spec; in cx_auto_init()
194 snd_hda_gen_init(codec); in cx_auto_init()
196 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true); in cx_auto_init()
198 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT); in cx_auto_init()
203 static void cx_auto_reboot_notify(struct hda_codec *codec) in cx_auto_reboot_notify() argument
205 struct conexant_spec *spec = codec->spec; in cx_auto_reboot_notify()
207 switch (codec->core.vendor_id) { in cx_auto_reboot_notify()
217 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false); in cx_auto_reboot_notify()
219 snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3); in cx_auto_reboot_notify()
220 snd_hda_codec_write(codec, codec->core.afg, 0, in cx_auto_reboot_notify()
224 static void cx_auto_free(struct hda_codec *codec) in cx_auto_free() argument
226 cx_auto_reboot_notify(codec); in cx_auto_free()
227 snd_hda_gen_free(codec); in cx_auto_free()
269 static void cxt_fixup_stereo_dmic(struct hda_codec *codec, in cxt_fixup_stereo_dmic() argument
272 struct conexant_spec *spec = codec->spec; in cxt_fixup_stereo_dmic()
276 static void cxt5066_increase_mic_boost(struct hda_codec *codec, in cxt5066_increase_mic_boost() argument
282 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT, in cxt5066_increase_mic_boost()
289 static void cxt_update_headset_mode(struct hda_codec *codec) in cxt_update_headset_mode() argument
294 struct conexant_spec *spec = codec->spec; in cxt_update_headset_mode()
306 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */ in cxt_update_headset_mode()
309 …snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic … in cxt_update_headset_mode()
310 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]); in cxt_update_headset_mode()
313 snd_hda_gen_update_outputs(codec); in cxt_update_headset_mode()
316 static void cxt_update_headset_mode_hook(struct hda_codec *codec, in cxt_update_headset_mode_hook() argument
320 cxt_update_headset_mode(codec); in cxt_update_headset_mode_hook()
323 static void cxt_fixup_headphone_mic(struct hda_codec *codec, in cxt_fixup_headphone_mic() argument
326 struct conexant_spec *spec = codec->spec; in cxt_fixup_headphone_mic()
331 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410); in cxt_fixup_headphone_mic()
338 cxt_update_headset_mode(codec); in cxt_fixup_headphone_mic()
352 #define update_mic_pin(codec, nid, val) \ argument
353 snd_hda_codec_update_cache(codec, nid, 0, \
365 static void olpc_xo_update_mic_boost(struct hda_codec *codec) in olpc_xo_update_mic_boost() argument
367 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_boost()
374 val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0); in olpc_xo_update_mic_boost()
375 snd_hda_codec_write(codec, 0x17, 0, in olpc_xo_update_mic_boost()
380 static void olpc_xo_update_mic_pins(struct hda_codec *codec) in olpc_xo_update_mic_pins() argument
382 struct conexant_spec *spec = codec->spec; in olpc_xo_update_mic_pins()
393 update_mic_pin(codec, 0x1e, 0); in olpc_xo_update_mic_pins()
394 snd_hda_activate_path(codec, spec->dc_mode_path, false, false); in olpc_xo_update_mic_pins()
403 update_mic_pin(codec, 0x1a, spec->recording ? in olpc_xo_update_mic_pins()
404 snd_hda_codec_get_pin_target(codec, 0x1a) : 0); in olpc_xo_update_mic_pins()
405 update_mic_pin(codec, 0x1b, spec->recording ? in olpc_xo_update_mic_pins()
406 snd_hda_codec_get_pin_target(codec, 0x1b) : 0); in olpc_xo_update_mic_pins()
408 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
410 snd_hda_activate_path(codec, path, true, false); in olpc_xo_update_mic_pins()
413 path = snd_hda_get_path_from_idx(codec, cur_input); in olpc_xo_update_mic_pins()
415 snd_hda_activate_path(codec, path, false, false); in olpc_xo_update_mic_pins()
426 update_mic_pin(codec, 0x1a, val); in olpc_xo_update_mic_pins()
427 update_mic_pin(codec, 0x1b, 0); in olpc_xo_update_mic_pins()
429 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0); in olpc_xo_update_mic_pins()
430 snd_hda_activate_path(codec, spec->dc_mode_path, true, false); in olpc_xo_update_mic_pins()
435 static void olpc_xo_automic(struct hda_codec *codec, in olpc_xo_automic() argument
438 struct conexant_spec *spec = codec->spec; in olpc_xo_automic()
442 snd_hda_gen_mic_autoswitch(codec, jack); in olpc_xo_automic()
443 olpc_xo_update_mic_pins(codec); in olpc_xo_automic()
445 olpc_xo_update_mic_boost(codec); in olpc_xo_automic()
450 struct hda_codec *codec, in olpc_xo_capture_hook() argument
454 struct conexant_spec *spec = codec->spec; in olpc_xo_capture_hook()
462 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
466 olpc_xo_update_mic_pins(codec); in olpc_xo_capture_hook()
474 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_get() local
475 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_get()
483 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_mode_put() local
484 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_mode_put()
491 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_mode_put()
492 olpc_xo_update_mic_boost(codec); in olpc_xo_dc_mode_put()
499 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_get() local
500 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_get()
514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_dc_bias_enum_put() local
515 struct conexant_spec *spec = codec->spec; in olpc_xo_dc_bias_enum_put()
527 olpc_xo_update_mic_pins(codec); in olpc_xo_dc_bias_enum_put()
555 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); in olpc_xo_mic_boost_put() local
556 struct conexant_spec *spec = codec->spec; in olpc_xo_mic_boost_put()
559 olpc_xo_update_mic_boost(codec); in olpc_xo_mic_boost_put()
563 static void cxt_fixup_olpc_xo(struct hda_codec *codec, in cxt_fixup_olpc_xo() argument
566 struct conexant_spec *spec = codec->spec; in cxt_fixup_olpc_xo()
574 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0); in cxt_fixup_olpc_xo()
576 snd_hda_add_new_ctls(codec, olpc_xo_mixers); in cxt_fixup_olpc_xo()
582 snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50); in cxt_fixup_olpc_xo()
595 static void cxt_fixup_mute_led_eapd(struct hda_codec *codec, in cxt_fixup_mute_led_eapd() argument
598 struct conexant_spec *spec = codec->spec; in cxt_fixup_mute_led_eapd()
611 static void cxt_fixup_cap_mix_amp(struct hda_codec *codec, in cxt_fixup_cap_mix_amp() argument
614 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT, in cxt_fixup_cap_mix_amp()
625 static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec, in cxt_fixup_cap_mix_amp_5047() argument
628 snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT, in cxt_fixup_cap_mix_amp_5047()
853 static void add_cx5051_fake_mutes(struct hda_codec *codec) in add_cx5051_fake_mutes() argument
855 struct conexant_spec *spec = codec->spec; in add_cx5051_fake_mutes()
862 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT, in add_cx5051_fake_mutes()
864 query_amp_caps(codec, *p, HDA_OUTPUT)); in add_cx5051_fake_mutes()
868 static int patch_conexant_auto(struct hda_codec *codec) in patch_conexant_auto() argument
873 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name); in patch_conexant_auto()
879 codec->spec = spec; in patch_conexant_auto()
881 cx_auto_parse_beep(codec); in patch_conexant_auto()
882 cx_auto_parse_eapd(codec); in patch_conexant_auto()
887 switch (codec->core.vendor_id) { in patch_conexant_auto()
889 codec->single_adc_amp = 1; in patch_conexant_auto()
892 snd_hda_pick_fixup(codec, cxt5045_fixup_models, in patch_conexant_auto()
896 codec->pin_amp_workaround = 1; in patch_conexant_auto()
899 snd_hda_pick_fixup(codec, cxt5047_fixup_models, in patch_conexant_auto()
903 add_cx5051_fake_mutes(codec); in patch_conexant_auto()
904 codec->pin_amp_workaround = 1; in patch_conexant_auto()
905 snd_hda_pick_fixup(codec, cxt5051_fixup_models, in patch_conexant_auto()
909 codec->pin_amp_workaround = 1; in patch_conexant_auto()
910 snd_hda_pick_fixup(codec, cxt5066_fixup_models, in patch_conexant_auto()
921 switch (codec->core.subsystem_id >> 16) { in patch_conexant_auto()
927 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); in patch_conexant_auto()
929 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, in patch_conexant_auto()
934 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in patch_conexant_auto()
938 codec->patch_ops = cx_auto_patch_ops; in patch_conexant_auto()
944 if (!codec->bus->core.sync_write) { in patch_conexant_auto()
945 codec_info(codec, in patch_conexant_auto()
947 codec->bus->core.sync_write = 1; in patch_conexant_auto()
948 codec->bus->allow_bus_reset = 1; in patch_conexant_auto()
951 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); in patch_conexant_auto()
956 cx_auto_free(codec); in patch_conexant_auto()