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