29 static char *bits_names(
unsigned int bits,
char *names[],
int size)
34 for (i = 0, n = 0; i <
size; i++) {
35 if (bits & (1
U<<i) && names[i])
36 n +=
snprintf(buf + n,
sizeof(buf) - n,
" %s",
44 static const char *get_wid_type_name(
unsigned int wid_value)
46 static char *names[16] = {
58 return "UNKNOWN Widget";
61 return names[wid_value];
63 return "UNKNOWN Widget";
73 for (i = 0; i < array->
used; i++) {
75 if (
item->nid == nid) {
78 " Control: name=\"%s\", index=%i, device=%i\n",
79 kctl->
id.name, kctl->
id.index +
item->index,
83 " ControlAmp: chs=%lu, dir=%s, "
98 for (pcm = 0; pcm < codec->
num_pcms; pcm++) {
100 for (type = 0; type < 2; type++) {
103 snd_iprintf(buffer,
" Device: name=\"%s\", "
104 "type=\"%s\", device=%i\n",
119 if (caps == -1 || caps == 0) {
120 snd_iprintf(buffer,
"N/A\n");
123 snd_iprintf(buffer,
"ofs=0x%02x, nsteps=0x%02x, stepsize=0x%02x, "
133 int dir,
int stereo,
int indices)
139 for (i = 0; i < indices; i++) {
140 snd_iprintf(buffer,
" [");
145 snd_iprintf(buffer,
"0x%02x ", val);
150 snd_iprintf(buffer,
"0x%02x]", val);
152 snd_iprintf(buffer,
"\n");
155 static void print_pcm_rates(
struct snd_info_buffer *buffer,
unsigned int pcm)
157 static unsigned int rates[] = {
158 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
159 96000, 176400, 192000, 384000
164 snd_iprintf(buffer,
" rates [0x%x]:", pcm);
167 snd_iprintf(buffer,
" %d", rates[i]);
168 snd_iprintf(buffer,
"\n");
171 static void print_pcm_bits(
struct snd_info_buffer *buffer,
unsigned int pcm)
175 snd_iprintf(buffer,
" bits [0x%x]:", (pcm >> 16) & 0xff);
177 snd_iprintf(buffer,
"%s\n", buf);
183 snd_iprintf(buffer,
" formats [0x%x]:", streams & 0xf);
185 snd_iprintf(buffer,
" PCM");
187 snd_iprintf(buffer,
" FLOAT");
189 snd_iprintf(buffer,
" AC3");
190 snd_iprintf(buffer,
"\n");
198 if (pcm == -1 || stream == -1) {
199 snd_iprintf(buffer,
"N/A\n");
202 print_pcm_rates(buffer, pcm);
203 print_pcm_bits(buffer, pcm);
204 print_pcm_formats(buffer, stream);
207 static const char *get_jack_connection(
u32 cfg)
209 static char *names[16] = {
210 "Unknown",
"1/8",
"1/4",
"ATAPI",
211 "RCA",
"Optical",
"Digital",
"Analog",
212 "DIN",
"XLR",
"RJ11",
"Comb",
222 static const char *get_jack_color(
u32 cfg)
224 static char *names[16] = {
225 "Unknown",
"Black",
"Grey",
"Blue",
226 "Green",
"Red",
"Orange",
"Yellow",
241 static char *jack_conns[4] = {
"Jack",
"N/A",
"Fixed",
"Both" };
245 snd_iprintf(buffer,
" Pincap 0x%08x:", caps);
247 snd_iprintf(buffer,
" IN");
249 snd_iprintf(buffer,
" OUT");
251 snd_iprintf(buffer,
" HP");
253 snd_iprintf(buffer,
" EAPD");
255 snd_iprintf(buffer,
" Detect");
257 snd_iprintf(buffer,
" Balanced");
261 snd_iprintf(buffer,
" R/L");
264 snd_iprintf(buffer,
" HBR");
265 snd_iprintf(buffer,
" HDMI");
269 snd_iprintf(buffer,
" DP");
271 snd_iprintf(buffer,
" Trigger");
273 snd_iprintf(buffer,
" ImpSense");
274 snd_iprintf(buffer,
"\n");
278 snd_iprintf(buffer,
" Vref caps:");
280 snd_iprintf(buffer,
" HIZ");
282 snd_iprintf(buffer,
" 50");
284 snd_iprintf(buffer,
" GRD");
286 snd_iprintf(buffer,
" 80");
288 snd_iprintf(buffer,
" 100");
289 snd_iprintf(buffer,
"\n");
293 if (caps & AC_PINCAP_EAPD) {
296 snd_iprintf(buffer,
" EAPD 0x%x:", val);
298 snd_iprintf(buffer,
" BALANCED");
300 snd_iprintf(buffer,
" EAPD");
302 snd_iprintf(buffer,
" R/L");
303 snd_iprintf(buffer,
"\n");
306 snd_iprintf(buffer,
" Pin Default 0x%08x: [%s] %s at %s %s\n", caps,
311 snd_iprintf(buffer,
" Conn = %s, Color = %s\n",
312 get_jack_connection(caps),
313 get_jack_color(caps));
318 snd_iprintf(buffer,
" DefAssociation = 0x%x, Sequence = 0x%x\n",
327 snd_iprintf(buffer,
" Misc = NO_PRESENCE\n");
335 unsigned int pinctls;
339 snd_iprintf(buffer,
" Pin-ctls: 0x%02x:", pinctls);
341 snd_iprintf(buffer,
" IN");
343 snd_iprintf(buffer,
" OUT");
345 snd_iprintf(buffer,
" HP");
350 snd_iprintf(buffer,
" VREF_HIZ");
353 snd_iprintf(buffer,
" VREF_50");
356 snd_iprintf(buffer,
" VREF_GRD");
359 snd_iprintf(buffer,
" VREF_80");
362 snd_iprintf(buffer,
" VREF_100");
366 snd_iprintf(buffer,
"\n");
374 snd_iprintf(buffer,
" Volume-Knob: delta=%d, steps=%d, ",
375 (cap >> 7) & 1, cap & 0x7f);
378 snd_iprintf(buffer,
"direct=%d, val=%d\n",
379 (cap >> 7) & 1, cap & 0x7f);
384 unsigned int wid_type)
388 " Converter: stream=%d, channel=%d\n",
395 snd_iprintf(buffer,
" SDI-Select: %d\n",
405 unsigned char digi2 = digi1 >> 8;
406 unsigned char digi3 = digi1 >> 16;
408 snd_iprintf(buffer,
" Digital:");
410 snd_iprintf(buffer,
" Enabled");
412 snd_iprintf(buffer,
" Validity");
414 snd_iprintf(buffer,
" ValidityCfg");
416 snd_iprintf(buffer,
" Preemphasis");
418 snd_iprintf(buffer,
" Non-Copyright");
420 snd_iprintf(buffer,
" Non-Audio");
422 snd_iprintf(buffer,
" Pro");
424 snd_iprintf(buffer,
" GenLevel");
426 snd_iprintf(buffer,
" KAE");
427 snd_iprintf(buffer,
"\n");
428 snd_iprintf(buffer,
" Digital category: 0x%x\n",
430 snd_iprintf(buffer,
" IEC Coding Type: 0x%x\n",
434 static const char *get_pwr_state(
u32 state)
436 static const char *
const buf[] = {
437 "D0",
"D1",
"D2",
"D3",
"D3cold"
447 static char *names[] = {
462 snd_iprintf(buffer,
" Power states: %s\n",
465 snd_iprintf(buffer,
" Power: setting=%s, actual=%s",
470 snd_iprintf(buffer,
", Error");
472 snd_iprintf(buffer,
", Clock-stop-OK");
474 snd_iprintf(buffer,
", Setting-reset");
475 snd_iprintf(buffer,
"\n");
484 " Unsolicited: tag=%02x, enabled=%d\n",
494 snd_iprintf(buffer,
" Processing caps: benign=%d, ncoeff=%d\n",
512 snd_iprintf(buffer,
" Connection: %d\n", conn_len);
514 snd_iprintf(buffer,
" ");
515 for (c = 0; c < conn_len; c++) {
516 snd_iprintf(buffer,
" 0x%02x", conn[c]);
518 snd_iprintf(buffer,
"*");
520 snd_iprintf(buffer,
"\n");
531 snd_iprintf(buffer,
"GPIO: io=%d, o=%d, i=%d, "
532 "unsolicited=%d, wake=%d\n",
553 for (i = 0; i <
max; ++
i)
555 " IO[%d]: enable=%d, dir=%d, wake=%d, "
556 "sticky=%d, data=%d, unsol=%d\n", i,
557 (enable & (1<<i)) ? 1 : 0,
558 (direction & (1<<i)) ? 1 : 0,
559 (wake & (1<<i)) ? 1 : 0,
560 (sticky & (1<<i)) ? 1 : 0,
561 (data & (1<<i)) ? 1 : 0,
562 (unsol & (1<<i)) ? 1 : 0);
564 print_nid_array(buffer, codec, nid, &codec->
mixers);
565 print_nid_array(buffer, codec, nid, &codec->
nids);
575 snd_iprintf(buffer,
"Codec: ");
577 snd_iprintf(buffer,
"%s %s\n",
580 snd_iprintf(buffer,
"Not Set\n");
581 snd_iprintf(buffer,
"Address: %d\n", codec->
addr);
583 snd_iprintf(buffer,
"AFG Function Id: 0x%x (unsol %u)\n",
586 snd_iprintf(buffer,
"MFG Function Id: 0x%x (unsol %u)\n",
588 snd_iprintf(buffer,
"Vendor Id: 0x%08x\n", codec->
vendor_id);
589 snd_iprintf(buffer,
"Subsystem Id: 0x%08x\n", codec->
subsystem_id);
590 snd_iprintf(buffer,
"Revision Id: 0x%x\n", codec->
revision_id);
593 snd_iprintf(buffer,
"Modem Function Group: 0x%x\n", codec->
mfg);
595 snd_iprintf(buffer,
"No Modem Function Group found\n");
599 snd_hda_power_up(codec);
600 snd_iprintf(buffer,
"Default PCM:\n");
601 print_pcm_caps(buffer, codec, codec->
afg);
602 snd_iprintf(buffer,
"Default Amp-In caps: ");
604 snd_iprintf(buffer,
"Default Amp-Out caps: ");
608 if (! nid || nodes < 0) {
609 snd_iprintf(buffer,
"Invalid AFG subtree\n");
610 snd_hda_power_down(codec);
614 print_gpio(buffer, codec, codec->
afg);
618 for (i = 0; i < nodes; i++, nid++) {
619 unsigned int wid_caps =
622 unsigned int wid_type = get_wcaps_type(wid_caps);
626 snd_iprintf(buffer,
"Node 0x%02x [%s] wcaps 0x%x:", nid,
627 get_wid_type_name(wid_type), wid_caps);
629 unsigned int chans = get_wcaps_channels(wid_caps);
631 snd_iprintf(buffer,
" Stereo");
633 snd_iprintf(buffer,
" %d-Channels", chans);
635 snd_iprintf(buffer,
" Mono");
637 snd_iprintf(buffer,
" Digital");
639 snd_iprintf(buffer,
" Amp-In");
641 snd_iprintf(buffer,
" Amp-Out");
643 snd_iprintf(buffer,
" Stripe");
645 snd_iprintf(buffer,
" R/L");
647 snd_iprintf(buffer,
" CP");
648 snd_iprintf(buffer,
"\n");
650 print_nid_array(buffer, codec, nid, &codec->
mixers);
651 print_nid_array(buffer, codec, nid, &codec->
nids);
652 print_nid_pcms(buffer, codec, nid);
664 if (wid_caps & AC_WCAP_IN_AMP) {
665 snd_iprintf(buffer,
" Amp-In caps: ");
666 print_amp_caps(buffer, codec, nid,
HDA_INPUT);
667 snd_iprintf(buffer,
" Amp-In vals: ");
671 print_amp_vals(buffer, codec, nid,
HDA_INPUT,
672 wid_caps & AC_WCAP_STEREO,
675 print_amp_vals(buffer, codec, nid,
HDA_INPUT,
676 wid_caps & AC_WCAP_STEREO,
679 if (wid_caps & AC_WCAP_OUT_AMP) {
680 snd_iprintf(buffer,
" Amp-Out caps: ");
681 print_amp_caps(buffer, codec, nid,
HDA_OUTPUT);
682 snd_iprintf(buffer,
" Amp-Out vals: ");
685 print_amp_vals(buffer, codec, nid,
HDA_OUTPUT,
686 wid_caps & AC_WCAP_STEREO,
689 print_amp_vals(buffer, codec, nid,
HDA_OUTPUT,
690 wid_caps & AC_WCAP_STEREO, 1);
696 print_pin_caps(buffer, codec, nid, &supports_vref);
697 print_pin_ctls(buffer, codec, nid, supports_vref);
701 print_vol_knob(buffer, codec, nid);
705 print_audio_io(buffer, codec, nid, wid_type);
706 if (wid_caps & AC_WCAP_DIGITAL)
707 print_digital_conv(buffer, codec, nid);
709 snd_iprintf(buffer,
" PCM:\n");
710 print_pcm_caps(buffer, codec, nid);
716 print_unsol_cap(buffer, codec, nid);
719 print_power_state(buffer, codec, nid);
722 snd_iprintf(buffer,
" Delay: %d samples\n",
723 (wid_caps & AC_WCAP_DELAY) >>
726 if (wid_caps & AC_WCAP_CONN_LIST)
727 print_conn_list(buffer, codec, nid, wid_type,
731 print_proc_caps(buffer, codec, nid);
736 snd_hda_power_down(codec);
749 err = snd_card_proc_new(codec->
bus->card, name, &entry);
753 snd_info_set_text_ops(entry, codec, print_codec_info);