diff options
Diffstat (limited to 'sound/pci/hda/hda_proc.c')
-rw-r--r-- | sound/pci/hda/hda_proc.c | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 95f24e4729f8..f97d35de66c4 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -26,6 +26,21 @@ | |||
26 | #include "hda_codec.h" | 26 | #include "hda_codec.h" |
27 | #include "hda_local.h" | 27 | #include "hda_local.h" |
28 | 28 | ||
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 | |||
29 | static const char *get_wid_type_name(unsigned int wid_value) | 44 | static const char *get_wid_type_name(unsigned int wid_value) |
30 | { | 45 | { |
31 | static char *names[16] = { | 46 | static char *names[16] = { |
@@ -46,6 +61,52 @@ static const char *get_wid_type_name(unsigned int wid_value) | |||
46 | return "UNKNOWN Widget"; | 61 | return "UNKNOWN Widget"; |
47 | } | 62 | } |
48 | 63 | ||
64 | static void print_nid_array(struct snd_info_buffer *buffer, | ||
65 | struct hda_codec *codec, hda_nid_t nid, | ||
66 | struct snd_array *array) | ||
67 | { | ||
68 | int i; | ||
69 | struct hda_nid_item *items = array->list, *item; | ||
70 | struct snd_kcontrol *kctl; | ||
71 | for (i = 0; i < array->used; i++) { | ||
72 | item = &items[i]; | ||
73 | if (item->nid == nid) { | ||
74 | kctl = item->kctl; | ||
75 | snd_iprintf(buffer, | ||
76 | " Control: name=\"%s\", index=%i, device=%i\n", | ||
77 | kctl->id.name, kctl->id.index + item->index, | ||
78 | kctl->id.device); | ||
79 | if (item->flags & HDA_NID_ITEM_AMP) | ||
80 | snd_iprintf(buffer, | ||
81 | " ControlAmp: chs=%lu, dir=%s, " | ||
82 | "idx=%lu, ofs=%lu\n", | ||
83 | get_amp_channels(kctl), | ||
84 | get_amp_direction(kctl) ? "Out" : "In", | ||
85 | get_amp_index(kctl), | ||
86 | get_amp_offset(kctl)); | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | |||
91 | static void print_nid_pcms(struct snd_info_buffer *buffer, | ||
92 | struct hda_codec *codec, hda_nid_t nid) | ||
93 | { | ||
94 | int pcm, type; | ||
95 | struct hda_pcm *cpcm; | ||
96 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { | ||
97 | cpcm = &codec->pcm_info[pcm]; | ||
98 | for (type = 0; type < 2; type++) { | ||
99 | if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL) | ||
100 | continue; | ||
101 | snd_iprintf(buffer, " Device: name=\"%s\", " | ||
102 | "type=\"%s\", device=%i\n", | ||
103 | cpcm->name, | ||
104 | snd_hda_pcm_type_name[cpcm->pcm_type], | ||
105 | cpcm->pcm->device); | ||
106 | } | ||
107 | } | ||
108 | } | ||
109 | |||
49 | static void print_amp_caps(struct snd_info_buffer *buffer, | 110 | static void print_amp_caps(struct snd_info_buffer *buffer, |
50 | struct hda_codec *codec, hda_nid_t nid, int dir) | 111 | struct hda_codec *codec, hda_nid_t nid, int dir) |
51 | { | 112 | { |
@@ -190,9 +251,14 @@ static void print_pin_caps(struct snd_info_buffer *buffer, | |||
190 | /* Realtek uses this bit as a different meaning */ | 251 | /* Realtek uses this bit as a different meaning */ |
191 | if ((codec->vendor_id >> 16) == 0x10ec) | 252 | if ((codec->vendor_id >> 16) == 0x10ec) |
192 | snd_iprintf(buffer, " R/L"); | 253 | snd_iprintf(buffer, " R/L"); |
193 | else | 254 | else { |
255 | if (caps & AC_PINCAP_HBR) | ||
256 | snd_iprintf(buffer, " HBR"); | ||
194 | snd_iprintf(buffer, " HDMI"); | 257 | snd_iprintf(buffer, " HDMI"); |
258 | } | ||
195 | } | 259 | } |
260 | if (caps & AC_PINCAP_DP) | ||
261 | snd_iprintf(buffer, " DP"); | ||
196 | if (caps & AC_PINCAP_TRIG_REQ) | 262 | if (caps & AC_PINCAP_TRIG_REQ) |
197 | snd_iprintf(buffer, " Trigger"); | 263 | snd_iprintf(buffer, " Trigger"); |
198 | if (caps & AC_PINCAP_IMP_SENSE) | 264 | if (caps & AC_PINCAP_IMP_SENSE) |
@@ -363,8 +429,24 @@ static const char *get_pwr_state(u32 state) | |||
363 | static void print_power_state(struct snd_info_buffer *buffer, | 429 | static void print_power_state(struct snd_info_buffer *buffer, |
364 | struct hda_codec *codec, hda_nid_t nid) | 430 | struct hda_codec *codec, hda_nid_t nid) |
365 | { | 431 | { |
432 | static char *names[] = { | ||
433 | [ilog2(AC_PWRST_D0SUP)] = "D0", | ||
434 | [ilog2(AC_PWRST_D1SUP)] = "D1", | ||
435 | [ilog2(AC_PWRST_D2SUP)] = "D2", | ||
436 | [ilog2(AC_PWRST_D3SUP)] = "D3", | ||
437 | [ilog2(AC_PWRST_D3COLDSUP)] = "D3cold", | ||
438 | [ilog2(AC_PWRST_S3D3COLDSUP)] = "S3D3cold", | ||
439 | [ilog2(AC_PWRST_CLKSTOP)] = "CLKSTOP", | ||
440 | [ilog2(AC_PWRST_EPSS)] = "EPSS", | ||
441 | }; | ||
442 | |||
443 | int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE); | ||
366 | int pwr = snd_hda_codec_read(codec, nid, 0, | 444 | int pwr = snd_hda_codec_read(codec, nid, 0, |
367 | AC_VERB_GET_POWER_STATE, 0); | 445 | AC_VERB_GET_POWER_STATE, 0); |
446 | if (sup) | ||
447 | snd_iprintf(buffer, " Power states: %s\n", | ||
448 | bits_names(sup, names, ARRAY_SIZE(names))); | ||
449 | |||
368 | snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", | 450 | snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", |
369 | get_pwr_state(pwr & AC_PWRST_SETTING), | 451 | get_pwr_state(pwr & AC_PWRST_SETTING), |
370 | get_pwr_state((pwr & AC_PWRST_ACTUAL) >> | 452 | get_pwr_state((pwr & AC_PWRST_ACTUAL) >> |
@@ -457,6 +539,8 @@ static void print_gpio(struct snd_info_buffer *buffer, | |||
457 | (data & (1<<i)) ? 1 : 0, | 539 | (data & (1<<i)) ? 1 : 0, |
458 | (unsol & (1<<i)) ? 1 : 0); | 540 | (unsol & (1<<i)) ? 1 : 0); |
459 | /* FIXME: add GPO and GPI pin information */ | 541 | /* FIXME: add GPO and GPI pin information */ |
542 | print_nid_array(buffer, codec, nid, &codec->mixers); | ||
543 | print_nid_array(buffer, codec, nid, &codec->nids); | ||
460 | } | 544 | } |
461 | 545 | ||
462 | static void print_codec_info(struct snd_info_entry *entry, | 546 | static void print_codec_info(struct snd_info_entry *entry, |
@@ -536,6 +620,10 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
536 | snd_iprintf(buffer, " CP"); | 620 | snd_iprintf(buffer, " CP"); |
537 | snd_iprintf(buffer, "\n"); | 621 | snd_iprintf(buffer, "\n"); |
538 | 622 | ||
623 | print_nid_array(buffer, codec, nid, &codec->mixers); | ||
624 | print_nid_array(buffer, codec, nid, &codec->nids); | ||
625 | print_nid_pcms(buffer, codec, nid); | ||
626 | |||
539 | /* volume knob is a special widget that always have connection | 627 | /* volume knob is a special widget that always have connection |
540 | * list | 628 | * list |
541 | */ | 629 | */ |