aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_proc.c')
-rw-r--r--sound/pci/hda/hda_proc.c70
1 files changed, 70 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 95f24e4729f8..09476fc1ab64 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
29static 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
29static const char *get_wid_type_name(unsigned int wid_value) 44static 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,41 @@ static const char *get_wid_type_name(unsigned int wid_value)
46 return "UNKNOWN Widget"; 61 return "UNKNOWN Widget";
47} 62}
48 63
64static void print_nid_mixers(struct snd_info_buffer *buffer,
65 struct hda_codec *codec, hda_nid_t nid)
66{
67 int i;
68 struct hda_nid_item *items = codec->mixers.list;
69 struct snd_kcontrol *kctl;
70 for (i = 0; i < codec->mixers.used; i++) {
71 if (items[i].nid == nid) {
72 kctl = items[i].kctl;
73 snd_iprintf(buffer,
74 " Control: name=\"%s\", index=%i, device=%i\n",
75 kctl->id.name, kctl->id.index, kctl->id.device);
76 }
77 }
78}
79
80static void print_nid_pcms(struct snd_info_buffer *buffer,
81 struct hda_codec *codec, hda_nid_t nid)
82{
83 int pcm, type;
84 struct hda_pcm *cpcm;
85 for (pcm = 0; pcm < codec->num_pcms; pcm++) {
86 cpcm = &codec->pcm_info[pcm];
87 for (type = 0; type < 2; type++) {
88 if (cpcm->stream[type].nid != nid || cpcm->pcm == NULL)
89 continue;
90 snd_iprintf(buffer, " Device: name=\"%s\", "
91 "type=\"%s\", device=%i\n",
92 cpcm->name,
93 snd_hda_pcm_type_name[cpcm->pcm_type],
94 cpcm->pcm->device);
95 }
96 }
97}
98
49static void print_amp_caps(struct snd_info_buffer *buffer, 99static void print_amp_caps(struct snd_info_buffer *buffer,
50 struct hda_codec *codec, hda_nid_t nid, int dir) 100 struct hda_codec *codec, hda_nid_t nid, int dir)
51{ 101{
@@ -363,8 +413,24 @@ static const char *get_pwr_state(u32 state)
363static void print_power_state(struct snd_info_buffer *buffer, 413static void print_power_state(struct snd_info_buffer *buffer,
364 struct hda_codec *codec, hda_nid_t nid) 414 struct hda_codec *codec, hda_nid_t nid)
365{ 415{
416 static char *names[] = {
417 [ilog2(AC_PWRST_D0SUP)] = "D0",
418 [ilog2(AC_PWRST_D1SUP)] = "D1",
419 [ilog2(AC_PWRST_D2SUP)] = "D2",
420 [ilog2(AC_PWRST_D3SUP)] = "D3",
421 [ilog2(AC_PWRST_D3COLDSUP)] = "D3cold",
422 [ilog2(AC_PWRST_S3D3COLDSUP)] = "S3D3cold",
423 [ilog2(AC_PWRST_CLKSTOP)] = "CLKSTOP",
424 [ilog2(AC_PWRST_EPSS)] = "EPSS",
425 };
426
427 int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE);
366 int pwr = snd_hda_codec_read(codec, nid, 0, 428 int pwr = snd_hda_codec_read(codec, nid, 0,
367 AC_VERB_GET_POWER_STATE, 0); 429 AC_VERB_GET_POWER_STATE, 0);
430 if (sup)
431 snd_iprintf(buffer, " Power states: %s\n",
432 bits_names(sup, names, ARRAY_SIZE(names)));
433
368 snd_iprintf(buffer, " Power: setting=%s, actual=%s\n", 434 snd_iprintf(buffer, " Power: setting=%s, actual=%s\n",
369 get_pwr_state(pwr & AC_PWRST_SETTING), 435 get_pwr_state(pwr & AC_PWRST_SETTING),
370 get_pwr_state((pwr & AC_PWRST_ACTUAL) >> 436 get_pwr_state((pwr & AC_PWRST_ACTUAL) >>
@@ -457,6 +523,7 @@ static void print_gpio(struct snd_info_buffer *buffer,
457 (data & (1<<i)) ? 1 : 0, 523 (data & (1<<i)) ? 1 : 0,
458 (unsol & (1<<i)) ? 1 : 0); 524 (unsol & (1<<i)) ? 1 : 0);
459 /* FIXME: add GPO and GPI pin information */ 525 /* FIXME: add GPO and GPI pin information */
526 print_nid_mixers(buffer, codec, nid);
460} 527}
461 528
462static void print_codec_info(struct snd_info_entry *entry, 529static void print_codec_info(struct snd_info_entry *entry,
@@ -536,6 +603,9 @@ static void print_codec_info(struct snd_info_entry *entry,
536 snd_iprintf(buffer, " CP"); 603 snd_iprintf(buffer, " CP");
537 snd_iprintf(buffer, "\n"); 604 snd_iprintf(buffer, "\n");
538 605
606 print_nid_mixers(buffer, codec, nid);
607 print_nid_pcms(buffer, codec, nid);
608
539 /* volume knob is a special widget that always have connection 609 /* volume knob is a special widget that always have connection
540 * list 610 * list
541 */ 611 */