aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_proc.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2008-12-25 05:40:28 -0500
committerTakashi Iwai <tiwai@suse.de>2008-12-25 05:40:28 -0500
commita65056205cdf7efb96fb2558e4f1ec6bae2582ed (patch)
tree22a5fa35464f26183e34aa4210fa6c145f24ddf3 /sound/pci/hda/hda_proc.c
parent313769d9edb1bbd59d2e94f5069950eecfe6fa44 (diff)
parent7645c4bfbb36f357f03815f5729c46ce8d89f008 (diff)
Merge branch 'topic/hda' into to-push
Diffstat (limited to 'sound/pci/hda/hda_proc.c')
-rw-r--r--sound/pci/hda/hda_proc.c91
1 files changed, 19 insertions, 72 deletions
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index c39af986bff1..7ca66d654148 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -91,31 +91,21 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
91 91
92static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) 92static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm)
93{ 93{
94 static unsigned int rates[] = { 94 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
95 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
96 96000, 176400, 192000, 384000
97 };
98 int i;
99 95
100 pcm &= AC_SUPPCM_RATES; 96 pcm &= AC_SUPPCM_RATES;
101 snd_iprintf(buffer, " rates [0x%x]:", pcm); 97 snd_iprintf(buffer, " rates [0x%x]:", pcm);
102 for (i = 0; i < ARRAY_SIZE(rates); i++) 98 snd_print_pcm_rates(pcm, buf, sizeof(buf));
103 if (pcm & (1 << i)) 99 snd_iprintf(buffer, "%s\n", buf);
104 snd_iprintf(buffer, " %d", rates[i]);
105 snd_iprintf(buffer, "\n");
106} 100}
107 101
108static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) 102static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm)
109{ 103{
110 static unsigned int bits[] = { 8, 16, 20, 24, 32 }; 104 char buf[SND_PRINT_BITS_ADVISED_BUFSIZE];
111 int i;
112 105
113 pcm = (pcm >> 16) & 0xff; 106 snd_iprintf(buffer, " bits [0x%x]:", (pcm >> 16) & 0xff);
114 snd_iprintf(buffer, " bits [0x%x]:", pcm); 107 snd_print_pcm_bits(pcm, buf, sizeof(buf));
115 for (i = 0; i < ARRAY_SIZE(bits); i++) 108 snd_iprintf(buffer, "%s\n", buf);
116 if (pcm & (1 << i))
117 snd_iprintf(buffer, " %d", bits[i]);
118 snd_iprintf(buffer, "\n");
119} 109}
120 110
121static void print_pcm_formats(struct snd_info_buffer *buffer, 111static void print_pcm_formats(struct snd_info_buffer *buffer,
@@ -145,32 +135,6 @@ static void print_pcm_caps(struct snd_info_buffer *buffer,
145 print_pcm_formats(buffer, stream); 135 print_pcm_formats(buffer, stream);
146} 136}
147 137
148static const char *get_jack_location(u32 cfg)
149{
150 static char *bases[7] = {
151 "N/A", "Rear", "Front", "Left", "Right", "Top", "Bottom",
152 };
153 static unsigned char specials_idx[] = {
154 0x07, 0x08,
155 0x17, 0x18, 0x19,
156 0x37, 0x38
157 };
158 static char *specials[] = {
159 "Rear Panel", "Drive Bar",
160 "Riser", "HDMI", "ATAPI",
161 "Mobile-In", "Mobile-Out"
162 };
163 int i;
164 cfg = (cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT;
165 if ((cfg & 0x0f) < 7)
166 return bases[cfg & 0x0f];
167 for (i = 0; i < ARRAY_SIZE(specials_idx); i++) {
168 if (cfg == specials_idx[i])
169 return specials[i];
170 }
171 return "UNKNOWN";
172}
173
174static const char *get_jack_connection(u32 cfg) 138static const char *get_jack_connection(u32 cfg)
175{ 139{
176 static char *names[16] = { 140 static char *names[16] = {
@@ -206,13 +170,6 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
206 int *supports_vref) 170 int *supports_vref)
207{ 171{
208 static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" }; 172 static char *jack_conns[4] = { "Jack", "N/A", "Fixed", "Both" };
209 static char *jack_types[16] = {
210 "Line Out", "Speaker", "HP Out", "CD",
211 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand",
212 "Line In", "Aux", "Mic", "Telephony",
213 "SPDIF In", "Digitial In", "Reserved", "Other"
214 };
215 static char *jack_locations[4] = { "Ext", "Int", "Sep", "Oth" };
216 unsigned int caps, val; 173 unsigned int caps, val;
217 174
218 caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 175 caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
@@ -274,9 +231,9 @@ static void print_pin_caps(struct snd_info_buffer *buffer,
274 caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 231 caps = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);
275 snd_iprintf(buffer, " Pin Default 0x%08x: [%s] %s at %s %s\n", caps, 232 snd_iprintf(buffer, " Pin Default 0x%08x: [%s] %s at %s %s\n", caps,
276 jack_conns[(caps & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT], 233 jack_conns[(caps & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT],
277 jack_types[(caps & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT], 234 snd_hda_get_jack_type(caps),
278 jack_locations[(caps >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3], 235 snd_hda_get_jack_connectivity(caps),
279 get_jack_location(caps)); 236 snd_hda_get_jack_location(caps));
280 snd_iprintf(buffer, " Conn = %s, Color = %s\n", 237 snd_iprintf(buffer, " Conn = %s, Color = %s\n",
281 get_jack_connection(caps), 238 get_jack_connection(caps),
282 get_jack_color(caps)); 239 get_jack_color(caps));
@@ -457,17 +414,6 @@ static void print_conn_list(struct snd_info_buffer *buffer,
457 } 414 }
458} 415}
459 416
460static void print_realtek_coef(struct snd_info_buffer *buffer,
461 struct hda_codec *codec, hda_nid_t nid)
462{
463 int coeff = snd_hda_codec_read(codec, nid, 0,
464 AC_VERB_GET_PROC_COEF, 0);
465 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);
466 coeff = snd_hda_codec_read(codec, nid, 0,
467 AC_VERB_GET_COEF_INDEX, 0);
468 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);
469}
470
471static void print_gpio(struct snd_info_buffer *buffer, 417static void print_gpio(struct snd_info_buffer *buffer,
472 struct hda_codec *codec, hda_nid_t nid) 418 struct hda_codec *codec, hda_nid_t nid)
473{ 419{
@@ -500,12 +446,13 @@ static void print_gpio(struct snd_info_buffer *buffer,
500 for (i = 0; i < max; ++i) 446 for (i = 0; i < max; ++i)
501 snd_iprintf(buffer, 447 snd_iprintf(buffer,
502 " IO[%d]: enable=%d, dir=%d, wake=%d, " 448 " IO[%d]: enable=%d, dir=%d, wake=%d, "
503 "sticky=%d, data=%d\n", i, 449 "sticky=%d, data=%d, unsol=%d\n", i,
504 (enable & (1<<i)) ? 1 : 0, 450 (enable & (1<<i)) ? 1 : 0,
505 (direction & (1<<i)) ? 1 : 0, 451 (direction & (1<<i)) ? 1 : 0,
506 (wake & (1<<i)) ? 1 : 0, 452 (wake & (1<<i)) ? 1 : 0,
507 (sticky & (1<<i)) ? 1 : 0, 453 (sticky & (1<<i)) ? 1 : 0,
508 (data & (1<<i)) ? 1 : 0); 454 (data & (1<<i)) ? 1 : 0,
455 (unsol & (1<<i)) ? 1 : 0);
509 /* FIXME: add GPO and GPI pin information */ 456 /* FIXME: add GPO and GPI pin information */
510} 457}
511 458
@@ -513,12 +460,11 @@ static void print_codec_info(struct snd_info_entry *entry,
513 struct snd_info_buffer *buffer) 460 struct snd_info_buffer *buffer)
514{ 461{
515 struct hda_codec *codec = entry->private_data; 462 struct hda_codec *codec = entry->private_data;
516 char buf[32];
517 hda_nid_t nid; 463 hda_nid_t nid;
518 int i, nodes; 464 int i, nodes;
519 465
520 snd_hda_get_codec_name(codec, buf, sizeof(buf)); 466 snd_iprintf(buffer, "Codec: %s\n",
521 snd_iprintf(buffer, "Codec: %s\n", buf); 467 codec->name ? codec->name : "Not Set");
522 snd_iprintf(buffer, "Address: %d\n", codec->addr); 468 snd_iprintf(buffer, "Address: %d\n", codec->addr);
523 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); 469 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
524 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); 470 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
@@ -547,6 +493,8 @@ static void print_codec_info(struct snd_info_entry *entry,
547 } 493 }
548 494
549 print_gpio(buffer, codec, codec->afg); 495 print_gpio(buffer, codec, codec->afg);
496 if (codec->proc_widget_hook)
497 codec->proc_widget_hook(buffer, codec, codec->afg);
550 498
551 for (i = 0; i < nodes; i++, nid++) { 499 for (i = 0; i < nodes; i++, nid++) {
552 unsigned int wid_caps = 500 unsigned int wid_caps =
@@ -649,9 +597,8 @@ static void print_codec_info(struct snd_info_entry *entry,
649 if (wid_caps & AC_WCAP_PROC_WID) 597 if (wid_caps & AC_WCAP_PROC_WID)
650 print_proc_caps(buffer, codec, nid); 598 print_proc_caps(buffer, codec, nid);
651 599
652 /* NID 0x20 == Realtek Define Registers */ 600 if (codec->proc_widget_hook)
653 if (codec->vendor_id == 0x10ec && nid == 0x20) 601 codec->proc_widget_hook(buffer, codec, nid);
654 print_realtek_coef(buffer, codec, nid);
655 } 602 }
656 snd_hda_power_down(codec); 603 snd_hda_power_down(codec);
657} 604}