Commit a370fc62 authored by Wu Fengguang's avatar Wu Fengguang Committed by Takashi Iwai

ALSA: hda - fail ELD reading early

With the ELD repoll mechanism, we can (and should) fail the ELD reading
immediately when find something obviously wrong and let the caller retry
after some delay.
Signed-off-by: default avatarWu Fengguang <fengguang.wu@intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a2987855
...@@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, ...@@ -347,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld,
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
unsigned int val = hdmi_get_eld_data(codec, nid, i); unsigned int val = hdmi_get_eld_data(codec, nid, i);
/*
* Graphics driver might be writing to ELD buffer right now.
* Just abort. The caller will repoll after a while.
*/
if (!(val & AC_ELDD_ELD_VALID)) { if (!(val & AC_ELDD_ELD_VALID)) {
if (!i) {
snd_printd(KERN_INFO
"HDMI: invalid ELD data\n");
ret = -EINVAL;
goto error;
}
snd_printd(KERN_INFO snd_printd(KERN_INFO
"HDMI: invalid ELD data byte %d\n", i); "HDMI: invalid ELD data byte %d\n", i);
val = 0; ret = -EINVAL;
} else goto error;
val &= AC_ELDD_ELD_DATA; }
val &= AC_ELDD_ELD_DATA;
/*
* The first byte cannot be zero. This can happen on some DVI
* connections. Some Intel chips may also need some 250ms delay
* to return non-zero ELD data, even when the graphics driver
* correctly writes ELD content before setting ELD_valid bit.
*/
if (!val && !i) {
snd_printdd(KERN_INFO "HDMI: 0 ELD data\n");
ret = -EINVAL;
goto error;
}
buf[i] = val; buf[i] = val;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment