Lines Matching refs:codec

56 static void add_auto_cfg_input_pin(struct hda_codec *codec, struct auto_pin_cfg *cfg,
63 nid_has_volume(codec, nid, HDA_INPUT);
108 static bool check_pincap_validity(struct hda_codec *codec, hda_nid_t pin,
111 unsigned int pincap = snd_hda_query_pin_caps(codec, pin);
129 static bool can_be_headset_mic(struct hda_codec *codec,
141 def_conf = snd_hda_codec_get_pincfg(codec, item->pin);
172 int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
184 if (!snd_hda_get_int_hint(codec, "parser_flags", &i))
194 for_each_hda_codec_node(nid, codec) {
195 unsigned int wid_caps = get_wcaps(codec, nid);
207 def_conf = snd_hda_codec_get_pincfg(codec, nid);
221 if (!check_pincap_validity(codec, nid, dev))
237 codec_info(codec,
243 codec_info(codec,
256 codec_info(codec,
269 codec_info(codec,
279 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC);
282 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN);
285 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD);
288 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX);
293 codec_info(codec,
320 if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) {
323 } else if (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) {
330 if (!can_be_headset_mic(codec, &cfg->inputs[i], -1))
342 codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n");
344 codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n");
413 codec_info(codec, "autoconfig for %s: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
414 codec->core.chip_name, cfg->line_outs, cfg->line_out_pins[0],
420 codec_info(codec, " speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
424 codec_info(codec, " hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
428 codec_info(codec, " mono: mono_out=0x%x\n", cfg->mono_out_pin);
430 codec_info(codec, " dig-out=0x%x/0x%x\n",
432 codec_info(codec, " inputs:\n");
434 codec_info(codec, " %s=0x%x\n",
435 hda_get_autocfg_input_label(codec, cfg, i),
439 codec_info(codec, " dig-in=0x%x\n", cfg->dig_in_pin);
475 * @codec: the HDA codec
484 static const char *hda_get_input_pin_label(struct hda_codec *codec,
494 def_conf = snd_hda_codec_get_pincfg(codec, pin);
536 static int check_mic_location_need(struct hda_codec *codec,
543 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin);
551 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin);
564 * @codec: the HDA codec
573 const char *hda_get_autocfg_input_label(struct hda_codec *codec,
584 has_multiple_pins &= check_mic_location_need(codec, cfg, input);
585 has_multiple_pins |= codec->force_pin_prefix;
586 return hda_get_input_pin_label(codec, &cfg->inputs[input],
624 static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid)
626 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
639 static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid,
644 const char *pfx = check_output_pfx(codec, nid);
650 if (pfx == check_output_pfx(codec, pins[j]))
656 static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
661 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
668 pfx = check_output_pfx(codec, nid);
679 int idx = get_hp_label_index(codec, nid, cfg->hp_pins,
695 * @codec: the HDA codec
712 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
716 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
728 return fill_audio_out_name(codec, nid, cfg, "Line Out",
731 return fill_audio_out_name(codec, nid, cfg, "Speaker",
734 return fill_audio_out_name(codec, nid, cfg, "Headphone",
746 c = snd_hda_codec_get_pincfg(codec, pin);
756 name = hda_get_autocfg_input_label(codec, cfg, i);
762 name = hda_get_input_pin_label(codec, NULL, nid, true);
774 * @codec: the HDA codec
780 int snd_hda_add_verbs(struct hda_codec *codec,
784 v = snd_array_new(&codec->verbs);
794 * @codec: the HDA codec
796 void snd_hda_apply_verbs(struct hda_codec *codec)
801 snd_array_for_each(&codec->verbs, i, v)
802 snd_hda_sequence_write(codec, *v);
808 * @codec: the HDA codec
811 void snd_hda_apply_pincfgs(struct hda_codec *codec,
815 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
819 static void set_pin_targets(struct hda_codec *codec,
823 snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val);
826 void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth)
828 const char *modelname = codec->fixup_name;
831 const struct hda_fixup *fix = codec->fixup_list + id;
836 __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1);
842 codec_dbg(codec, "%s: Apply pincfg for %s\n",
843 codec->core.chip_name, modelname);
844 snd_hda_apply_pincfgs(codec, fix->v.pins);
849 codec_dbg(codec, "%s: Apply fix-verbs for %s\n",
850 codec->core.chip_name, modelname);
851 snd_hda_add_verbs(codec, fix->v.verbs);
856 codec_dbg(codec, "%s: Apply fix-func for %s\n",
857 codec->core.chip_name, modelname);
858 fix->v.func(codec, fix, action);
863 codec_dbg(codec, "%s: Apply pinctl for %s\n",
864 codec->core.chip_name, modelname);
865 set_pin_targets(codec, fix->v.pins);
868 codec_err(codec, "%s: Invalid fixup type %d\n",
869 codec->core.chip_name, fix->type);
881 * @codec: the HDA codec
884 void snd_hda_apply_fixup(struct hda_codec *codec, int action)
886 if (codec->fixup_list)
887 __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0);
893 static bool pin_config_match(struct hda_codec *codec,
900 snd_array_for_each(&codec->init_pins, i, pin) {
929 * @codec: the HDA codec
934 void snd_hda_pick_pin_fixup(struct hda_codec *codec,
941 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
945 if ((codec->core.subsystem_id & 0xffff0000) != (pq->subvendor << 16))
947 if (codec->core.vendor_id != pq->codec)
949 if (pin_config_match(codec, pq->pins, match_all_pins)) {
950 codec->fixup_id = pq->value;
952 codec->fixup_name = pq->name;
953 codec_dbg(codec, "%s: picked fixup %s (pin match)\n",
954 codec->core.chip_name, codec->fixup_name);
956 codec->fixup_list = fixlist;
964 * snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string
965 * @codec: the HDA codec
967 * @quirk: zero-terminated PCI/codec SSID quirk list
976 * If still nothing matched, try to look up the codec SSID.
978 void snd_hda_pick_fixup(struct hda_codec *codec,
987 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
991 if (codec->modelname && !strcmp(codec->modelname, "nofixup")) {
992 codec->fixup_list = NULL;
993 codec->fixup_name = NULL;
994 codec->fixup_id = HDA_FIXUP_ID_NO_FIXUP;
995 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n",
996 codec->core.chip_name);
1000 if (codec->modelname && models) {
1002 if (!strcmp(codec->modelname, models->name)) {
1003 codec->fixup_id = models->id;
1004 codec->fixup_name = models->name;
1005 codec->fixup_list = fixlist;
1006 codec_dbg(codec, "%s: picked fixup %s (model specified)\n",
1007 codec->core.chip_name, codec->fixup_name);
1014 q = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1019 codec_dbg(codec, "%s: picked fixup %s (PCI SSID%s)\n",
1020 codec->core.chip_name, name, q->subdevice_mask ? "" : " - vendor generic");
1029 if ((codec->core.subsystem_id & mask) == (vendorid & mask)) {
1033 codec_dbg(codec, "%s: picked fixup %s (codec SSID)\n",
1034 codec->core.chip_name, name);
1041 codec->fixup_id = id;
1043 codec->fixup_list = fixlist;
1044 codec->fixup_name = name;