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…
22 #define param_read(codec, nid, parm) \ argument
23 snd_hdac_read_parm_uncached(&(codec)->core, nid, parm)
38 if (wid_value == -1) in get_wid_type_name()
48 struct hda_codec *codec, hda_nid_t nid, in print_nid_array() argument
52 struct hda_nid_item *items = array->list, *item; in print_nid_array()
54 for (i = 0; i < array->used; i++) { in print_nid_array()
56 if (item->nid == nid) { in print_nid_array()
57 kctl = item->kctl; in print_nid_array()
60 kctl->id.name, kctl->id.index + item->index, in print_nid_array()
61 kctl->id.device); in print_nid_array()
62 if (item->flags & HDA_NID_ITEM_AMP) in print_nid_array()
75 struct hda_codec *codec, hda_nid_t nid) in print_nid_pcms() argument
80 list_for_each_entry(cpcm, &codec->pcm_list_head, list) { in print_nid_pcms()
82 if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) in print_nid_pcms()
86 cpcm->name, in print_nid_pcms()
87 snd_hda_pcm_type_name[cpcm->pcm_type], in print_nid_pcms()
88 cpcm->pcm->device); in print_nid_pcms()
94 struct hda_codec *codec, hda_nid_t nid, int dir) in print_amp_caps() argument
97 caps = param_read(codec, nid, dir == HDA_OUTPUT ? in print_amp_caps()
99 if (caps == -1 || caps == 0) { in print_amp_caps()
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, in is_stereo_amps() argument
119 /* check for a stereo-to-mono mix; it must be: in is_stereo_amps()
122 if (indices != 1 || dir != HDA_INPUT || in is_stereo_amps()
126 if (snd_hda_get_raw_connections(codec, nid, &conn, 1) < 0) in is_stereo_amps()
129 wcaps = snd_hda_param_read(codec, conn, AC_PAR_AUDIO_WIDGET_CAP); in is_stereo_amps()
134 struct hda_codec *codec, hda_nid_t nid, in print_amp_vals() argument
141 stereo = is_stereo_amps(codec, nid, dir, wcaps, indices); in print_amp_vals()
146 val = snd_hda_codec_read(codec, nid, 0, in print_amp_vals()
151 val = snd_hda_codec_read(codec, nid, 0, in print_amp_vals()
172 if (pcm & (1 << i)) in print_pcm_rates()
200 struct hda_codec *codec, hda_nid_t nid) in print_pcm_caps() argument
202 unsigned int pcm = param_read(codec, nid, AC_PAR_PCM); in print_pcm_caps()
203 unsigned int stream = param_read(codec, nid, AC_PAR_STREAM); in print_pcm_caps()
204 if (pcm == -1 || stream == -1) { in print_pcm_caps()
216 "Unknown", "1/8", "1/4", "ATAPI", in get_jack_connection()
260 "Mobile-In", "Mobile-Out" in get_jack_location()
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, in print_pin_caps() argument
313 caps = param_read(codec, nid, AC_PAR_PIN_CAP); in print_pin_caps()
329 if ((codec->core.vendor_id >> 16) == 0x10ec) in print_pin_caps()
359 *supports_vref = 1; in print_pin_caps()
363 val = snd_hda_codec_read(codec, nid, 0, in print_pin_caps()
374 caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); in print_pin_caps()
401 struct hda_codec *codec, hda_nid_t nid, in print_pin_ctls() argument
406 pinctls = snd_hda_codec_read(codec, nid, 0, in print_pin_ctls()
408 snd_iprintf(buffer, " Pin-ctls: 0x%02x:", pinctls); in print_pin_ctls()
439 struct hda_codec *codec, hda_nid_t nid) in print_vol_knob() argument
441 unsigned int cap = param_read(codec, nid, AC_PAR_VOL_KNB_CAP); in print_vol_knob()
442 snd_iprintf(buffer, " Volume-Knob: delta=%d, steps=%d, ", in print_vol_knob()
443 (cap >> 7) & 1, cap & 0x7f); in print_vol_knob()
444 cap = snd_hda_codec_read(codec, nid, 0, in print_vol_knob()
447 (cap >> 7) & 1, cap & 0x7f); in print_vol_knob()
451 struct hda_codec *codec, hda_nid_t nid, in print_audio_io() argument
454 int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); in print_audio_io()
461 int sdi = snd_hda_codec_read(codec, nid, 0, in print_audio_io()
463 snd_iprintf(buffer, " SDI-Select: %d\n", in print_audio_io()
469 struct hda_codec *codec, hda_nid_t nid) in print_digital_conv() argument
471 unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, in print_digital_conv()
486 snd_iprintf(buffer, " Non-Copyright"); in print_digital_conv()
488 snd_iprintf(buffer, " Non-Audio"); in print_digital_conv()
513 struct hda_codec *codec, hda_nid_t nid) in print_power_state() argument
526 int sup = param_read(codec, nid, AC_PAR_POWER_STATE); in print_power_state()
527 int pwr = snd_hda_codec_read(codec, nid, 0, in print_power_state()
529 if (sup != -1) { in print_power_state()
534 if (sup & (1U << i)) in print_power_state()
547 snd_iprintf(buffer, ", Clock-stop-OK"); in print_power_state()
549 snd_iprintf(buffer, ", Setting-reset"); in print_power_state()
554 struct hda_codec *codec, hda_nid_t nid) in print_unsol_cap() argument
556 int unsol = snd_hda_codec_read(codec, nid, 0, in print_unsol_cap()
561 (unsol & AC_UNSOL_ENABLED) ? 1 : 0); in print_unsol_cap()
564 static inline bool can_dump_coef(struct hda_codec *codec) in can_dump_coef() argument
568 case 1: return true; in can_dump_coef()
569 default: return codec->dump_coef; in can_dump_coef()
574 struct hda_codec *codec, hda_nid_t nid) in print_proc_caps() argument
577 unsigned int proc_caps = param_read(codec, nid, AC_PAR_PROC_CAP); in print_proc_caps()
582 if (!can_dump_coef(codec)) in print_proc_caps()
585 /* Note: This is racy - another process could run in parallel and change in print_proc_caps()
587 oldindex = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_COEF_INDEX, 0); in print_proc_caps()
590 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, i); in print_proc_caps()
591 val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, in print_proc_caps()
595 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, oldindex); in print_proc_caps()
599 struct hda_codec *codec, hda_nid_t nid, in print_conn_list() argument
603 int c, curr = -1; in print_conn_list()
607 if (conn_len > 1 && in print_conn_list()
611 curr = snd_hda_codec_read(codec, nid, 0, in print_conn_list()
625 cache_len = snd_hda_get_conn_list(codec, nid, &list); in print_conn_list()
628 snd_iprintf(buffer, " In-driver Connection: %d\n", cache_len); in print_conn_list()
639 struct hda_codec *codec, hda_nid_t nid) in print_gpio() argument
642 param_read(codec, codec->core.afg, AC_PAR_GPIO_CAP); in print_gpio()
650 (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, in print_gpio()
651 (gpio & AC_GPIO_WAKE) ? 1 : 0); in print_gpio()
655 enable = snd_hda_codec_read(codec, nid, 0, in print_gpio()
657 direction = snd_hda_codec_read(codec, nid, 0, in print_gpio()
659 wake = snd_hda_codec_read(codec, nid, 0, in print_gpio()
661 unsol = snd_hda_codec_read(codec, nid, 0, in print_gpio()
663 sticky = snd_hda_codec_read(codec, nid, 0, in print_gpio()
665 data = snd_hda_codec_read(codec, nid, 0, in print_gpio()
671 (enable & (1<<i)) ? 1 : 0, in print_gpio()
672 (direction & (1<<i)) ? 1 : 0, in print_gpio()
673 (wake & (1<<i)) ? 1 : 0, in print_gpio()
674 (sticky & (1<<i)) ? 1 : 0, in print_gpio()
675 (data & (1<<i)) ? 1 : 0, in print_gpio()
676 (unsol & (1<<i)) ? 1 : 0); in print_gpio()
678 print_nid_array(buffer, codec, nid, &codec->mixers); in print_gpio()
679 print_nid_array(buffer, codec, nid, &codec->nids); in print_gpio()
682 static void print_dpmst_connections(struct snd_info_buffer *buffer, struct hda_codec *codec, in print_dpmst_connections() argument
688 conn_len = snd_hda_get_num_raw_conns(codec, nid); in print_dpmst_connections()
696 dev_id_saved = snd_hda_get_dev_select(codec, nid); in print_dpmst_connections()
698 snd_hda_set_dev_select(codec, nid, dev_num); in print_dpmst_connections()
699 curr = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); in print_dpmst_connections()
700 if (snd_hda_get_raw_connections(codec, nid, conn, conn_len) < 0) in print_dpmst_connections()
711 snd_hda_set_dev_select(codec, nid, dev_id_saved); in print_dpmst_connections()
715 struct hda_codec *codec, hda_nid_t nid) in print_device_list() argument
717 int i, curr = -1; in print_device_list()
721 devlist_len = snd_hda_get_devices(codec, nid, dev_list, in print_device_list()
727 curr = snd_hda_codec_read(codec, nid, 0, in print_device_list()
742 print_dpmst_connections(buffer, codec, nid, i); in print_device_list()
748 static void print_codec_core_info(struct hdac_device *codec, in print_codec_core_info() argument
751 snd_iprintf(buffer, "Codec: "); in print_codec_core_info()
752 if (codec->vendor_name && codec->chip_name) in print_codec_core_info()
754 codec->vendor_name, codec->chip_name); in print_codec_core_info()
757 snd_iprintf(buffer, "Address: %d\n", codec->addr); in print_codec_core_info()
758 if (codec->afg) in print_codec_core_info()
760 codec->afg_function_id, codec->afg_unsol); in print_codec_core_info()
761 if (codec->mfg) in print_codec_core_info()
763 codec->mfg_function_id, codec->mfg_unsol); in print_codec_core_info()
764 snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); in print_codec_core_info()
765 snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); in print_codec_core_info()
766 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); in print_codec_core_info()
768 if (codec->mfg) in print_codec_core_info()
769 snd_iprintf(buffer, "Modem Function Group: 0x%x\n", codec->mfg); in print_codec_core_info()
777 struct hda_codec *codec = entry->private_data; in print_codec_info() local
781 print_codec_core_info(&codec->core, buffer); in print_codec_info()
782 fg = codec->core.afg; in print_codec_info()
785 snd_hda_power_up(codec); in print_codec_info()
787 print_pcm_caps(buffer, codec, fg); in print_codec_info()
788 snd_iprintf(buffer, "Default Amp-In caps: "); in print_codec_info()
789 print_amp_caps(buffer, codec, fg, HDA_INPUT); in print_codec_info()
790 snd_iprintf(buffer, "Default Amp-Out caps: "); in print_codec_info()
791 print_amp_caps(buffer, codec, fg, HDA_OUTPUT); in print_codec_info()
793 print_power_state(buffer, codec, fg); in print_codec_info()
795 nodes = snd_hda_get_sub_nodes(codec, fg, &nid); in print_codec_info()
798 snd_hda_power_down(codec); in print_codec_info()
802 print_gpio(buffer, codec, fg); in print_codec_info()
803 if (codec->proc_widget_hook) in print_codec_info()
804 codec->proc_widget_hook(buffer, codec, fg); in print_codec_info()
808 param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); in print_codec_info()
820 snd_iprintf(buffer, " %d-Channels", chans); in print_codec_info()
826 snd_iprintf(buffer, " Amp-In"); in print_codec_info()
828 snd_iprintf(buffer, " Amp-Out"); in print_codec_info()
837 print_nid_array(buffer, codec, nid, &codec->mixers); in print_codec_info()
838 print_nid_array(buffer, codec, nid, &codec->nids); in print_codec_info()
839 print_nid_pcms(buffer, codec, nid); in print_codec_info()
848 conn_len = snd_hda_get_num_raw_conns(codec, nid); in print_codec_info()
855 if (snd_hda_get_raw_connections(codec, nid, conn, in print_codec_info()
862 snd_iprintf(buffer, " Amp-In caps: "); in print_codec_info()
863 print_amp_caps(buffer, codec, nid, HDA_INPUT); in print_codec_info()
864 snd_iprintf(buffer, " Amp-In vals: "); in print_codec_info()
866 (codec->single_adc_amp && in print_codec_info()
868 print_amp_vals(buffer, codec, nid, HDA_INPUT, in print_codec_info()
869 wid_caps, 1); in print_codec_info()
871 print_amp_vals(buffer, codec, nid, HDA_INPUT, in print_codec_info()
875 snd_iprintf(buffer, " Amp-Out caps: "); in print_codec_info()
876 print_amp_caps(buffer, codec, nid, HDA_OUTPUT); in print_codec_info()
877 snd_iprintf(buffer, " Amp-Out vals: "); in print_codec_info()
879 codec->pin_amp_workaround) in print_codec_info()
880 print_amp_vals(buffer, codec, nid, HDA_OUTPUT, in print_codec_info()
883 print_amp_vals(buffer, codec, nid, HDA_OUTPUT, in print_codec_info()
884 wid_caps, 1); in print_codec_info()
890 print_pin_caps(buffer, codec, nid, &supports_vref); in print_codec_info()
891 print_pin_ctls(buffer, codec, nid, supports_vref); in print_codec_info()
895 print_vol_knob(buffer, codec, nid); in print_codec_info()
899 print_audio_io(buffer, codec, nid, wid_type); in print_codec_info()
901 print_digital_conv(buffer, codec, nid); in print_codec_info()
904 print_pcm_caps(buffer, codec, nid); in print_codec_info()
910 print_unsol_cap(buffer, codec, nid); in print_codec_info()
913 print_power_state(buffer, codec, nid); in print_codec_info()
920 if (wid_type == AC_WID_PIN && codec->dp_mst) in print_codec_info()
921 print_device_list(buffer, codec, nid); in print_codec_info()
924 print_conn_list(buffer, codec, nid, wid_type, in print_codec_info()
928 print_proc_caps(buffer, codec, nid); in print_codec_info()
930 if (codec->proc_widget_hook) in print_codec_info()
931 codec->proc_widget_hook(buffer, codec, nid); in print_codec_info()
935 snd_hda_power_down(codec); in print_codec_info()
941 int snd_hda_codec_proc_new(struct hda_codec *codec) in snd_hda_codec_proc_new() argument
945 snprintf(name, sizeof(name), "codec#%d", codec->core.addr); in snd_hda_codec_proc_new()
946 return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info); in snd_hda_codec_proc_new()