Lines Matching refs:codec
56 static void add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg, in add_auto_cfg_input_pin() argument
63 nid_has_volume(codec, nid, HDA_INPUT); in add_auto_cfg_input_pin()
108 static bool check_pincap_validity(struct hda_codec *codec, hda_nid_t pin, in check_pincap_validity() argument
111 unsigned int pincap = snd_hda_query_pin_caps(codec, pin); in check_pincap_validity()
129 static bool can_be_headset_mic(struct hda_codec *codec, in can_be_headset_mic() argument
141 def_conf = snd_hda_codec_get_pincfg(codec, item->pin); in can_be_headset_mic()
172 int snd_hda_parse_pin_defcfg(struct hda_codec *codec, in snd_hda_parse_pin_defcfg() argument
184 if (!snd_hda_get_int_hint(codec, "parser_flags", &i)) in snd_hda_parse_pin_defcfg()
194 for_each_hda_codec_node(nid, codec) { in snd_hda_parse_pin_defcfg()
195 unsigned int wid_caps = get_wcaps(codec, nid); in snd_hda_parse_pin_defcfg()
207 def_conf = snd_hda_codec_get_pincfg(codec, nid); in snd_hda_parse_pin_defcfg()
221 if (!check_pincap_validity(codec, nid, dev)) in snd_hda_parse_pin_defcfg()
237 codec_info(codec, in snd_hda_parse_pin_defcfg()
243 codec_info(codec, in snd_hda_parse_pin_defcfg()
256 codec_info(codec, in snd_hda_parse_pin_defcfg()
269 codec_info(codec, in snd_hda_parse_pin_defcfg()
279 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC); in snd_hda_parse_pin_defcfg()
282 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN); in snd_hda_parse_pin_defcfg()
285 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD); in snd_hda_parse_pin_defcfg()
288 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX); in snd_hda_parse_pin_defcfg()
293 codec_info(codec, in snd_hda_parse_pin_defcfg()
320 if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) { in snd_hda_parse_pin_defcfg()
323 } else if (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) { in snd_hda_parse_pin_defcfg()
330 if (!can_be_headset_mic(codec, &cfg->inputs[i], -1)) in snd_hda_parse_pin_defcfg()
342 codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n"); in snd_hda_parse_pin_defcfg()
344 codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n"); in snd_hda_parse_pin_defcfg()
413 codec_info(codec, "autoconfig for %s: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n", in snd_hda_parse_pin_defcfg()
414 codec->core.chip_name, cfg->line_outs, cfg->line_out_pins[0], in snd_hda_parse_pin_defcfg()
420 codec_info(codec, " speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", in snd_hda_parse_pin_defcfg()
424 codec_info(codec, " hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", in snd_hda_parse_pin_defcfg()
428 codec_info(codec, " mono: mono_out=0x%x\n", cfg->mono_out_pin); in snd_hda_parse_pin_defcfg()
430 codec_info(codec, " dig-out=0x%x/0x%x\n", in snd_hda_parse_pin_defcfg()
432 codec_info(codec, " inputs:\n"); in snd_hda_parse_pin_defcfg()
434 codec_info(codec, " %s=0x%x\n", in snd_hda_parse_pin_defcfg()
435 hda_get_autocfg_input_label(codec, cfg, i), in snd_hda_parse_pin_defcfg()
439 codec_info(codec, " dig-in=0x%x\n", cfg->dig_in_pin); in snd_hda_parse_pin_defcfg()
484 static const char *hda_get_input_pin_label(struct hda_codec *codec, in hda_get_input_pin_label() argument
494 def_conf = snd_hda_codec_get_pincfg(codec, pin); in hda_get_input_pin_label()
536 static int check_mic_location_need(struct hda_codec *codec, in check_mic_location_need() argument
543 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin); in check_mic_location_need()
551 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin); in check_mic_location_need()
573 const char *hda_get_autocfg_input_label(struct hda_codec *codec, in hda_get_autocfg_input_label() argument
584 has_multiple_pins &= check_mic_location_need(codec, cfg, input); in hda_get_autocfg_input_label()
585 has_multiple_pins |= codec->force_pin_prefix; in hda_get_autocfg_input_label()
586 return hda_get_input_pin_label(codec, &cfg->inputs[input], in hda_get_autocfg_input_label()
624 static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid) in check_output_pfx() argument
626 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in check_output_pfx()
639 static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid, in get_hp_label_index() argument
644 const char *pfx = check_output_pfx(codec, nid); in get_hp_label_index()
650 if (pfx == check_output_pfx(codec, pins[j])) in get_hp_label_index()
656 static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, in fill_audio_out_name() argument
661 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in fill_audio_out_name()
668 pfx = check_output_pfx(codec, nid); in fill_audio_out_name()
679 int idx = get_hp_label_index(codec, nid, cfg->hp_pins, in fill_audio_out_name()
712 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_pin_label() argument
716 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in snd_hda_get_pin_label()
728 return fill_audio_out_name(codec, nid, cfg, "Line Out", in snd_hda_get_pin_label()
731 return fill_audio_out_name(codec, nid, cfg, "Speaker", in snd_hda_get_pin_label()
734 return fill_audio_out_name(codec, nid, cfg, "Headphone", in snd_hda_get_pin_label()
746 c = snd_hda_codec_get_pincfg(codec, pin); in snd_hda_get_pin_label()
756 name = hda_get_autocfg_input_label(codec, cfg, i); in snd_hda_get_pin_label()
762 name = hda_get_input_pin_label(codec, NULL, nid, true); in snd_hda_get_pin_label()
780 int snd_hda_add_verbs(struct hda_codec *codec, in snd_hda_add_verbs() argument
784 v = snd_array_new(&codec->verbs); in snd_hda_add_verbs()
796 void snd_hda_apply_verbs(struct hda_codec *codec) in snd_hda_apply_verbs() argument
801 snd_array_for_each(&codec->verbs, i, v) in snd_hda_apply_verbs()
802 snd_hda_sequence_write(codec, *v); in snd_hda_apply_verbs()
811 void snd_hda_apply_pincfgs(struct hda_codec *codec, in snd_hda_apply_pincfgs() argument
815 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); in snd_hda_apply_pincfgs()
819 static void set_pin_targets(struct hda_codec *codec, in set_pin_targets() argument
823 snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val); in set_pin_targets()
826 void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth) in __snd_hda_apply_fixup() argument
828 const char *modelname = codec->fixup_name; in __snd_hda_apply_fixup()
831 const struct hda_fixup *fix = codec->fixup_list + id; in __snd_hda_apply_fixup()
836 __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1); in __snd_hda_apply_fixup()
842 codec_dbg(codec, "%s: Apply pincfg for %s\n", in __snd_hda_apply_fixup()
843 codec->core.chip_name, modelname); in __snd_hda_apply_fixup()
844 snd_hda_apply_pincfgs(codec, fix->v.pins); in __snd_hda_apply_fixup()
849 codec_dbg(codec, "%s: Apply fix-verbs for %s\n", in __snd_hda_apply_fixup()
850 codec->core.chip_name, modelname); in __snd_hda_apply_fixup()
851 snd_hda_add_verbs(codec, fix->v.verbs); in __snd_hda_apply_fixup()
856 codec_dbg(codec, "%s: Apply fix-func for %s\n", in __snd_hda_apply_fixup()
857 codec->core.chip_name, modelname); in __snd_hda_apply_fixup()
858 fix->v.func(codec, fix, action); in __snd_hda_apply_fixup()
863 codec_dbg(codec, "%s: Apply pinctl for %s\n", in __snd_hda_apply_fixup()
864 codec->core.chip_name, modelname); in __snd_hda_apply_fixup()
865 set_pin_targets(codec, fix->v.pins); in __snd_hda_apply_fixup()
868 codec_err(codec, "%s: Invalid fixup type %d\n", in __snd_hda_apply_fixup()
869 codec->core.chip_name, fix->type); in __snd_hda_apply_fixup()
884 void snd_hda_apply_fixup(struct hda_codec *codec, int action) in snd_hda_apply_fixup() argument
886 if (codec->fixup_list) in snd_hda_apply_fixup()
887 __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0); in snd_hda_apply_fixup()
893 static bool pin_config_match(struct hda_codec *codec, in pin_config_match() argument
900 snd_array_for_each(&codec->init_pins, i, pin) { in pin_config_match()
934 void snd_hda_pick_pin_fixup(struct hda_codec *codec, in snd_hda_pick_pin_fixup() argument
941 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) in snd_hda_pick_pin_fixup()
945 if ((codec->core.subsystem_id & 0xffff0000) != (pq->subvendor << 16)) in snd_hda_pick_pin_fixup()
947 if (codec->core.vendor_id != pq->codec) in snd_hda_pick_pin_fixup()
949 if (pin_config_match(codec, pq->pins, match_all_pins)) { in snd_hda_pick_pin_fixup()
950 codec->fixup_id = pq->value; in snd_hda_pick_pin_fixup()
952 codec->fixup_name = pq->name; in snd_hda_pick_pin_fixup()
953 codec_dbg(codec, "%s: picked fixup %s (pin match)\n", in snd_hda_pick_pin_fixup()
954 codec->core.chip_name, codec->fixup_name); in snd_hda_pick_pin_fixup()
956 codec->fixup_list = fixlist; in snd_hda_pick_pin_fixup()
980 void snd_hda_pick_fixup(struct hda_codec *codec, in snd_hda_pick_fixup() argument
991 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) in snd_hda_pick_fixup()
995 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { in snd_hda_pick_fixup()
998 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n", in snd_hda_pick_fixup()
999 codec->core.chip_name); in snd_hda_pick_fixup()
1004 if (codec->modelname && models) { in snd_hda_pick_fixup()
1006 if (!strcmp(codec->modelname, models->name)) { in snd_hda_pick_fixup()
1009 codec_dbg(codec, "%s: picked fixup %s (model specified)\n", in snd_hda_pick_fixup()
1010 codec->core.chip_name, codec->fixup_name); in snd_hda_pick_fixup()
1021 if (codec->modelname && in snd_hda_pick_fixup()
1022 sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) { in snd_hda_pick_fixup()
1031 q = snd_pci_quirk_lookup(codec->bus->pci, quirk); in snd_hda_pick_fixup()
1038 q = snd_pci_quirk_lookup_id(codec->core.subsystem_id >> 16, in snd_hda_pick_fixup()
1039 codec->core.subsystem_id & 0xffff, in snd_hda_pick_fixup()
1053 codec_dbg(codec, "%s: picked fixup %s for %s %04x:%04x\n", in snd_hda_pick_fixup()
1054 codec->core.chip_name, name ? name : "", in snd_hda_pick_fixup()
1057 codec->fixup_id = id; in snd_hda_pick_fixup()
1058 codec->fixup_list = fixlist; in snd_hda_pick_fixup()
1059 codec->fixup_name = name; in snd_hda_pick_fixup()