diff options
Diffstat (limited to 'sound/pci/hda/hda_eld.c')
-rw-r--r-- | sound/pci/hda/hda_eld.c | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c index 1c8ddf547a2d..c1da422e085a 100644 --- a/sound/pci/hda/hda_eld.c +++ b/sound/pci/hda/hda_eld.c | |||
@@ -297,10 +297,18 @@ static int hdmi_update_eld(struct hdmi_eld *e, | |||
297 | buf + ELD_FIXED_BYTES + mnl + 3 * i); | 297 | buf + ELD_FIXED_BYTES + mnl + 3 * i); |
298 | } | 298 | } |
299 | 299 | ||
300 | /* | ||
301 | * HDMI sink's ELD info cannot always be retrieved for now, e.g. | ||
302 | * in console or for audio devices. Assume the highest speakers | ||
303 | * configuration, to _not_ prohibit multi-channel audio playback. | ||
304 | */ | ||
305 | if (!e->spk_alloc) | ||
306 | e->spk_alloc = 0xffff; | ||
307 | |||
308 | e->eld_valid = true; | ||
300 | return 0; | 309 | return 0; |
301 | 310 | ||
302 | out_fail: | 311 | out_fail: |
303 | e->eld_ver = 0; | ||
304 | return -EINVAL; | 312 | return -EINVAL; |
305 | } | 313 | } |
306 | 314 | ||
@@ -323,9 +331,6 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
323 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() | 331 | * ELD is valid, actual eld_size is assigned in hdmi_update_eld() |
324 | */ | 332 | */ |
325 | 333 | ||
326 | if (!eld->eld_valid) | ||
327 | return -ENOENT; | ||
328 | |||
329 | size = snd_hdmi_get_eld_size(codec, nid); | 334 | size = snd_hdmi_get_eld_size(codec, nid); |
330 | if (size == 0) { | 335 | if (size == 0) { |
331 | /* wfg: workaround for ASUS P5E-VM HDMI board */ | 336 | /* wfg: workaround for ASUS P5E-VM HDMI board */ |
@@ -342,18 +347,28 @@ int snd_hdmi_get_eld(struct hdmi_eld *eld, | |||
342 | 347 | ||
343 | for (i = 0; i < size; i++) { | 348 | for (i = 0; i < size; i++) { |
344 | unsigned int val = hdmi_get_eld_data(codec, nid, i); | 349 | unsigned int val = hdmi_get_eld_data(codec, nid, i); |
350 | /* | ||
351 | * Graphics driver might be writing to ELD buffer right now. | ||
352 | * Just abort. The caller will repoll after a while. | ||
353 | */ | ||
345 | if (!(val & AC_ELDD_ELD_VALID)) { | 354 | if (!(val & AC_ELDD_ELD_VALID)) { |
346 | if (!i) { | ||
347 | snd_printd(KERN_INFO | ||
348 | "HDMI: invalid ELD data\n"); | ||
349 | ret = -EINVAL; | ||
350 | goto error; | ||
351 | } | ||
352 | snd_printd(KERN_INFO | 355 | snd_printd(KERN_INFO |
353 | "HDMI: invalid ELD data byte %d\n", i); | 356 | "HDMI: invalid ELD data byte %d\n", i); |
354 | val = 0; | 357 | ret = -EINVAL; |
355 | } else | 358 | goto error; |
356 | val &= AC_ELDD_ELD_DATA; | 359 | } |
360 | val &= AC_ELDD_ELD_DATA; | ||
361 | /* | ||
362 | * The first byte cannot be zero. This can happen on some DVI | ||
363 | * connections. Some Intel chips may also need some 250ms delay | ||
364 | * to return non-zero ELD data, even when the graphics driver | ||
365 | * correctly writes ELD content before setting ELD_valid bit. | ||
366 | */ | ||
367 | if (!val && !i) { | ||
368 | snd_printdd(KERN_INFO "HDMI: 0 ELD data\n"); | ||
369 | ret = -EINVAL; | ||
370 | goto error; | ||
371 | } | ||
357 | buf[i] = val; | 372 | buf[i] = val; |
358 | } | 373 | } |
359 | 374 | ||