diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 17:25:01 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-28 17:25:01 -0400 |
commit | 68d99b2c8efcb6ed3807a55569300c53b5f88be5 (patch) | |
tree | f189c8f2132d3668a2f0e503f5c3f8695b26a1c8 /sound/pci/hda/hda_eld.c | |
parent | 0e59e7e7feb5a12938fbf9135147eeda3238c6c4 (diff) | |
parent | 8128c9f21509f9a8b6da94ac432d845dda458406 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (549 commits)
ALSA: hda - Fix ADC input-amp handling for Cx20549 codec
ALSA: hda - Keep EAPD turned on for old Conexant chips
ALSA: hda/realtek - Fix missing volume controls with ALC260
ASoC: wm8940: Properly set codec->dapm.bias_level
ALSA: hda - Fix pin-config for ASUS W90V
ALSA: hda - Fix surround/CLFE headphone and speaker pins order
ALSA: hda - Fix typo
ALSA: Update the sound git tree URL
ALSA: HDA: Add new revision for ALC662
ASoC: max98095: Convert codec->hw_write to snd_soc_write
ASoC: keep pointer to resource so it can be freed
ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls
ASoC: wm8996: Fix wrong mask for setting WM8996_AIF_CLOCKING_2
ASoC: da7210: Add support for line out and DAC
ASoC: da7210: Add support for DAPM
ALSA: hda/realtek - Fix DAC assignments of multiple speakers
ASoC: Use SGTL5000_LINREG_VDDD_MASK instead of hardcoded mask value
ASoC: Set sgtl5000->ldo in ldo_regulator_register
ASoC: wm8996: Use SND_SOC_DAPM_AIF_OUT for AIF2 Capture
ASoC: wm8994: Use SND_SOC_DAPM_AIF_OUT for AIF3 Capture
...
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index c34f730f4815..1c8ddf547a2d 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -318,6 +318,11 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
318 | int size; | 318 | int size; |
319 | unsigned char *buf; | 319 | unsigned char *buf; |
320 | 320 | ||
321 | /* | ||
322 | * ELD size is initialized to zero in caller function. If no errors and | ||
323 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() | ||
324 | */ | ||
325 | |||
321 | if (!eld->eld_valid) | 326 | if (!eld->eld_valid) |
322 | return -ENOENT; | 327 | return -ENOENT; |
323 | 328 | ||
@@ -327,14 +332,13 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
327 | snd_printd(KERN_INFO "HDMI: ELD buf size is 0, force 128\n"); | 332 | snd_printd(KERN_INFO "HDMI: ELD buf size is 0, force 128\n"); |
328 | size = 128; | 333 | size = 128; |
329 | } | 334 | } |
330 | if (size < ELD_FIXED_BYTES || size > PAGE_SIZE) { | 335 | if (size < ELD_FIXED_BYTES || size > ELD_MAX_SIZE) { |
331 | snd_printd(KERN_INFO "HDMI: invalid ELD buf size %d\n", size); | 336 | snd_printd(KERN_INFO "HDMI: invalid ELD buf size %d\n", size); |
332 | return -ERANGE; | 337 | return -ERANGE; |
333 | } | 338 | } |
334 | 339 | ||
335 | buf = kmalloc(size, GFP_KERNEL); | 340 | /* set ELD buffer */ |
336 | if (!buf) | 341 | buf = eld->eld_buffer; |
337 | return -ENOMEM; | ||
338 | 342 | ||
339 | for (i = 0; i < size; i++) { | 343 | for (i = 0; i < size; i++) { |
340 | unsigned int val = hdmi_get_eld_data(codec, nid, i); | 344 | unsigned int val = hdmi_get_eld_data(codec, nid, i); |
@@ -356,10 +360,31 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
356 | ret = hdmi_update_eld(eld, buf, size); | 360 | ret = hdmi_update_eld(eld, buf, size); |
357 | 361 | ||
358 | error: | 362 | error: |
359 | kfree(buf); | ||
360 | return ret; | 363 | return ret; |
361 | } | 364 | } |
362 | 365 | ||
366 | /** | ||
367 | * SNDRV_PCM_RATE_* and AC_PAR_PCM values don't match, print correct rates with | ||
368 | * hdmi-specific routine. | ||
369 | */ | ||
370 | static 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 | |||
386 | #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 | ||
387 | |||
363 | static void hdmi_show_short_audio_desc(struct cea_sad *a) | 388 | static void hdmi_show_short_audio_desc(struct cea_sad *a) |
364 | { | 389 | { |
365 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; | 390 | char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; |
@@ -368,7 +393,7 @@ static void hdmi_show_short_audio_desc(struct cea_sad *a) | |||
368 | if (!a->format) | 393 | if (!a->format) |
369 | return; | 394 | return; |
370 | 395 | ||
371 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 396 | hdmi_print_pcm_rates(a->rates, buf, sizeof(buf)); |
372 | 397 | ||
373 | if (a->format == AUDIO_CODING_TYPE_LPCM) | 398 | if (a->format == AUDIO_CODING_TYPE_LPCM) |
374 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); | 399 | snd_print_pcm_bits(a->sample_bits, buf2 + 8, sizeof(buf2) - 8); |
@@ -427,7 +452,7 @@ static void hdmi_print_sad_info(int i, struct cea_sad *a, | |||
427 | i, a->format, cea_audio_coding_type_names[a->format]); | 452 | i, a->format, cea_audio_coding_type_names[a->format]); |
428 | snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels); | 453 | snd_iprintf(buffer, "sad%d_channels\t\t%d\n", i, a->channels); |
429 | 454 | ||
430 | snd_print_pcm_rates(a->rates, buf, sizeof(buf)); | 455 | hdmi_print_pcm_rates(a->rates, buf, sizeof(buf)); |
431 | snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); | 456 | snd_iprintf(buffer, "sad%d_rates\t\t[0x%x]%s\n", i, a->rates, buf); |
432 | 457 | ||
433 | if (a->format == AUDIO_CODING_TYPE_LPCM) { | 458 | if (a->format == AUDIO_CODING_TYPE_LPCM) { |