aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorWu Fengguang <wfg@linux.intel.com>2008-11-19 02:14:02 -0500
committerTakashi Iwai <tiwai@suse.de>2008-11-19 03:42:30 -0500
commitd39b4352f2356bde9d4dae8591d4c8022360922f (patch)
tree366adb79cec9aad126037d113686948c0b7696ac /sound
parent06f69d17a90ced7d74ff12ce69b7b101aed4ffd9 (diff)
ALSA: hda: make global snd_print_pcm_bits()
Introduce a global function snd_print_pcm_bits() and use it in the ELD code. Signed-off-by: Wu Fengguang <wfg@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_eld.c10
-rw-r--r--sound/pci/hda/hda_local.h3
-rw-r--r--sound/pci/hda/hda_proc.c22
3 files changed, 25 insertions, 10 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 75e9a4014f4e..8e575bb56ff7 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -455,7 +455,7 @@ void snd_hdmi_show_eld(struct hdmi_eld *e)
455static void hdmi_print_sad_info(int i, struct cea_sad *a, 455static void hdmi_print_sad_info(int i, struct cea_sad *a,
456 struct snd_info_buffer *buffer) 456 struct snd_info_buffer *buffer)
457{ 457{
458 char buf[80]; 458 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
459 459
460 snd_iprintf(buffer, "sad%d_coding_type\t[0x%x] %s\n", 460 snd_iprintf(buffer, "sad%d_coding_type\t[0x%x] %s\n",
461 i, a->format, cea_audio_coding_type_names[a->format]); 461 i, a->format, cea_audio_coding_type_names[a->format]);
@@ -464,9 +464,11 @@ static void hdmi_print_sad_info(int i, struct cea_sad *a,
464 snd_print_pcm_rates(a->rates, buf, sizeof(buf)); 464 snd_print_pcm_rates(a->rates, buf, sizeof(buf));
465 snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); 465 snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf);
466 466
467 if (a->format == AUDIO_CODING_TYPE_LPCM) 467 if (a->format == AUDIO_CODING_TYPE_LPCM) {
468 snd_iprintf(buffer, "sad%d_bits\t\t0x%x\n", 468 snd_print_pcm_bits(a->sample_bits, buf, sizeof(buf));
469 i, a->sample_bits); 469 snd_iprintf(buffer, "sad%d_bits\t\t[0x%x]%s\n",
470 i, a->sample_bits, buf);
471 }
470 472
471 if (a->max_bitrate) 473 if (a->max_bitrate)
472 snd_iprintf(buffer, "sad%d_max_bitrate\t%d\n", 474 snd_iprintf(buffer, "sad%d_max_bitrate\t%d\n",
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index a1473c6cb4bf..a2d01a9a0b16 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -287,6 +287,9 @@ static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; }
287#define SND_PRINT_RATES_ADVISED_BUFSIZE 80 287#define SND_PRINT_RATES_ADVISED_BUFSIZE 80
288void snd_print_pcm_rates(int pcm, char *buf, int buflen); 288void snd_print_pcm_rates(int pcm, char *buf, int buflen);
289 289
290#define SND_PRINT_BITS_ADVISED_BUFSIZE 16
291void snd_print_pcm_bits(int pcm, char *buf, int buflen);
292
290/* 293/*
291 * Misc 294 * Misc
292 */ 295 */
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 512eb674b743..d956e9769133 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -107,23 +107,33 @@ void snd_print_pcm_rates(int pcm, char *buf, int buflen)
107static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) 107static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm)
108{ 108{
109 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; 109 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
110
110 pcm &= AC_SUPPCM_RATES; 111 pcm &= AC_SUPPCM_RATES;
111 snd_iprintf(buffer, " rates [0x%x]:", pcm); 112 snd_iprintf(buffer, " rates [0x%x]:", pcm);
112 snd_print_pcm_rates(pcm, buf, sizeof(buf)); 113 snd_print_pcm_rates(pcm, buf, sizeof(buf));
113 snd_iprintf(buffer, "%s\n", buf); 114 snd_iprintf(buffer, "%s\n", buf);
114} 115}
115 116
116static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) 117void snd_print_pcm_bits(int pcm, char *buf, int buflen)
117{ 118{
118 static unsigned int bits[] = { 8, 16, 20, 24, 32 }; 119 static unsigned int bits[] = { 8, 16, 20, 24, 32 };
119 int i; 120 int i, j;
121
122 for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++)
123 if (pcm & (1 << i))
124 j += snprintf(buf + j, buflen - j, " %d", bits[i]);
125
126 buf[j] = '\0'; /* necessary when j == 0 */
127}
128
129static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm)
130{
131 char buf[SND_PRINT_BITS_ADVISED_BUFSIZE];
120 132
121 pcm = (pcm >> 16) & 0xff; 133 pcm = (pcm >> 16) & 0xff;
122 snd_iprintf(buffer, " bits [0x%x]:", pcm); 134 snd_iprintf(buffer, " bits [0x%x]:", pcm);
123 for (i = 0; i < ARRAY_SIZE(bits); i++) 135 snd_print_pcm_bits(pcm, buf, sizeof(buf));
124 if (pcm & (1 << i)) 136 snd_iprintf(buffer, "%s\n", buf);
125 snd_iprintf(buffer, " %d", bits[i]);
126 snd_iprintf(buffer, "\n");
127} 137}
128 138
129static void print_pcm_formats(struct snd_info_buffer *buffer, 139static void print_pcm_formats(struct snd_info_buffer *buffer,