summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_eld.c
diff options
context:
space:
mode:
authorAnssi Hannula <anssi.hannula@iki.fi>2013-11-10 22:57:42 +0200
committerTakashi Iwai <tiwai@suse.de>2013-11-11 17:08:39 +0100
commit679605c768e86ceba7b87b8390e1446be3753bfb (patch)
tree9fb5639e8bb7ed5ffe2835be6325fa162ba77507 /sound/pci/hda/hda_eld.c
parenta5666824ce79f4e63e017c25f6e1d9b6e6f267b2 (diff)
downloadlinux-679605c768e86ceba7b87b8390e1446be3753bfb.tar.bz2
ALSA: hda - hdmi: Fix wrong baseline length in ATI/AMD generated ELD
According to the HDA specification the baseline ELD length is counted in DW of 4 bytes instead of in bytes. Fix the code accordingly. Baseline length is not used by the kernel so only the ELD exported to userspace was affected. No issues have been reported. v2: Fixed so that eld_size is adjusted upwards accordingly as well. Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r--sound/pci/hda/hda_eld.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index 9b697a28cf53..79ca80f6c77a 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -792,12 +792,15 @@ int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
/* else unknown/invalid or 0ms or video ahead of audio, so use zero */
}
- /* Baseline length */
- buf[2] = pos - 4;
-
/* SAD count */
buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4;
+ /* Baseline ELD block length is 4-byte aligned */
+ pos = round_up(pos, 4);
+
+ /* Baseline ELD length (4-byte header is not counted in) */
+ buf[2] = (pos - 4) / 4;
+
*eld_size = pos;
return 0;