Lines Matching defs: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);
104 static bool check_pincap_validity(struct hda_codec *codec, hda_nid_t pin,
107 unsigned int pincap = snd_hda_query_pin_caps(codec, pin);
125 static bool can_be_headset_mic(struct hda_codec *codec,
137 def_conf = snd_hda_codec_get_pincfg(codec, item->pin);
168 int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
180 if (!snd_hda_get_int_hint(codec, "parser_flags", &i))
190 for_each_hda_codec_node(nid, codec) {
191 unsigned int wid_caps = get_wcaps(codec, nid);
203 def_conf = snd_hda_codec_get_pincfg(codec, nid);
217 if (!check_pincap_validity(codec, nid, dev))
233 codec_info(codec,
239 codec_info(codec,
252 codec_info(codec,
265 codec_info(codec,
275 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_MIC);
278 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_LINE_IN);
281 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_CD);
284 add_auto_cfg_input_pin(codec, cfg, nid, AUTO_PIN_AUX);
289 codec_info(codec,
316 if (hsmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xc)) {
319 } else if (hpmic && can_be_headset_mic(codec, &cfg->inputs[i], 0xd)) {
326 if (!can_be_headset_mic(codec, &cfg->inputs[i], -1))
338 codec_dbg(codec, "Told to look for a headset mic, but didn't find any.\n");
340 codec_dbg(codec, "Told to look for a headphone mic, but didn't find any.\n");
409 codec_info(codec, "autoconfig for %s: line_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x) type:%s\n",
410 codec->core.chip_name, cfg->line_outs, cfg->line_out_pins[0],
416 codec_info(codec, " speaker_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
420 codec_info(codec, " hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n",
424 codec_info(codec, " mono: mono_out=0x%x\n", cfg->mono_out_pin);
426 codec_info(codec, " dig-out=0x%x/0x%x\n",
428 codec_info(codec, " inputs:\n");
430 codec_info(codec, " %s=0x%x\n",
431 hda_get_autocfg_input_label(codec, cfg, i),
435 codec_info(codec, " dig-in=0x%x\n", cfg->dig_in_pin);
471 * @codec: the HDA codec
480 static const char *hda_get_input_pin_label(struct hda_codec *codec,
490 def_conf = snd_hda_codec_get_pincfg(codec, pin);
532 static int check_mic_location_need(struct hda_codec *codec,
539 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[input].pin);
547 defc = snd_hda_codec_get_pincfg(codec, cfg->inputs[i].pin);
560 * @codec: the HDA codec
569 const char *hda_get_autocfg_input_label(struct hda_codec *codec,
580 has_multiple_pins &= check_mic_location_need(codec, cfg, input);
581 has_multiple_pins |= codec->force_pin_prefix;
582 return hda_get_input_pin_label(codec, &cfg->inputs[input],
620 static const char *check_output_pfx(struct hda_codec *codec, hda_nid_t nid)
622 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
635 static int get_hp_label_index(struct hda_codec *codec, hda_nid_t nid,
640 const char *pfx = check_output_pfx(codec, nid);
646 if (pfx == check_output_pfx(codec, pins[j]))
652 static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
657 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
664 pfx = check_output_pfx(codec, nid);
675 int idx = get_hp_label_index(codec, nid, cfg->hp_pins,
691 * @codec: the HDA codec
708 int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
712 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
724 return fill_audio_out_name(codec, nid, cfg, "Line Out",
727 return fill_audio_out_name(codec, nid, cfg, "Speaker",
730 return fill_audio_out_name(codec, nid, cfg, "Headphone",
742 c = snd_hda_codec_get_pincfg(codec, pin);
752 name = hda_get_autocfg_input_label(codec, cfg, i);
758 name = hda_get_input_pin_label(codec, NULL, nid, true);
770 * @codec: the HDA codec
776 int snd_hda_add_verbs(struct hda_codec *codec,
780 v = snd_array_new(&codec->verbs);
790 * @codec: the HDA codec
792 void snd_hda_apply_verbs(struct hda_codec *codec)
797 snd_array_for_each(&codec->verbs, i, v)
798 snd_hda_sequence_write(codec, *v);
804 * @codec: the HDA codec
807 void snd_hda_apply_pincfgs(struct hda_codec *codec,
811 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
815 static void set_pin_targets(struct hda_codec *codec,
819 snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val);
822 void __snd_hda_apply_fixup(struct hda_codec *codec, int id, int action, int depth)
824 const char *modelname = codec->fixup_name;
827 const struct hda_fixup *fix = codec->fixup_list + id;
832 __snd_hda_apply_fixup(codec, fix->chain_id, action, depth + 1);
838 codec_dbg(codec, "%s: Apply pincfg for %s\n",
839 codec->core.chip_name, modelname);
840 snd_hda_apply_pincfgs(codec, fix->v.pins);
845 codec_dbg(codec, "%s: Apply fix-verbs for %s\n",
846 codec->core.chip_name, modelname);
847 snd_hda_add_verbs(codec, fix->v.verbs);
852 codec_dbg(codec, "%s: Apply fix-func for %s\n",
853 codec->core.chip_name, modelname);
854 fix->v.func(codec, fix, action);
859 codec_dbg(codec, "%s: Apply pinctl for %s\n",
860 codec->core.chip_name, modelname);
861 set_pin_targets(codec, fix->v.pins);
864 codec_err(codec, "%s: Invalid fixup type %d\n",
865 codec->core.chip_name, fix->type);
877 * @codec: the HDA codec
880 void snd_hda_apply_fixup(struct hda_codec *codec, int action)
882 if (codec->fixup_list)
883 __snd_hda_apply_fixup(codec, codec->fixup_id, action, 0);
889 static bool pin_config_match(struct hda_codec *codec,
896 snd_array_for_each(&codec->init_pins, i, pin) {
925 * @codec: the HDA codec
930 void snd_hda_pick_pin_fixup(struct hda_codec *codec,
937 if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
941 if ((codec->core.subsystem_id & 0xffff0000) != (pq->subvendor << 16))
943 if (codec->core.vendor_id != pq->codec)
945 if (pin_config_match(codec, pq->pins, match_all_pins)) {
946 codec->fixup_id = pq->value;
948 codec->fixup_name = pq->name;
949 codec_dbg(codec, "%s: picked fixup %s (pin match)\n",
950 codec->core.chip_name, codec->fixup_name);
952 codec->fixup_list = fixlist;
960 * snd_hda_pick_fixup - Pick up a fixup matching with PCI/codec SSID or model string
961 * @codec: the HDA codec
963 * @quirk: zero-terminated PCI/codec SSID quirk list
974 * If still nothing matched, try to look up the codec SSID.
976 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")) {
994 codec_dbg(codec, "%s: picked no fixup (nofixup specified)\n",
995 codec->core.chip_name);
1000 if (codec->modelname && models) {
1002 if (!strcmp(codec->modelname, models->name)) {
1005 codec_dbg(codec, "%s: picked fixup %s (model specified)\n",
1006 codec->core.chip_name, codec->fixup_name);
1017 if (codec->modelname &&
1018 sscanf(codec->modelname, "%04x:%04x", &vendor, &device) == 2) {
1027 q = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1033 /* match with the codec SSID */
1034 q = snd_pci_quirk_lookup_id(codec->core.subsystem_id >> 16,
1035 codec->core.subsystem_id & 0xffff,
1038 type = "codec SSID";
1049 codec_dbg(codec, "%s: picked fixup %s for %s %04x:%04x\n",
1050 codec->core.chip_name, name ? name : "",
1053 codec->fixup_id = id;
1054 codec->fixup_list = fixlist;
1055 codec->fixup_name = name;