Lines Matching refs:codec
60 static void add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg, in add_auto_cfg_input_pin() argument
67 nid_has_volume(codec, nid, HDA_INPUT); in add_auto_cfg_input_pin()
106 static bool check_pincap_validity(struct hda_codec *codec, hda_nid_t pin, in check_pincap_validity() argument
109 unsigned int pincap = snd_hda_query_pin_caps(codec, pin); in check_pincap_validity()
127 static bool can_be_headset_mic(struct hda_codec *codec, in can_be_headset_mic() argument
139 def_conf = snd_hda_codec_get_pincfg(codec, item->pin); in can_be_headset_mic()
170 int snd_hda_parse_pin_defcfg(struct hda_codec *codec, in snd_hda_parse_pin_defcfg() argument
182 if (!snd_hda_get_int_hint(codec, "parser_flags", &i)) in snd_hda_parse_pin_defcfg()
192 for_each_hda_codec_node(nid, codec) { in snd_hda_parse_pin_defcfg()
193 unsigned int wid_caps = get_wcaps(codec, nid); in snd_hda_parse_pin_defcfg()
205 def_conf = snd_hda_codec_get_pincfg(codec, nid); in snd_hda_parse_pin_defcfg()
219 if (!check_pincap_validity(codec, nid, dev)) in snd_hda_parse_pin_defcfg()
235 codec_info(codec, in snd_hda_parse_pin_defcfg()
241 codec_info(codec, in snd_hda_parse_pin_defcfg()
254 codec_info(codec, in snd_hda_parse_pin_defcfg()
267 codec_info(codec, in snd_hda_parse_pin_defcfg()
277 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC); in snd_hda_parse_pin_defcfg()
280 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN); in snd_hda_parse_pin_defcfg()
283 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD); in snd_hda_parse_pin_defcfg()
286 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX); in snd_hda_parse_pin_defcfg()
291 codec_info(codec, in snd_hda_parse_pin_defcfg()
318 if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) { in snd_hda_parse_pin_defcfg()
321 } else if (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) { in snd_hda_parse_pin_defcfg()
328 if (!can_be_headset_mic(codec, &cfg->inputs[i], -1)) in snd_hda_parse_pin_defcfg()
340 codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n"); in snd_hda_parse_pin_defcfg()
342 codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n"); in snd_hda_parse_pin_defcfg()
411 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()
412 codec->core.chip_name, cfg->line_outs, cfg->line_out_pins[0], in snd_hda_parse_pin_defcfg()
418 codec_info(codec, " speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", in snd_hda_parse_pin_defcfg()
422 codec_info(codec, " hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", in snd_hda_parse_pin_defcfg()
426 codec_info(codec, " mono: mono_out=0x%x\n", cfg->mono_out_pin); in snd_hda_parse_pin_defcfg()
428 codec_info(codec, " dig-out=0x%x/0x%x\n", in snd_hda_parse_pin_defcfg()
430 codec_info(codec, " inputs:\n"); in snd_hda_parse_pin_defcfg()
432 codec_info(codec, " %s=0x%x\n", in snd_hda_parse_pin_defcfg()
433 hda_get_autocfg_input_label(codec, cfg, i), in snd_hda_parse_pin_defcfg()
437 codec_info(codec, " dig-in=0x%x\n", cfg->dig_in_pin); in snd_hda_parse_pin_defcfg()
482 static const char *hda_get_input_pin_label(struct hda_codec *codec, in hda_get_input_pin_label() argument
492 def_conf = snd_hda_codec_get_pincfg(codec, pin); in hda_get_input_pin_label()
534 static int check_mic_location_need(struct hda_codec *codec, in check_mic_location_need() argument
541 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin); in check_mic_location_need()
549 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin); in check_mic_location_need()
571 const char *hda_get_autocfg_input_label(struct hda_codec *codec, in hda_get_autocfg_input_label() argument
582 has_multiple_pins &= check_mic_location_need(codec, cfg, input); in hda_get_autocfg_input_label()
583 return hda_get_input_pin_label(codec, &cfg->inputs[input], in hda_get_autocfg_input_label()
621 static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid) in check_output_pfx() argument
623 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in check_output_pfx()
636 static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid, in get_hp_label_index() argument
641 const char *pfx = check_output_pfx(codec, nid); in get_hp_label_index()
647 if (pfx == check_output_pfx(codec, pins[j])) in get_hp_label_index()
653 static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid, in fill_audio_out_name() argument
658 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in fill_audio_out_name()
665 pfx = check_output_pfx(codec, nid); in fill_audio_out_name()
676 int idx = get_hp_label_index(codec, nid, cfg->hp_pins, in fill_audio_out_name()
709 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid, in snd_hda_get_pin_label() argument
713 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid); in snd_hda_get_pin_label()
725 return fill_audio_out_name(codec, nid, cfg, "Line Out", in snd_hda_get_pin_label()
728 return fill_audio_out_name(codec, nid, cfg, "Speaker", in snd_hda_get_pin_label()
731 return fill_audio_out_name(codec, nid, cfg, "Headphone", in snd_hda_get_pin_label()
743 c = snd_hda_codec_get_pincfg(codec, pin); in snd_hda_get_pin_label()
753 name = hda_get_autocfg_input_label(codec, cfg, i); in snd_hda_get_pin_label()
759 name = hda_get_input_pin_label(codec, NULL, nid, true); in snd_hda_get_pin_label()
777 int snd_hda_add_verbs(struct hda_codec *codec, in snd_hda_add_verbs() argument
781 v = snd_array_new(&codec->verbs); in snd_hda_add_verbs()
793 void snd_hda_apply_verbs(struct hda_codec *codec) in snd_hda_apply_verbs() argument
796 for (i = 0; i < codec->verbs.used; i++) { in snd_hda_apply_verbs()
797 struct hda_verb **v = snd_array_elem(&codec->verbs, i); in snd_hda_apply_verbs()
798 snd_hda_sequence_write(codec, *v); in snd_hda_apply_verbs()
808 void snd_hda_apply_pincfgs(struct hda_codec *codec, in snd_hda_apply_pincfgs() argument
812 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); in snd_hda_apply_pincfgs()
816 static void set_pin_targets(struct hda_codec *codec, in set_pin_targets() argument
820 snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val); in set_pin_targets()
823 static void apply_fixup(struct hda_codec *codec, int id, int action, int depth) in apply_fixup() argument
825 const char *modelname = codec->fixup_name; in apply_fixup()
828 const struct hda_fixup *fix = codec->fixup_list + id; in apply_fixup()
831 apply_fixup(codec, fix->chain_id, action, depth + 1); in apply_fixup()
837 codec_dbg(codec, "%s: Apply pincfg for %s\n", in apply_fixup()
838 codec->core.chip_name, modelname); in apply_fixup()
839 snd_hda_apply_pincfgs(codec, fix->v.pins); in apply_fixup()
844 codec_dbg(codec, "%s: Apply fix-verbs for %s\n", in apply_fixup()
845 codec->core.chip_name, modelname); in apply_fixup()
846 snd_hda_add_verbs(codec, fix->v.verbs); in apply_fixup()
851 codec_dbg(codec, "%s: Apply fix-func for %s\n", in apply_fixup()
852 codec->core.chip_name, modelname); in apply_fixup()
853 fix->v.func(codec, fix, action); in apply_fixup()
858 codec_dbg(codec, "%s: Apply pinctl for %s\n", in apply_fixup()
859 codec->core.chip_name, modelname); in apply_fixup()
860 set_pin_targets(codec, fix->v.pins); in apply_fixup()
863 codec_err(codec, "%s: Invalid fixup type %d\n", in apply_fixup()
864 codec->core.chip_name, fix->type); in apply_fixup()
880 void snd_hda_apply_fixup(struct hda_codec *codec, int action) in snd_hda_apply_fixup() argument
882 if (codec->fixup_list) in snd_hda_apply_fixup()
883 apply_fixup(codec, codec->fixup_id, action, 0); in snd_hda_apply_fixup()
887 static bool pin_config_match(struct hda_codec *codec, in pin_config_match() argument
892 for (i = 0; i < codec->init_pins.used; i++) { in pin_config_match()
893 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); in pin_config_match()
925 void snd_hda_pick_pin_fixup(struct hda_codec *codec, in snd_hda_pick_pin_fixup() argument
931 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) in snd_hda_pick_pin_fixup()
935 if ((codec->core.subsystem_id & 0xffff0000) != (pq->subvendor << 16)) in snd_hda_pick_pin_fixup()
937 if (codec->core.vendor_id != pq->codec) in snd_hda_pick_pin_fixup()
939 if (pin_config_match(codec, pq->pins)) { in snd_hda_pick_pin_fixup()
940 codec->fixup_id = pq->value; in snd_hda_pick_pin_fixup()
942 codec->fixup_name = pq->name; in snd_hda_pick_pin_fixup()
943 codec_dbg(codec, "%s: picked fixup %s (pin match)\n", in snd_hda_pick_pin_fixup()
944 codec->core.chip_name, codec->fixup_name); in snd_hda_pick_pin_fixup()
946 codec->fixup_list = fixlist; in snd_hda_pick_pin_fixup()
968 void snd_hda_pick_fixup(struct hda_codec *codec, in snd_hda_pick_fixup() argument
977 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET) in snd_hda_pick_fixup()
981 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) { in snd_hda_pick_fixup()
982 codec->fixup_list = NULL; in snd_hda_pick_fixup()
983 codec->fixup_name = NULL; in snd_hda_pick_fixup()
984 codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP; in snd_hda_pick_fixup()
985 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n", in snd_hda_pick_fixup()
986 codec->core.chip_name); in snd_hda_pick_fixup()
990 if (codec->modelname && models) { in snd_hda_pick_fixup()
992 if (!strcmp(codec->modelname, models->name)) { in snd_hda_pick_fixup()
993 codec->fixup_id = models->id; in snd_hda_pick_fixup()
994 codec->fixup_name = models->name; in snd_hda_pick_fixup()
995 codec->fixup_list = fixlist; in snd_hda_pick_fixup()
996 codec_dbg(codec, "%s: picked fixup %s (model specified)\n", in snd_hda_pick_fixup()
997 codec->core.chip_name, codec->fixup_name); in snd_hda_pick_fixup()
1004 q = snd_pci_quirk_lookup(codec->bus->pci, quirk); in snd_hda_pick_fixup()
1009 codec_dbg(codec, "%s: picked fixup %s (PCI SSID%s)\n", in snd_hda_pick_fixup()
1010 codec->core.chip_name, name, q->subdevice_mask ? "" : " - vendor generic"); in snd_hda_pick_fixup()
1019 if ((codec->core.subsystem_id & mask) == (vendorid & mask)) { in snd_hda_pick_fixup()
1023 codec_dbg(codec, "%s: picked fixup %s (codec SSID)\n", in snd_hda_pick_fixup()
1024 codec->core.chip_name, name); in snd_hda_pick_fixup()
1031 codec->fixup_id = id; in snd_hda_pick_fixup()
1033 codec->fixup_list = fixlist; in snd_hda_pick_fixup()
1034 codec->fixup_name = name; in snd_hda_pick_fixup()