diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_local.h | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_proc.c | 20 |
2 files changed, 17 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index aac569b05599..d7e3a164effe 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -284,6 +284,9 @@ int snd_hda_codec_proc_new(struct hda_codec *codec); | |||
284 | static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; } | 284 | static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; } |
285 | #endif | 285 | #endif |
286 | 286 | ||
287 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 | ||
288 | void snd_print_pcm_rates(int pcm, char *buf, int buflen); | ||
289 | |||
287 | /* | 290 | /* |
288 | * Misc | 291 | * Misc |
289 | */ | 292 | */ |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 64b6a38fa963..512eb674b743 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -89,20 +89,28 @@ static void print_amp_vals(struct snd_info_buffer *buffer, | |||
89 | snd_iprintf(buffer, "\n"); | 89 | snd_iprintf(buffer, "\n"); |
90 | } | 90 | } |
91 | 91 | ||
92 | static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) | 92 | void snd_print_pcm_rates(int pcm, char *buf, int buflen) |
93 | { | 93 | { |
94 | static unsigned int rates[] = { | 94 | static unsigned int rates[] = { |
95 | 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, | 95 | 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, |
96 | 96000, 176400, 192000, 384000 | 96 | 96000, 176400, 192000, 384000 |
97 | }; | 97 | }; |
98 | int i; | 98 | int i, j; |
99 | |||
100 | for (i = 0, j = 0; i < ARRAY_SIZE(rates); i++) | ||
101 | if (pcm & (1 << i)) | ||
102 | j += snprintf(buf + j, buflen - j, " %d", rates[i]); | ||
103 | |||
104 | buf[j] = '\0'; /* necessary when j == 0 */ | ||
105 | } | ||
99 | 106 | ||
107 | static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) | ||
108 | { | ||
109 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; | ||
100 | pcm &= AC_SUPPCM_RATES; | 110 | pcm &= AC_SUPPCM_RATES; |
101 | snd_iprintf(buffer, " rates [0x%x]:", pcm); | 111 | snd_iprintf(buffer, " rates [0x%x]:", pcm); |
102 | for (i = 0; i < ARRAY_SIZE(rates); i++) | 112 | snd_print_pcm_rates(pcm, buf, sizeof(buf)); |
103 | if (pcm & (1 << i)) | 113 | snd_iprintf(buffer, "%s\n", buf); |
104 | snd_iprintf(buffer, " %d", rates[i]); | ||
105 | snd_iprintf(buffer, "\n"); | ||
106 | } | 114 | } |
107 | 115 | ||
108 | static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) | 116 | static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) |