aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>2011-10-05 16:14:20 -0400
committerTakashi Iwai <tiwai@suse.de>2011-10-06 02:08:53 -0400
commitaf65cbf296a07c4a52079324fbefdfc9bd2622a3 (patch)
tree4365d2ba17abe30d35d2387c3c0e05dfa3ce62a7 /sound/pci
parent7c2f8e4009d4b66c8458e3a5c20510b4262853bb (diff)
ALSA: hdmi: fix printout of SAD sampling rates
SAD sampling rate information reported in /proc/asound/cardX/eldX is incorrect due to a mismatch between HDA and HDMI frequencies. Add new routine to provide relevant values. Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c2
-rw-r--r--sound/pci/hda/hda_eld.c24
2 files changed, 23 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 8b046a10b42b..d2f41b1446e1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -5205,7 +5205,7 @@ EXPORT_SYMBOL_HDA(snd_array_free);
5205 * @buf: the string buffer to write 5205 * @buf: the string buffer to write
5206 * @buflen: the max buffer length 5206 * @buflen: the max buffer length
5207 * 5207 *
5208 * used by hda_proc.c and hda_eld.c 5208 * used by hda_proc.c
5209 */ 5209 */
5210void snd_print_pcm_rates(int pcm, char *buf, int buflen) 5210void snd_print_pcm_rates(int pcm, char *buf, int buflen)
5211{ 5211{
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index f1c621d2f8e8..bc1ac2940c5e 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -363,6 +363,26 @@ error:
363 return ret; 363 return ret;
364} 364}
365 365
366/**
367 * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with
368 * hdmi-specific routine.
369 */
370static void hdmi_print_pcm_rates(int pcm, char *buf, int buflen)
371{
372 static unsigned int alsa_rates[] = {
373 5512, 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
374 96000, 176400, 192000, 384000
375 };
376 int i, j;
377
378 for (i = 0, j = 0; i < ARRAY_SIZE(alsa_rates); i++)
379 if (pcm & (1 << i))
380 j += snprintf(buf + j, buflen - j, " %d",
381 alsa_rates[i]);
382
383 buf[j] = '\0'; /* necessary when j == 0 */
384}
385
366static void hdmi_show_short_audio_desc(struct cea_sad *a) 386static void hdmi_show_short_audio_desc(struct cea_sad *a)
367{ 387{
368 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; 388 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE];
@@ -371,7 +391,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a)
371 if (!a->format) 391 if (!a->format)
372 return; 392 return;
373 393
374 snd_print_pcm_rates(a->rates, buf, sizeof(buf)); 394 hdmi_print_pcm_rates(a->rates, buf, sizeof(buf));
375 395
376 if (a->format == AUDIO_CODING_TYPE_LPCM) 396 if (a->format == AUDIO_CODING_TYPE_LPCM)
377 snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); 397 snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8);
@@ -430,7 +450,7 @@ static void hdmi_print_sad_info(int i, struct cea_sad *a,
430 i, a->format, cea_audio_coding_type_names[a->format]); 450 i, a->format, cea_audio_coding_type_names[a->format]);
431 snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels); 451 snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels);
432 452
433 snd_print_pcm_rates(a->rates, buf, sizeof(buf)); 453 hdmi_print_pcm_rates(a->rates, buf, sizeof(buf));
434 snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); 454 snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf);
435 455
436 if (a->format == AUDIO_CODING_TYPE_LPCM) { 456 if (a->format == AUDIO_CODING_TYPE_LPCM) {