Lines Matching +full:codec +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Universal Interface for Intel High Definition Audio Codec
17 static int dump_coef = -1;
19 MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1=auto, 0=disable, 1=enable)");
22 #define param_read(codec, nid, parm) \
23 snd_hdac_read_parm_uncached(&(codec)->core, nid, parm)
38 if (wid_value == -1)
48 struct hda_codec *codec, hda_nid_t nid,
52 struct hda_nid_item *items = array->list, *item;
54 for (i = 0; i < array->used; i++) {
56 if (item->nid == nid) {
57 kctl = item->kctl;
60 kctl->id.name, kctl->id.index + item->index,
61 kctl->id.device);
62 if (item->flags & HDA_NID_ITEM_AMP)
75 struct hda_codec *codec, hda_nid_t nid)
80 list_for_each_entry(cpcm, &codec->pcm_list_head, list) {
82 if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL)
86 cpcm->name,
87 snd_hda_pcm_type_name[cpcm->pcm_type],
88 cpcm->pcm->device);
94 struct hda_codec *codec, hda_nid_t nid, int dir)
97 caps = param_read(codec, nid, dir == HDA_OUTPUT ?
99 if (caps == -1 || caps == 0) {
111 /* is this a stereo widget or a stereo-to-mono mix? */
112 static bool is_stereo_amps(struct hda_codec *codec, hda_nid_t nid,
119 /* check for a stereo-to-mono mix; it must be:
122 if (indices != 1 || dir != HDA_INPUT ||
126 if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0)
129 wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP);
134 struct hda_codec *codec, hda_nid_t nid,
141 stereo = is_stereo_amps(codec, nid, dir, wcaps, indices);
146 val = snd_hda_codec_read(codec, nid, 0,
151 val = snd_hda_codec_read(codec, nid, 0,
172 if (pcm & (1 << i))
200 struct hda_codec *codec, hda_nid_t nid)
202 unsigned int pcm = param_read(codec, nid, AC_PAR_PCM);
203 unsigned int stream = param_read(codec, nid, AC_PAR_STREAM);
204 if (pcm == -1 || stream == -1) {
216 "Unknown", "1/8", "1/4", "ATAPI",
260 "Mobile-In", "Mobile-Out"
289 * jack type, i.e. the purpose of the jack, such as Line-Out or CD.
305 struct hda_codec *codec, hda_nid_t nid,
313 caps = param_read(codec, nid, AC_PAR_PIN_CAP);
329 if ((codec->core.vendor_id >> 16) == 0x10ec)
359 *supports_vref = 1;
363 val = snd_hda_codec_read(codec, nid, 0,
374 caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
401 struct hda_codec *codec, hda_nid_t nid,
406 pinctls = snd_hda_codec_read(codec, nid, 0,
408 snd_iprintf(buffer, " Pin-ctls: 0x%02x:", pinctls);
439 struct hda_codec *codec, hda_nid_t nid)
441 unsigned int cap = param_read(codec, nid, AC_PAR_VOL_KNB_CAP);
442 snd_iprintf(buffer, " Volume-Knob: delta=%d, steps=%d, ",
443 (cap >> 7) & 1, cap & 0x7f);
444 cap = snd_hda_codec_read(codec, nid, 0,
447 (cap >> 7) & 1, cap & 0x7f);
451 struct hda_codec *codec, hda_nid_t nid,
454 int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
461 int sdi = snd_hda_codec_read(codec, nid, 0,
463 snd_iprintf(buffer, " SDI-Select: %d\n",
469 struct hda_codec *codec, hda_nid_t nid)
471 unsigned int digi1 = snd_hda_codec_read(codec, nid, 0,
486 snd_iprintf(buffer, " Non-Copyright");
488 snd_iprintf(buffer, " Non-Audio");
513 struct hda_codec *codec, hda_nid_t nid)
526 int sup = param_read(codec, nid, AC_PAR_POWER_STATE);
527 int pwr = snd_hda_codec_read(codec, nid, 0,
529 if (sup != -1) {
534 if (sup & (1U << i))
547 snd_iprintf(buffer, ", Clock-stop-OK");
549 snd_iprintf(buffer, ", Setting-reset");
554 struct hda_codec *codec, hda_nid_t nid)
556 int unsol = snd_hda_codec_read(codec, nid, 0,
561 (unsol & AC_UNSOL_ENABLED) ? 1 : 0);
564 static inline bool can_dump_coef(struct hda_codec *codec)
568 case 1: return true;
569 default: return codec->dump_coef;
574 struct hda_codec *codec, hda_nid_t nid)
577 unsigned int proc_caps = param_read(codec, nid, AC_PAR_PROC_CAP);
582 if (!can_dump_coef(codec))
585 /* Note: This is racy - another process could run in parallel and change
587 oldindex = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_COEF_INDEX, 0);
590 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, i);
591 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF,
595 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, oldindex);
599 struct hda_codec *codec, hda_nid_t nid,
603 int c, curr = -1;
607 if (conn_len > 1 &&
611 curr = snd_hda_codec_read(codec, nid, 0,
625 cache_len = snd_hda_get_conn_list(codec, nid, &list);
628 snd_iprintf(buffer, " In-driver Connection: %d\n", cache_len);
639 struct hda_codec *codec, hda_nid_t nid)
642 param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP);
650 (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0,
651 (gpio & AC_GPIO_WAKE) ? 1 : 0);
655 enable = snd_hda_codec_read(codec, nid, 0,
657 direction = snd_hda_codec_read(codec, nid, 0,
659 wake = snd_hda_codec_read(codec, nid, 0,
661 unsol = snd_hda_codec_read(codec, nid, 0,
663 sticky = snd_hda_codec_read(codec, nid, 0,
665 data = snd_hda_codec_read(codec, nid, 0,
671 (enable & (1<<i)) ? 1 : 0,
672 (direction & (1<<i)) ? 1 : 0,
673 (wake & (1<<i)) ? 1 : 0,
674 (sticky & (1<<i)) ? 1 : 0,
675 (data & (1<<i)) ? 1 : 0,
676 (unsol & (1<<i)) ? 1 : 0);
678 print_nid_array(buffer, codec, nid, &codec->mixers);
679 print_nid_array(buffer, codec, nid, &codec->nids);
682 static void print_dpmst_connections(struct snd_info_buffer *buffer, struct hda_codec *codec,
688 conn_len = snd_hda_get_num_raw_conns(codec, nid);
696 dev_id_saved = snd_hda_get_dev_select(codec, nid);
698 snd_hda_set_dev_select(codec, nid, dev_num);
699 curr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0);
700 if (snd_hda_get_raw_connections(codec, nid, conn, conn_len) < 0)
711 snd_hda_set_dev_select(codec, nid, dev_id_saved);
715 struct hda_codec *codec, hda_nid_t nid)
717 int i, curr = -1;
721 devlist_len = snd_hda_get_devices(codec, nid, dev_list,
727 curr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_DEVICE_SEL, 0);
741 print_dpmst_connections(buffer, codec, nid, i);
747 static void print_codec_core_info(struct hdac_device *codec,
750 snd_iprintf(buffer, "Codec: ");
751 if (codec->vendor_name && codec->chip_name)
753 codec->vendor_name, codec->chip_name);
756 snd_iprintf(buffer, "Address: %d\n", codec->addr);
757 if (codec->afg)
759 codec->afg_function_id, codec->afg_unsol);
760 if (codec->mfg)
762 codec->mfg_function_id, codec->mfg_unsol);
763 snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id);
764 snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id);
765 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
767 if (codec->mfg)
768 snd_iprintf(buffer, "Modem Function Group: 0x%x\n", codec->mfg);
776 struct hda_codec *codec = entry->private_data;
780 print_codec_core_info(&codec->core, buffer);
781 fg = codec->core.afg;
784 CLASS(snd_hda_power, pm)(codec);
786 print_pcm_caps(buffer, codec, fg);
787 snd_iprintf(buffer, "Default Amp-In caps: ");
788 print_amp_caps(buffer, codec, fg, HDA_INPUT);
789 snd_iprintf(buffer, "Default Amp-Out caps: ");
790 print_amp_caps(buffer, codec, fg, HDA_OUTPUT);
792 print_power_state(buffer, codec, fg);
794 nodes = snd_hda_get_sub_nodes(codec, fg, &nid);
800 print_gpio(buffer, codec, fg);
801 if (codec->proc_widget_hook)
802 codec->proc_widget_hook(buffer, codec, fg);
806 param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
818 snd_iprintf(buffer, " %d-Channels", chans);
824 snd_iprintf(buffer, " Amp-In");
826 snd_iprintf(buffer, " Amp-Out");
835 print_nid_array(buffer, codec, nid, &codec->mixers);
836 print_nid_array(buffer, codec, nid, &codec->nids);
837 print_nid_pcms(buffer, codec, nid);
846 conn_len = snd_hda_get_num_raw_conns(codec, nid);
853 if (snd_hda_get_raw_connections(codec, nid, conn,
860 snd_iprintf(buffer, " Amp-In caps: ");
861 print_amp_caps(buffer, codec, nid, HDA_INPUT);
862 snd_iprintf(buffer, " Amp-In vals: ");
864 (codec->single_adc_amp &&
866 print_amp_vals(buffer, codec, nid, HDA_INPUT,
867 wid_caps, 1);
869 print_amp_vals(buffer, codec, nid, HDA_INPUT,
873 snd_iprintf(buffer, " Amp-Out caps: ");
874 print_amp_caps(buffer, codec, nid, HDA_OUTPUT);
875 snd_iprintf(buffer, " Amp-Out vals: ");
877 codec->pin_amp_workaround)
878 print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
881 print_amp_vals(buffer, codec, nid, HDA_OUTPUT,
882 wid_caps, 1);
888 print_pin_caps(buffer, codec, nid, &supports_vref);
889 print_pin_ctls(buffer, codec, nid, supports_vref);
893 print_vol_knob(buffer, codec, nid);
897 print_audio_io(buffer, codec, nid, wid_type);
899 print_digital_conv(buffer, codec, nid);
902 print_pcm_caps(buffer, codec, nid);
908 print_unsol_cap(buffer, codec, nid);
911 print_power_state(buffer, codec, nid);
918 if (wid_type == AC_WID_PIN && codec->dp_mst)
919 print_device_list(buffer, codec, nid);
922 print_conn_list(buffer, codec, nid, wid_type,
926 print_proc_caps(buffer, codec, nid);
928 if (codec->proc_widget_hook)
929 codec->proc_widget_hook(buffer, codec, nid);
938 int snd_hda_codec_proc_new(struct hda_codec *codec)
942 snprintf(name, sizeof(name), "codec#%d", codec->core.addr);
943 return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info);