Lines Matching refs:codec
3 * HD audio interface patch for Conexant HDA audio codec
74 static int cx_auto_parse_beep(struct hda_codec *codec)
76 struct conexant_spec *spec = codec->spec;
79 for_each_hda_codec_node(nid, codec)
80 if (get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_BEEP)
85 #define cx_auto_parse_beep(codec) 0
93 static void cx_auto_parse_eapd(struct hda_codec *codec)
95 struct conexant_spec *spec = codec->spec;
98 for_each_hda_codec_node(nid, codec) {
99 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
101 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD))
118 static void cx_auto_turn_eapd(struct hda_codec *codec, int num_pins,
123 if (snd_hda_query_pin_caps(codec, pins[i]) & AC_PINCAP_EAPD)
124 snd_hda_codec_write(codec, pins[i], 0,
133 struct hda_codec *codec = private_data;
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,
152 static void cxt_init_gpio_led(struct hda_codec *codec)
154 struct conexant_spec *spec = codec->spec;
158 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
160 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DIRECTION,
162 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
167 static int cx_auto_init(struct hda_codec *codec)
169 struct conexant_spec *spec = codec->spec;
170 snd_hda_gen_init(codec);
172 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, true);
174 cxt_init_gpio_led(codec);
175 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_INIT);
180 static void cx_auto_reboot_notify(struct hda_codec *codec)
182 struct conexant_spec *spec = codec->spec;
184 /* Turn the problematic codec into D3 to avoid spurious noises
186 cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
187 snd_hda_gen_reboot_notify(codec);
190 static void cx_auto_free(struct hda_codec *codec)
192 cx_auto_reboot_notify(codec);
193 snd_hda_gen_free(codec);
244 static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
247 struct conexant_spec *spec = codec->spec;
251 static void cxt5066_increase_mic_boost(struct hda_codec *codec,
257 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT,
264 static void cxt_update_headset_mode(struct hda_codec *codec)
266 /* The verbs used in this function were tested on a Conexant CX20751/2 codec. */
269 struct conexant_spec *spec = codec->spec;
281 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x7c); /* enable merged mode for analog int-mic */
284 snd_hda_codec_write_cache(codec, 0x1c, 0, 0x410, 0x54); /* disable merged mode for analog int-mic */
285 spec->gen.hp_jack_present = snd_hda_jack_detect(codec, spec->gen.autocfg.hp_pins[0]);
288 snd_hda_gen_update_outputs(codec);
291 static void cxt_update_headset_mode_hook(struct hda_codec *codec,
295 cxt_update_headset_mode(codec);
298 static void cxt_fixup_headphone_mic(struct hda_codec *codec,
301 struct conexant_spec *spec = codec->spec;
306 snd_hdac_regmap_add_vendor_verb(&codec->core, 0x410);
314 cxt_update_headset_mode(codec);
319 static void cxt_fixup_headset_mic(struct hda_codec *codec,
322 struct conexant_spec *spec = codec->spec;
340 #define update_mic_pin(codec, nid, val) \
341 snd_hda_codec_write_cache(codec, nid, 0, \
353 static void olpc_xo_update_mic_boost(struct hda_codec *codec)
355 struct conexant_spec *spec = codec->spec;
362 val |= snd_hda_codec_amp_read(codec, 0x17, ch, HDA_OUTPUT, 0);
363 snd_hda_codec_write(codec, 0x17, 0,
368 static void olpc_xo_update_mic_pins(struct hda_codec *codec)
370 struct conexant_spec *spec = codec->spec;
381 update_mic_pin(codec, 0x1e, 0);
382 snd_hda_activate_path(codec, spec->dc_mode_path, false, false);
391 update_mic_pin(codec, 0x1a, spec->recording ?
392 snd_hda_codec_get_pin_target(codec, 0x1a) : 0);
393 update_mic_pin(codec, 0x1b, spec->recording ?
394 snd_hda_codec_get_pin_target(codec, 0x1b) : 0);
396 path = snd_hda_get_path_from_idx(codec, cur_input);
398 snd_hda_activate_path(codec, path, true, false);
401 path = snd_hda_get_path_from_idx(codec, cur_input);
403 snd_hda_activate_path(codec, path, false, false);
414 update_mic_pin(codec, 0x1a, val);
415 update_mic_pin(codec, 0x1b, 0);
417 update_mic_pin(codec, 0x1e, spec->recording ? PIN_IN : 0);
418 snd_hda_activate_path(codec, spec->dc_mode_path, true, false);
423 static void olpc_xo_automic(struct hda_codec *codec,
426 struct conexant_spec *spec = codec->spec;
430 snd_hda_gen_mic_autoswitch(codec, jack);
431 olpc_xo_update_mic_pins(codec);
433 olpc_xo_update_mic_boost(codec);
438 struct hda_codec *codec,
442 struct conexant_spec *spec = codec->spec;
450 olpc_xo_update_mic_pins(codec);
454 olpc_xo_update_mic_pins(codec);
462 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
463 struct conexant_spec *spec = codec->spec;
471 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
472 struct conexant_spec *spec = codec->spec;
479 olpc_xo_update_mic_pins(codec);
480 olpc_xo_update_mic_boost(codec);
487 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
488 struct conexant_spec *spec = codec->spec;
502 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
503 struct conexant_spec *spec = codec->spec;
515 olpc_xo_update_mic_pins(codec);
543 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
544 struct conexant_spec *spec = codec->spec;
547 olpc_xo_update_mic_boost(codec);
551 static void cxt_fixup_olpc_xo(struct hda_codec *codec,
554 struct conexant_spec *spec = codec->spec;
563 spec->dc_mode_path = snd_hda_add_new_path(codec, 0x1e, 0x14, 0);
565 snd_hda_add_new_ctls(codec, olpc_xo_mixers);
569 * with the DC input range of the codec.
571 snd_hda_codec_set_pin_target(codec, 0x1a, PIN_VREF50);
582 static void cxt_fixup_mute_led_eapd(struct hda_codec *codec,
585 struct conexant_spec *spec = codec->spec;
590 snd_hda_gen_add_mute_led_cdev(codec, cx_auto_vmaster_mute_led);
598 static void cxt_fixup_cap_mix_amp(struct hda_codec *codec,
601 snd_hda_override_amp_caps(codec, 0x17, HDA_INPUT,
612 static void cxt_fixup_cap_mix_amp_5047(struct hda_codec *codec,
615 snd_hda_override_amp_caps(codec, 0x10, HDA_INPUT,
622 static void cxt_fixup_hp_gate_mic_jack(struct hda_codec *codec,
630 snd_hda_jack_set_gating_jack(codec, 0x19, 0x16);
634 static void cxt_update_gpio_led(struct hda_codec *codec, unsigned int mask,
637 struct conexant_spec *spec = codec->spec;
647 codec_dbg(codec, "mask:%d enabled:%d gpio_led:%d\n",
650 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA,
658 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
659 struct conexant_spec *spec = codec->spec;
661 cxt_update_gpio_led(codec, spec->gpio_mute_led_mask, brightness);
669 struct hda_codec *codec = dev_to_hda_codec(led_cdev->dev->parent);
670 struct conexant_spec *spec = codec->spec;
672 cxt_update_gpio_led(codec, spec->gpio_mic_led_mask, brightness);
676 static void cxt_setup_mute_led(struct hda_codec *codec,
679 struct conexant_spec *spec = codec->spec;
684 snd_hda_gen_add_mute_led_cdev(codec, cxt_gpio_mute_update);
688 snd_hda_gen_add_micmute_led_cdev(codec, cxt_gpio_micmute_update);
693 static void cxt_fixup_mute_led_gpio(struct hda_codec *codec,
697 cxt_setup_mute_led(codec, 0x01, 0x02);
700 static void cxt_fixup_hp_zbook_mute_led(struct hda_codec *codec,
704 cxt_setup_mute_led(codec, 0x10, 0x20);
1027 static void add_cx5051_fake_mutes(struct hda_codec *codec)
1029 struct conexant_spec *spec = codec->spec;
1036 snd_hda_override_amp_caps(codec, *p, HDA_OUTPUT,
1038 query_amp_caps(codec, *p, HDA_OUTPUT));
1042 static int patch_conexant_auto(struct hda_codec *codec)
1047 codec_info(codec, "%s: BIOS auto-probing.\n", codec->core.chip_name);
1053 codec->spec = spec;
1054 codec->patch_ops = cx_auto_patch_ops;
1056 cx_auto_parse_eapd(codec);
1059 switch (codec->core.vendor_id) {
1061 codec->single_adc_amp = 1;
1064 snd_hda_pick_fixup(codec, cxt5045_fixup_models,
1068 codec->pin_amp_workaround = 1;
1071 snd_hda_pick_fixup(codec, cxt5047_fixup_models,
1075 add_cx5051_fake_mutes(codec);
1076 codec->pin_amp_workaround = 1;
1077 snd_hda_pick_fixup(codec, cxt5051_fixup_models,
1081 codec->pin_amp_workaround = 1;
1084 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1088 codec->power_save_node = 1;
1091 codec->pin_amp_workaround = 1;
1092 snd_hda_pick_fixup(codec, cxt5066_fixup_models,
1100 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
1102 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL,
1107 err = cx_auto_parse_beep(codec);
1111 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg);
1119 if (!codec->bus->core.sync_write) {
1120 codec_info(codec,
1122 codec->bus->core.sync_write = 1;
1123 codec->bus->allow_bus_reset = 1;
1126 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
1131 cx_auto_free(codec);
1176 MODULE_DESCRIPTION("Conexant HD-audio codec");