Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Universal Interface for Intel High Definition Audio Codec |
| 3 | * |
| 4 | * Generic proc interface |
| 5 | * |
| 6 | * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> |
| 7 | * |
| 8 | * |
| 9 | * This driver is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by |
| 11 | * the Free Software Foundation; either version 2 of the License, or |
| 12 | * (at your option) any later version. |
| 13 | * |
| 14 | * This driver is distributed in the hope that it will be useful, |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 17 | * GNU General Public License for more details. |
| 18 | * |
| 19 | * You should have received a copy of the GNU General Public License |
| 20 | * along with this program; if not, write to the Free Software |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 22 | */ |
| 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #include <linux/init.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | #include <sound/core.h> |
| 26 | #include "hda_codec.h" |
Adrian Bunk | 1861204 | 2005-11-23 13:14:50 +0100 | [diff] [blame] | 27 | #include "hda_local.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | |
Wu Fengguang | 83d605f | 2009-11-18 12:38:08 +0800 | [diff] [blame] | 29 | static char *bits_names(unsigned int bits, char *names[], int size) |
| 30 | { |
| 31 | int i, n; |
| 32 | static char buf[128]; |
| 33 | |
| 34 | for (i = 0, n = 0; i < size; i++) { |
| 35 | if (bits & (1U<<i) && names[i]) |
| 36 | n += snprintf(buf + n, sizeof(buf) - n, " %s", |
| 37 | names[i]); |
| 38 | } |
| 39 | buf[n] = '\0'; |
| 40 | |
| 41 | return buf; |
| 42 | } |
| 43 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 44 | static const char *get_wid_type_name(unsigned int wid_value) |
| 45 | { |
| 46 | static char *names[16] = { |
| 47 | [AC_WID_AUD_OUT] = "Audio Output", |
| 48 | [AC_WID_AUD_IN] = "Audio Input", |
| 49 | [AC_WID_AUD_MIX] = "Audio Mixer", |
| 50 | [AC_WID_AUD_SEL] = "Audio Selector", |
| 51 | [AC_WID_PIN] = "Pin Complex", |
| 52 | [AC_WID_POWER] = "Power Widget", |
| 53 | [AC_WID_VOL_KNB] = "Volume Knob Widget", |
| 54 | [AC_WID_BEEP] = "Beep Generator Widget", |
| 55 | [AC_WID_VENDOR] = "Vendor Defined Widget", |
| 56 | }; |
Takashi Iwai | 24973a1 | 2012-01-10 12:41:22 +0100 | [diff] [blame] | 57 | if (wid_value == -1) |
| 58 | return "UNKNOWN Widget"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 59 | wid_value &= 0xf; |
| 60 | if (names[wid_value]) |
| 61 | return names[wid_value]; |
| 62 | else |
Takashi Iwai | 3bc8952 | 2006-10-17 20:41:38 +0200 | [diff] [blame] | 63 | return "UNKNOWN Widget"; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 66 | static void print_nid_array(struct snd_info_buffer *buffer, |
| 67 | struct hda_codec *codec, hda_nid_t nid, |
| 68 | struct snd_array *array) |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 69 | { |
| 70 | int i; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 71 | struct hda_nid_item *items = array->list, *item; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 72 | struct snd_kcontrol *kctl; |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 73 | for (i = 0; i < array->used; i++) { |
| 74 | item = &items[i]; |
| 75 | if (item->nid == nid) { |
| 76 | kctl = item->kctl; |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 77 | snd_iprintf(buffer, |
| 78 | " Control: name=\"%s\", index=%i, device=%i\n", |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 79 | kctl->id.name, kctl->id.index + item->index, |
| 80 | kctl->id.device); |
Jaroslav Kysela | 9e3fd87 | 2009-12-08 17:45:25 +0100 | [diff] [blame] | 81 | if (item->flags & HDA_NID_ITEM_AMP) |
| 82 | snd_iprintf(buffer, |
| 83 | " ControlAmp: chs=%lu, dir=%s, " |
| 84 | "idx=%lu, ofs=%lu\n", |
| 85 | get_amp_channels(kctl), |
| 86 | get_amp_direction(kctl) ? "Out" : "In", |
| 87 | get_amp_index(kctl), |
| 88 | get_amp_offset(kctl)); |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | static void print_nid_pcms(struct snd_info_buffer *buffer, |
| 94 | struct hda_codec *codec, hda_nid_t nid) |
| 95 | { |
| 96 | int pcm, type; |
| 97 | struct hda_pcm *cpcm; |
| 98 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { |
| 99 | cpcm = &codec->pcm_info[pcm]; |
| 100 | for (type = 0; type < 2; type++) { |
| 101 | if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) |
| 102 | continue; |
| 103 | snd_iprintf(buffer, " Device: name=\"%s\", " |
| 104 | "type=\"%s\", device=%i\n", |
| 105 | cpcm->name, |
| 106 | snd_hda_pcm_type_name[cpcm->pcm_type], |
| 107 | cpcm->pcm->device); |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 112 | static void print_amp_caps(struct snd_info_buffer *buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | struct hda_codec *codec, hda_nid_t nid, int dir) |
| 114 | { |
| 115 | unsigned int caps; |
Jaroslav Kysela | 7f0e2f8 | 2006-07-05 17:39:14 +0200 | [diff] [blame] | 116 | caps = snd_hda_param_read(codec, nid, |
| 117 | dir == HDA_OUTPUT ? |
| 118 | AC_PAR_AMP_OUT_CAP : AC_PAR_AMP_IN_CAP); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | if (caps == -1 || caps == 0) { |
| 120 | snd_iprintf(buffer, "N/A\n"); |
| 121 | return; |
| 122 | } |
Takashi Iwai | d01ce99 | 2007-07-27 16:52:19 +0200 | [diff] [blame] | 123 | snd_iprintf(buffer, "ofs=0x%02x, nsteps=0x%02x, stepsize=0x%02x, " |
| 124 | "mute=%x\n", |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | caps & AC_AMPCAP_OFFSET, |
| 126 | (caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT, |
| 127 | (caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT, |
| 128 | (caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT); |
| 129 | } |
| 130 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 131 | static void print_amp_vals(struct snd_info_buffer *buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 132 | struct hda_codec *codec, hda_nid_t nid, |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 133 | int dir, int stereo, int indices) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | { |
| 135 | unsigned int val; |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 136 | int i; |
| 137 | |
Jaroslav Kysela | 7f0e2f8 | 2006-07-05 17:39:14 +0200 | [diff] [blame] | 138 | dir = dir == HDA_OUTPUT ? AC_AMP_GET_OUTPUT : AC_AMP_GET_INPUT; |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 139 | for (i = 0; i < indices; i++) { |
| 140 | snd_iprintf(buffer, " ["); |
| 141 | if (stereo) { |
Takashi Iwai | d01ce99 | 2007-07-27 16:52:19 +0200 | [diff] [blame] | 142 | val = snd_hda_codec_read(codec, nid, 0, |
| 143 | AC_VERB_GET_AMP_GAIN_MUTE, |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 144 | AC_AMP_GET_LEFT | dir | i); |
| 145 | snd_iprintf(buffer, "0x%02x ", val); |
| 146 | } |
Takashi Iwai | d01ce99 | 2007-07-27 16:52:19 +0200 | [diff] [blame] | 147 | val = snd_hda_codec_read(codec, nid, 0, |
| 148 | AC_VERB_GET_AMP_GAIN_MUTE, |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 149 | AC_AMP_GET_RIGHT | dir | i); |
| 150 | snd_iprintf(buffer, "0x%02x]", val); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 151 | } |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 152 | snd_iprintf(buffer, "\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 153 | } |
| 154 | |
Wu Fengguang | 33deeca | 2008-11-18 11:47:51 +0800 | [diff] [blame] | 155 | static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) |
| 156 | { |
| 157 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; |
Wu Fengguang | d39b435 | 2008-11-19 15:14:02 +0800 | [diff] [blame] | 158 | |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 159 | pcm &= AC_SUPPCM_RATES; |
| 160 | snd_iprintf(buffer, " rates [0x%x]:", pcm); |
Wu Fengguang | 33deeca | 2008-11-18 11:47:51 +0800 | [diff] [blame] | 161 | snd_print_pcm_rates(pcm, buf, sizeof(buf)); |
| 162 | snd_iprintf(buffer, "%s\n", buf); |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 163 | } |
| 164 | |
Wu Fengguang | d39b435 | 2008-11-19 15:14:02 +0800 | [diff] [blame] | 165 | static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) |
| 166 | { |
| 167 | char buf[SND_PRINT_BITS_ADVISED_BUFSIZE]; |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 168 | |
Takashi Iwai | b0e6481 | 2008-11-25 16:07:01 +0100 | [diff] [blame] | 169 | snd_iprintf(buffer, " bits [0x%x]:", (pcm >> 16) & 0xff); |
Wu Fengguang | d39b435 | 2008-11-19 15:14:02 +0800 | [diff] [blame] | 170 | snd_print_pcm_bits(pcm, buf, sizeof(buf)); |
| 171 | snd_iprintf(buffer, "%s\n", buf); |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | static void print_pcm_formats(struct snd_info_buffer *buffer, |
| 175 | unsigned int streams) |
| 176 | { |
| 177 | snd_iprintf(buffer, " formats [0x%x]:", streams & 0xf); |
| 178 | if (streams & AC_SUPFMT_PCM) |
| 179 | snd_iprintf(buffer, " PCM"); |
| 180 | if (streams & AC_SUPFMT_FLOAT32) |
| 181 | snd_iprintf(buffer, " FLOAT"); |
| 182 | if (streams & AC_SUPFMT_AC3) |
| 183 | snd_iprintf(buffer, " AC3"); |
| 184 | snd_iprintf(buffer, "\n"); |
| 185 | } |
| 186 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 187 | static void print_pcm_caps(struct snd_info_buffer *buffer, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 188 | struct hda_codec *codec, hda_nid_t nid) |
| 189 | { |
| 190 | unsigned int pcm = snd_hda_param_read(codec, nid, AC_PAR_PCM); |
| 191 | unsigned int stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM); |
| 192 | if (pcm == -1 || stream == -1) { |
| 193 | snd_iprintf(buffer, "N/A\n"); |
| 194 | return; |
| 195 | } |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 196 | print_pcm_rates(buffer, pcm); |
| 197 | print_pcm_bits(buffer, pcm); |
| 198 | print_pcm_formats(buffer, stream); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 199 | } |
| 200 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 201 | static const char *get_jack_connection(u32 cfg) |
| 202 | { |
| 203 | static char *names[16] = { |
| 204 | "Unknown", "1/8", "1/4", "ATAPI", |
| 205 | "RCA", "Optical","Digital", "Analog", |
| 206 | "DIN", "XLR", "RJ11", "Comb", |
| 207 | NULL, NULL, NULL, "Other" |
| 208 | }; |
| 209 | cfg = (cfg & AC_DEFCFG_CONN_TYPE) >> AC_DEFCFG_CONN_TYPE_SHIFT; |
| 210 | if (names[cfg]) |
| 211 | return names[cfg]; |
| 212 | else |
| 213 | return "UNKNOWN"; |
| 214 | } |
| 215 | |
| 216 | static const char *get_jack_color(u32 cfg) |
| 217 | { |
| 218 | static char *names[16] = { |
| 219 | "Unknown", "Black", "Grey", "Blue", |
| 220 | "Green", "Red", "Orange", "Yellow", |
| 221 | "Purple", "Pink", NULL, NULL, |
| 222 | NULL, NULL, "White", "Other", |
| 223 | }; |
| 224 | cfg = (cfg & AC_DEFCFG_COLOR) >> AC_DEFCFG_COLOR_SHIFT; |
| 225 | if (names[cfg]) |
| 226 | return names[cfg]; |
| 227 | else |
| 228 | return "UNKNOWN"; |
| 229 | } |
| 230 | |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 231 | static void print_pin_caps(struct snd_info_buffer *buffer, |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 232 | struct hda_codec *codec, hda_nid_t nid, |
| 233 | int *supports_vref) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { |
Takashi Iwai | b0c95f5 | 2005-04-20 13:44:08 +0200 | [diff] [blame] | 235 | static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" }; |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 236 | unsigned int caps, val; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 237 | |
| 238 | caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); |
Robin H. Johnson | 0481f45 | 2008-09-13 16:54:57 -0700 | [diff] [blame] | 239 | snd_iprintf(buffer, " Pincap 0x%08x:", caps); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 240 | if (caps & AC_PINCAP_IN) |
| 241 | snd_iprintf(buffer, " IN"); |
| 242 | if (caps & AC_PINCAP_OUT) |
| 243 | snd_iprintf(buffer, " OUT"); |
| 244 | if (caps & AC_PINCAP_HP_DRV) |
| 245 | snd_iprintf(buffer, " HP"); |
Takashi Iwai | 5885492 | 2006-06-21 19:19:25 +0200 | [diff] [blame] | 246 | if (caps & AC_PINCAP_EAPD) |
| 247 | snd_iprintf(buffer, " EAPD"); |
| 248 | if (caps & AC_PINCAP_PRES_DETECT) |
| 249 | snd_iprintf(buffer, " Detect"); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 250 | if (caps & AC_PINCAP_BALANCE) |
| 251 | snd_iprintf(buffer, " Balanced"); |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 252 | if (caps & AC_PINCAP_HDMI) { |
| 253 | /* Realtek uses this bit as a different meaning */ |
| 254 | if ((codec->vendor_id >> 16) == 0x10ec) |
| 255 | snd_iprintf(buffer, " R/L"); |
Wu Fengguang | b923528 | 2009-12-11 12:28:33 +0800 | [diff] [blame] | 256 | else { |
| 257 | if (caps & AC_PINCAP_HBR) |
| 258 | snd_iprintf(buffer, " HBR"); |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 259 | snd_iprintf(buffer, " HDMI"); |
Wu Fengguang | b923528 | 2009-12-11 12:28:33 +0800 | [diff] [blame] | 260 | } |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 261 | } |
Wu Fengguang | 728765b | 2009-12-11 12:28:34 +0800 | [diff] [blame] | 262 | if (caps & AC_PINCAP_DP) |
| 263 | snd_iprintf(buffer, " DP"); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 264 | if (caps & AC_PINCAP_TRIG_REQ) |
| 265 | snd_iprintf(buffer, " Trigger"); |
| 266 | if (caps & AC_PINCAP_IMP_SENSE) |
| 267 | snd_iprintf(buffer, " ImpSense"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | snd_iprintf(buffer, "\n"); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 269 | if (caps & AC_PINCAP_VREF) { |
| 270 | unsigned int vref = |
| 271 | (caps & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
| 272 | snd_iprintf(buffer, " Vref caps:"); |
| 273 | if (vref & AC_PINCAP_VREF_HIZ) |
| 274 | snd_iprintf(buffer, " HIZ"); |
| 275 | if (vref & AC_PINCAP_VREF_50) |
| 276 | snd_iprintf(buffer, " 50"); |
| 277 | if (vref & AC_PINCAP_VREF_GRD) |
| 278 | snd_iprintf(buffer, " GRD"); |
| 279 | if (vref & AC_PINCAP_VREF_80) |
| 280 | snd_iprintf(buffer, " 80"); |
| 281 | if (vref & AC_PINCAP_VREF_100) |
| 282 | snd_iprintf(buffer, " 100"); |
| 283 | snd_iprintf(buffer, "\n"); |
| 284 | *supports_vref = 1; |
| 285 | } else |
| 286 | *supports_vref = 0; |
| 287 | if (caps & AC_PINCAP_EAPD) { |
| 288 | val = snd_hda_codec_read(codec, nid, 0, |
| 289 | AC_VERB_GET_EAPD_BTLENABLE, 0); |
| 290 | snd_iprintf(buffer, " EAPD 0x%x:", val); |
| 291 | if (val & AC_EAPDBTL_BALANCED) |
| 292 | snd_iprintf(buffer, " BALANCED"); |
| 293 | if (val & AC_EAPDBTL_EAPD) |
| 294 | snd_iprintf(buffer, " EAPD"); |
| 295 | if (val & AC_EAPDBTL_LR_SWAP) |
| 296 | snd_iprintf(buffer, " R/L"); |
| 297 | snd_iprintf(buffer, "\n"); |
| 298 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 299 | caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); |
Takashi Iwai | b0c95f5 | 2005-04-20 13:44:08 +0200 | [diff] [blame] | 300 | snd_iprintf(buffer, " Pin Default 0x%08x: [%s] %s at %s %s\n", caps, |
| 301 | jack_conns[(caps & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT], |
Matthew Ranostay | 50a9f79 | 2008-10-25 01:05:45 -0400 | [diff] [blame] | 302 | snd_hda_get_jack_type(caps), |
| 303 | snd_hda_get_jack_connectivity(caps), |
| 304 | snd_hda_get_jack_location(caps)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | snd_iprintf(buffer, " Conn = %s, Color = %s\n", |
| 306 | get_jack_connection(caps), |
| 307 | get_jack_color(caps)); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 308 | /* Default association and sequence values refer to default grouping |
| 309 | * of pin complexes and their sequence within the group. This is used |
| 310 | * for priority and resource allocation. |
| 311 | */ |
| 312 | snd_iprintf(buffer, " DefAssociation = 0x%x, Sequence = 0x%x\n", |
| 313 | (caps & AC_DEFCFG_DEF_ASSOC) >> AC_DEFCFG_ASSOC_SHIFT, |
| 314 | caps & AC_DEFCFG_SEQUENCE); |
| 315 | if (((caps & AC_DEFCFG_MISC) >> AC_DEFCFG_MISC_SHIFT) & |
| 316 | AC_DEFCFG_MISC_NO_PRESENCE) { |
| 317 | /* Miscellaneous bit indicates external hardware does not |
| 318 | * support presence detection even if the pin complex |
| 319 | * indicates it is supported. |
| 320 | */ |
| 321 | snd_iprintf(buffer, " Misc = NO_PRESENCE\n"); |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 322 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 323 | } |
| 324 | |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 325 | static void print_pin_ctls(struct snd_info_buffer *buffer, |
| 326 | struct hda_codec *codec, hda_nid_t nid, |
| 327 | int supports_vref) |
| 328 | { |
| 329 | unsigned int pinctls; |
| 330 | |
| 331 | pinctls = snd_hda_codec_read(codec, nid, 0, |
| 332 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
| 333 | snd_iprintf(buffer, " Pin-ctls: 0x%02x:", pinctls); |
| 334 | if (pinctls & AC_PINCTL_IN_EN) |
| 335 | snd_iprintf(buffer, " IN"); |
| 336 | if (pinctls & AC_PINCTL_OUT_EN) |
| 337 | snd_iprintf(buffer, " OUT"); |
| 338 | if (pinctls & AC_PINCTL_HP_EN) |
| 339 | snd_iprintf(buffer, " HP"); |
| 340 | if (supports_vref) { |
| 341 | int vref = pinctls & AC_PINCTL_VREFEN; |
| 342 | switch (vref) { |
| 343 | case AC_PINCTL_VREF_HIZ: |
| 344 | snd_iprintf(buffer, " VREF_HIZ"); |
| 345 | break; |
| 346 | case AC_PINCTL_VREF_50: |
| 347 | snd_iprintf(buffer, " VREF_50"); |
| 348 | break; |
| 349 | case AC_PINCTL_VREF_GRD: |
| 350 | snd_iprintf(buffer, " VREF_GRD"); |
| 351 | break; |
| 352 | case AC_PINCTL_VREF_80: |
| 353 | snd_iprintf(buffer, " VREF_80"); |
| 354 | break; |
| 355 | case AC_PINCTL_VREF_100: |
| 356 | snd_iprintf(buffer, " VREF_100"); |
| 357 | break; |
| 358 | } |
| 359 | } |
| 360 | snd_iprintf(buffer, "\n"); |
| 361 | } |
| 362 | |
| 363 | static void print_vol_knob(struct snd_info_buffer *buffer, |
| 364 | struct hda_codec *codec, hda_nid_t nid) |
| 365 | { |
| 366 | unsigned int cap = snd_hda_param_read(codec, nid, |
| 367 | AC_PAR_VOL_KNB_CAP); |
| 368 | snd_iprintf(buffer, " Volume-Knob: delta=%d, steps=%d, ", |
| 369 | (cap >> 7) & 1, cap & 0x7f); |
| 370 | cap = snd_hda_codec_read(codec, nid, 0, |
| 371 | AC_VERB_GET_VOLUME_KNOB_CONTROL, 0); |
| 372 | snd_iprintf(buffer, "direct=%d, val=%d\n", |
| 373 | (cap >> 7) & 1, cap & 0x7f); |
| 374 | } |
| 375 | |
| 376 | static void print_audio_io(struct snd_info_buffer *buffer, |
| 377 | struct hda_codec *codec, hda_nid_t nid, |
| 378 | unsigned int wid_type) |
| 379 | { |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 380 | int conv = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 381 | snd_iprintf(buffer, |
| 382 | " Converter: stream=%d, channel=%d\n", |
| 383 | (conv & AC_CONV_STREAM) >> AC_CONV_STREAM_SHIFT, |
| 384 | conv & AC_CONV_CHANNEL); |
| 385 | |
| 386 | if (wid_type == AC_WID_AUD_IN && (conv & AC_CONV_CHANNEL) == 0) { |
| 387 | int sdi = snd_hda_codec_read(codec, nid, 0, |
| 388 | AC_VERB_GET_SDI_SELECT, 0); |
| 389 | snd_iprintf(buffer, " SDI-Select: %d\n", |
| 390 | sdi & AC_SDI_SELECT); |
| 391 | } |
| 392 | } |
| 393 | |
| 394 | static void print_digital_conv(struct snd_info_buffer *buffer, |
| 395 | struct hda_codec *codec, hda_nid_t nid) |
| 396 | { |
| 397 | unsigned int digi1 = snd_hda_codec_read(codec, nid, 0, |
| 398 | AC_VERB_GET_DIGI_CONVERT_1, 0); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 399 | snd_iprintf(buffer, " Digital:"); |
| 400 | if (digi1 & AC_DIG1_ENABLE) |
| 401 | snd_iprintf(buffer, " Enabled"); |
| 402 | if (digi1 & AC_DIG1_V) |
| 403 | snd_iprintf(buffer, " Validity"); |
| 404 | if (digi1 & AC_DIG1_VCFG) |
| 405 | snd_iprintf(buffer, " ValidityCfg"); |
| 406 | if (digi1 & AC_DIG1_EMPHASIS) |
| 407 | snd_iprintf(buffer, " Preemphasis"); |
| 408 | if (digi1 & AC_DIG1_COPYRIGHT) |
| 409 | snd_iprintf(buffer, " Copyright"); |
| 410 | if (digi1 & AC_DIG1_NONAUDIO) |
| 411 | snd_iprintf(buffer, " Non-Audio"); |
| 412 | if (digi1 & AC_DIG1_PROFESSIONAL) |
| 413 | snd_iprintf(buffer, " Pro"); |
| 414 | if (digi1 & AC_DIG1_LEVEL) |
| 415 | snd_iprintf(buffer, " GenLevel"); |
| 416 | snd_iprintf(buffer, "\n"); |
Takashi Iwai | a1855d8 | 2008-06-19 15:41:37 +0200 | [diff] [blame] | 417 | snd_iprintf(buffer, " Digital category: 0x%x\n", |
| 418 | (digi1 >> 8) & AC_DIG2_CC); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 419 | } |
| 420 | |
| 421 | static const char *get_pwr_state(u32 state) |
| 422 | { |
Takashi Iwai | ea73496 | 2011-01-17 11:29:34 +0100 | [diff] [blame] | 423 | static const char * const buf[4] = { |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 424 | "D0", "D1", "D2", "D3" |
| 425 | }; |
| 426 | if (state < 4) |
| 427 | return buf[state]; |
| 428 | return "UNKNOWN"; |
| 429 | } |
| 430 | |
| 431 | static void print_power_state(struct snd_info_buffer *buffer, |
| 432 | struct hda_codec *codec, hda_nid_t nid) |
| 433 | { |
Wu Fengguang | 83d605f | 2009-11-18 12:38:08 +0800 | [diff] [blame] | 434 | static char *names[] = { |
| 435 | [ilog2(AC_PWRST_D0SUP)] = "D0", |
| 436 | [ilog2(AC_PWRST_D1SUP)] = "D1", |
| 437 | [ilog2(AC_PWRST_D2SUP)] = "D2", |
| 438 | [ilog2(AC_PWRST_D3SUP)] = "D3", |
| 439 | [ilog2(AC_PWRST_D3COLDSUP)] = "D3cold", |
| 440 | [ilog2(AC_PWRST_S3D3COLDSUP)] = "S3D3cold", |
| 441 | [ilog2(AC_PWRST_CLKSTOP)] = "CLKSTOP", |
| 442 | [ilog2(AC_PWRST_EPSS)] = "EPSS", |
| 443 | }; |
| 444 | |
| 445 | int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 446 | int pwr = snd_hda_codec_read(codec, nid, 0, |
| 447 | AC_VERB_GET_POWER_STATE, 0); |
Wu Fengguang | 83d605f | 2009-11-18 12:38:08 +0800 | [diff] [blame] | 448 | if (sup) |
| 449 | snd_iprintf(buffer, " Power states: %s\n", |
| 450 | bits_names(sup, names, ARRAY_SIZE(names))); |
| 451 | |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 452 | snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", |
| 453 | get_pwr_state(pwr & AC_PWRST_SETTING), |
| 454 | get_pwr_state((pwr & AC_PWRST_ACTUAL) >> |
| 455 | AC_PWRST_ACTUAL_SHIFT)); |
| 456 | } |
| 457 | |
| 458 | static void print_unsol_cap(struct snd_info_buffer *buffer, |
| 459 | struct hda_codec *codec, hda_nid_t nid) |
| 460 | { |
| 461 | int unsol = snd_hda_codec_read(codec, nid, 0, |
| 462 | AC_VERB_GET_UNSOLICITED_RESPONSE, 0); |
| 463 | snd_iprintf(buffer, |
| 464 | " Unsolicited: tag=%02x, enabled=%d\n", |
| 465 | unsol & AC_UNSOL_TAG, |
| 466 | (unsol & AC_UNSOL_ENABLED) ? 1 : 0); |
| 467 | } |
| 468 | |
| 469 | static void print_proc_caps(struct snd_info_buffer *buffer, |
| 470 | struct hda_codec *codec, hda_nid_t nid) |
| 471 | { |
| 472 | unsigned int proc_caps = snd_hda_param_read(codec, nid, |
| 473 | AC_PAR_PROC_CAP); |
| 474 | snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n", |
| 475 | proc_caps & AC_PCAP_BENIGN, |
| 476 | (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT); |
| 477 | } |
| 478 | |
| 479 | static void print_conn_list(struct snd_info_buffer *buffer, |
| 480 | struct hda_codec *codec, hda_nid_t nid, |
| 481 | unsigned int wid_type, hda_nid_t *conn, |
| 482 | int conn_len) |
| 483 | { |
| 484 | int c, curr = -1; |
| 485 | |
Takashi Iwai | 07a1e81 | 2009-03-19 17:08:19 +0100 | [diff] [blame] | 486 | if (conn_len > 1 && |
| 487 | wid_type != AC_WID_AUD_MIX && |
| 488 | wid_type != AC_WID_VOL_KNB && |
| 489 | wid_type != AC_WID_POWER) |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 490 | curr = snd_hda_codec_read(codec, nid, 0, |
| 491 | AC_VERB_GET_CONNECT_SEL, 0); |
| 492 | snd_iprintf(buffer, " Connection: %d\n", conn_len); |
| 493 | if (conn_len > 0) { |
| 494 | snd_iprintf(buffer, " "); |
| 495 | for (c = 0; c < conn_len; c++) { |
| 496 | snd_iprintf(buffer, " 0x%02x", conn[c]); |
| 497 | if (c == curr) |
| 498 | snd_iprintf(buffer, "*"); |
| 499 | } |
| 500 | snd_iprintf(buffer, "\n"); |
| 501 | } |
| 502 | } |
| 503 | |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 504 | static void print_gpio(struct snd_info_buffer *buffer, |
| 505 | struct hda_codec *codec, hda_nid_t nid) |
| 506 | { |
| 507 | unsigned int gpio = |
| 508 | snd_hda_param_read(codec, codec->afg, AC_PAR_GPIO_CAP); |
| 509 | unsigned int enable, direction, wake, unsol, sticky, data; |
| 510 | int i, max; |
| 511 | snd_iprintf(buffer, "GPIO: io=%d, o=%d, i=%d, " |
| 512 | "unsolicited=%d, wake=%d\n", |
| 513 | gpio & AC_GPIO_IO_COUNT, |
| 514 | (gpio & AC_GPIO_O_COUNT) >> AC_GPIO_O_COUNT_SHIFT, |
| 515 | (gpio & AC_GPIO_I_COUNT) >> AC_GPIO_I_COUNT_SHIFT, |
| 516 | (gpio & AC_GPIO_UNSOLICITED) ? 1 : 0, |
| 517 | (gpio & AC_GPIO_WAKE) ? 1 : 0); |
| 518 | max = gpio & AC_GPIO_IO_COUNT; |
Takashi Iwai | c4dc507 | 2008-11-04 13:30:57 +0100 | [diff] [blame] | 519 | if (!max || max > 8) |
| 520 | return; |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 521 | enable = snd_hda_codec_read(codec, nid, 0, |
| 522 | AC_VERB_GET_GPIO_MASK, 0); |
| 523 | direction = snd_hda_codec_read(codec, nid, 0, |
| 524 | AC_VERB_GET_GPIO_DIRECTION, 0); |
| 525 | wake = snd_hda_codec_read(codec, nid, 0, |
| 526 | AC_VERB_GET_GPIO_WAKE_MASK, 0); |
| 527 | unsol = snd_hda_codec_read(codec, nid, 0, |
| 528 | AC_VERB_GET_GPIO_UNSOLICITED_RSP_MASK, 0); |
| 529 | sticky = snd_hda_codec_read(codec, nid, 0, |
| 530 | AC_VERB_GET_GPIO_STICKY_MASK, 0); |
| 531 | data = snd_hda_codec_read(codec, nid, 0, |
| 532 | AC_VERB_GET_GPIO_DATA, 0); |
| 533 | for (i = 0; i < max; ++i) |
| 534 | snd_iprintf(buffer, |
| 535 | " IO[%d]: enable=%d, dir=%d, wake=%d, " |
Takashi Iwai | 8563964 | 2008-11-19 14:14:50 +0100 | [diff] [blame] | 536 | "sticky=%d, data=%d, unsol=%d\n", i, |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 537 | (enable & (1<<i)) ? 1 : 0, |
| 538 | (direction & (1<<i)) ? 1 : 0, |
| 539 | (wake & (1<<i)) ? 1 : 0, |
| 540 | (sticky & (1<<i)) ? 1 : 0, |
Takashi Iwai | 8563964 | 2008-11-19 14:14:50 +0100 | [diff] [blame] | 541 | (data & (1<<i)) ? 1 : 0, |
| 542 | (unsol & (1<<i)) ? 1 : 0); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 543 | /* FIXME: add GPO and GPI pin information */ |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 544 | print_nid_array(buffer, codec, nid, &codec->mixers); |
| 545 | print_nid_array(buffer, codec, nid, &codec->nids); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 546 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 547 | |
Takashi Iwai | d01ce99 | 2007-07-27 16:52:19 +0200 | [diff] [blame] | 548 | static void print_codec_info(struct snd_info_entry *entry, |
| 549 | struct snd_info_buffer *buffer) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 550 | { |
| 551 | struct hda_codec *codec = entry->private_data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | hda_nid_t nid; |
| 553 | int i, nodes; |
| 554 | |
Takashi Iwai | 812a2cc | 2009-05-16 10:00:49 +0200 | [diff] [blame] | 555 | snd_iprintf(buffer, "Codec: "); |
| 556 | if (codec->vendor_name && codec->chip_name) |
| 557 | snd_iprintf(buffer, "%s %s\n", |
| 558 | codec->vendor_name, codec->chip_name); |
| 559 | else |
| 560 | snd_iprintf(buffer, "Not Set\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 561 | snd_iprintf(buffer, "Address: %d\n", codec->addr); |
Jaroslav Kysela | 79c944a | 2010-07-19 15:52:39 +0200 | [diff] [blame] | 562 | if (codec->afg) |
| 563 | snd_iprintf(buffer, "AFG Function Id: 0x%x (unsol %u)\n", |
| 564 | codec->afg_function_id, codec->afg_unsol); |
| 565 | if (codec->mfg) |
| 566 | snd_iprintf(buffer, "MFG Function Id: 0x%x (unsol %u)\n", |
| 567 | codec->mfg_function_id, codec->mfg_unsol); |
Pascal de Bruijn | 234b434 | 2009-03-23 11:15:59 +0100 | [diff] [blame] | 568 | snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); |
| 569 | snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 570 | snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); |
Jonathan Phenix | e25c05f | 2007-06-19 18:31:28 +0200 | [diff] [blame] | 571 | |
| 572 | if (codec->mfg) |
| 573 | snd_iprintf(buffer, "Modem Function Group: 0x%x\n", codec->mfg); |
| 574 | else |
| 575 | snd_iprintf(buffer, "No Modem Function Group found\n"); |
| 576 | |
Takashi Iwai | ec9e1c5 | 2005-09-07 13:29:22 +0200 | [diff] [blame] | 577 | if (! codec->afg) |
| 578 | return; |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 579 | snd_hda_power_up(codec); |
Takashi Iwai | b90d776 | 2006-11-07 16:10:06 +0100 | [diff] [blame] | 580 | snd_iprintf(buffer, "Default PCM:\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 581 | print_pcm_caps(buffer, codec, codec->afg); |
| 582 | snd_iprintf(buffer, "Default Amp-In caps: "); |
| 583 | print_amp_caps(buffer, codec, codec->afg, HDA_INPUT); |
| 584 | snd_iprintf(buffer, "Default Amp-Out caps: "); |
| 585 | print_amp_caps(buffer, codec, codec->afg, HDA_OUTPUT); |
| 586 | |
| 587 | nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid); |
| 588 | if (! nid || nodes < 0) { |
| 589 | snd_iprintf(buffer, "Invalid AFG subtree\n"); |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 590 | snd_hda_power_down(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 591 | return; |
| 592 | } |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 593 | |
| 594 | print_gpio(buffer, codec, codec->afg); |
Takashi Iwai | 2d34e1b | 2008-11-28 14:35:16 +0100 | [diff] [blame] | 595 | if (codec->proc_widget_hook) |
| 596 | codec->proc_widget_hook(buffer, codec, codec->afg); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 597 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 598 | for (i = 0; i < nodes; i++, nid++) { |
Takashi Iwai | d01ce99 | 2007-07-27 16:52:19 +0200 | [diff] [blame] | 599 | unsigned int wid_caps = |
| 600 | snd_hda_param_read(codec, nid, |
| 601 | AC_PAR_AUDIO_WIDGET_CAP); |
Takashi Iwai | a22d543 | 2009-07-27 12:54:26 +0200 | [diff] [blame] | 602 | unsigned int wid_type = get_wcaps_type(wid_caps); |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 603 | hda_nid_t conn[HDA_MAX_CONNECTIONS]; |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 604 | int conn_len = 0; |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 605 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 606 | snd_iprintf(buffer, "Node 0x%02x [%s] wcaps 0x%x:", nid, |
| 607 | get_wid_type_name(wid_type), wid_caps); |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 608 | if (wid_caps & AC_WCAP_STEREO) { |
Wu Fengguang | fd72d00 | 2009-08-24 09:50:46 +0800 | [diff] [blame] | 609 | unsigned int chans = get_wcaps_channels(wid_caps); |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 610 | if (chans == 2) |
| 611 | snd_iprintf(buffer, " Stereo"); |
| 612 | else |
| 613 | snd_iprintf(buffer, " %d-Channels", chans); |
| 614 | } else |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 615 | snd_iprintf(buffer, " Mono"); |
| 616 | if (wid_caps & AC_WCAP_DIGITAL) |
| 617 | snd_iprintf(buffer, " Digital"); |
| 618 | if (wid_caps & AC_WCAP_IN_AMP) |
| 619 | snd_iprintf(buffer, " Amp-In"); |
| 620 | if (wid_caps & AC_WCAP_OUT_AMP) |
| 621 | snd_iprintf(buffer, " Amp-Out"); |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 622 | if (wid_caps & AC_WCAP_STRIPE) |
| 623 | snd_iprintf(buffer, " Stripe"); |
| 624 | if (wid_caps & AC_WCAP_LR_SWAP) |
| 625 | snd_iprintf(buffer, " R/L"); |
Takashi Iwai | c492060 | 2008-07-30 15:13:29 +0200 | [diff] [blame] | 626 | if (wid_caps & AC_WCAP_CP_CAPS) |
| 627 | snd_iprintf(buffer, " CP"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 628 | snd_iprintf(buffer, "\n"); |
| 629 | |
Jaroslav Kysela | 5b0cb1d | 2009-12-08 16:13:32 +0100 | [diff] [blame] | 630 | print_nid_array(buffer, codec, nid, &codec->mixers); |
| 631 | print_nid_array(buffer, codec, nid, &codec->nids); |
Jaroslav Kysela | 3911a4c | 2009-11-11 13:43:01 +0100 | [diff] [blame] | 632 | print_nid_pcms(buffer, codec, nid); |
| 633 | |
Takashi Iwai | e171613 | 2007-11-16 17:52:39 +0100 | [diff] [blame] | 634 | /* volume knob is a special widget that always have connection |
| 635 | * list |
| 636 | */ |
| 637 | if (wid_type == AC_WID_VOL_KNB) |
| 638 | wid_caps |= AC_WCAP_CONN_LIST; |
| 639 | |
Takashi Iwai | 3e289f1 | 2005-06-10 19:45:09 +0200 | [diff] [blame] | 640 | if (wid_caps & AC_WCAP_CONN_LIST) |
| 641 | conn_len = snd_hda_get_connections(codec, nid, conn, |
| 642 | HDA_MAX_CONNECTIONS); |
| 643 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 644 | if (wid_caps & AC_WCAP_IN_AMP) { |
| 645 | snd_iprintf(buffer, " Amp-In caps: "); |
| 646 | print_amp_caps(buffer, codec, nid, HDA_INPUT); |
| 647 | snd_iprintf(buffer, " Amp-In vals: "); |
| 648 | print_amp_vals(buffer, codec, nid, HDA_INPUT, |
Takashi Iwai | 9e03ad7 | 2008-02-22 18:46:00 +0100 | [diff] [blame] | 649 | wid_caps & AC_WCAP_STEREO, |
| 650 | wid_type == AC_WID_PIN ? 1 : conn_len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | } |
| 652 | if (wid_caps & AC_WCAP_OUT_AMP) { |
| 653 | snd_iprintf(buffer, " Amp-Out caps: "); |
| 654 | print_amp_caps(buffer, codec, nid, HDA_OUTPUT); |
| 655 | snd_iprintf(buffer, " Amp-Out vals: "); |
Takashi Iwai | 9421f95 | 2009-03-12 17:06:07 +0100 | [diff] [blame] | 656 | if (wid_type == AC_WID_PIN && |
| 657 | codec->pin_amp_workaround) |
| 658 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, |
| 659 | wid_caps & AC_WCAP_STEREO, |
| 660 | conn_len); |
| 661 | else |
| 662 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, |
| 663 | wid_caps & AC_WCAP_STEREO, 1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 664 | } |
| 665 | |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 666 | switch (wid_type) { |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 667 | case AC_WID_PIN: { |
| 668 | int supports_vref; |
| 669 | print_pin_caps(buffer, codec, nid, &supports_vref); |
| 670 | print_pin_ctls(buffer, codec, nid, supports_vref); |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 671 | break; |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 672 | } |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 673 | case AC_WID_VOL_KNB: |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 674 | print_vol_knob(buffer, codec, nid); |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 675 | break; |
| 676 | case AC_WID_AUD_OUT: |
| 677 | case AC_WID_AUD_IN: |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 678 | print_audio_io(buffer, codec, nid, wid_type); |
| 679 | if (wid_caps & AC_WCAP_DIGITAL) |
| 680 | print_digital_conv(buffer, codec, nid); |
Takashi Iwai | e97a516 | 2007-10-26 14:56:36 +0200 | [diff] [blame] | 681 | if (wid_caps & AC_WCAP_FORMAT_OVRD) { |
| 682 | snd_iprintf(buffer, " PCM:\n"); |
| 683 | print_pcm_caps(buffer, codec, nid); |
| 684 | } |
| 685 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 686 | } |
| 687 | |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 688 | if (wid_caps & AC_WCAP_UNSOL_CAP) |
| 689 | print_unsol_cap(buffer, codec, nid); |
Takashi Iwai | b7027cc | 2005-11-02 18:13:41 +0100 | [diff] [blame] | 690 | |
Andrew Paprocki | 797760a | 2008-01-18 12:51:11 +0100 | [diff] [blame] | 691 | if (wid_caps & AC_WCAP_POWER) |
| 692 | print_power_state(buffer, codec, nid); |
| 693 | |
| 694 | if (wid_caps & AC_WCAP_DELAY) |
| 695 | snd_iprintf(buffer, " Delay: %d samples\n", |
| 696 | (wid_caps & AC_WCAP_DELAY) >> |
| 697 | AC_WCAP_DELAY_SHIFT); |
| 698 | |
| 699 | if (wid_caps & AC_WCAP_CONN_LIST) |
| 700 | print_conn_list(buffer, codec, nid, wid_type, |
| 701 | conn, conn_len); |
| 702 | |
| 703 | if (wid_caps & AC_WCAP_PROC_WID) |
| 704 | print_proc_caps(buffer, codec, nid); |
| 705 | |
Takashi Iwai | daead53 | 2008-11-28 12:55:36 +0100 | [diff] [blame] | 706 | if (codec->proc_widget_hook) |
| 707 | codec->proc_widget_hook(buffer, codec, nid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 708 | } |
Takashi Iwai | cb53c62 | 2007-08-10 17:21:45 +0200 | [diff] [blame] | 709 | snd_hda_power_down(codec); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 710 | } |
| 711 | |
| 712 | /* |
| 713 | * create a proc read |
| 714 | */ |
| 715 | int snd_hda_codec_proc_new(struct hda_codec *codec) |
| 716 | { |
| 717 | char name[32]; |
Takashi Iwai | c8b6bf9b | 2005-11-17 14:57:47 +0100 | [diff] [blame] | 718 | struct snd_info_entry *entry; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 719 | int err; |
| 720 | |
| 721 | snprintf(name, sizeof(name), "codec#%d", codec->addr); |
| 722 | err = snd_card_proc_new(codec->bus->card, name, &entry); |
| 723 | if (err < 0) |
| 724 | return err; |
| 725 | |
Takashi Iwai | bf85020 | 2006-04-28 15:13:41 +0200 | [diff] [blame] | 726 | snd_info_set_text_ops(entry, codec, print_codec_info); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 727 | return 0; |
| 728 | } |
| 729 | |