Bug 82349

Summary: HDMI audio stops working when drm_kms_helper EDID overwrite is in place
Product: DRI Reporter: Emil <emilsvennesson>
Component: DRM/IntelAssignee: Intel GFX Bugs mailing list <intel-gfx-bugs>
Status: CLOSED FIXED QA Contact: Intel GFX Bugs mailing list <intel-gfx-bugs>
Severity: normal    
Priority: medium CC: bernat, emilsvennesson, fritsch, grenoble, intel-gfx-bugs, jolan
Version: XOrg git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Forgot to run update-grub
none
dmesg
none
EDID file I am supplying to drm_kms_helper
none
nightly dmesg w/debug
none
HT-R393 edid none

Description Emil 2014-08-08 13:42:50 UTC
Bug ID 80691 (https://bugs.freedesktop.org/show_bug.cgi?id=80691) also applies to Intel systems.
Comment 1 Emil 2014-08-08 13:53:50 UTC
Created attachment 104285 [details]
Forgot to run update-grub
Comment 2 Emil 2014-08-08 13:59:44 UTC
Created attachment 104286 [details]
dmesg
Comment 3 Rob Engle 2014-08-18 04:28:25 UTC
I'm seeing this bug too.  It seems the Radeon bug report has a good explanation of what is happening (driver is caching the EDID but never gets updated when system is using drm_kms_helper).  Perhaps the Intel driver has a similar caching issue.
Comment 4 Chris Wilson 2014-08-18 05:31:41 UTC
Kind of. It is just that the EDID is queried for audio capability during detect(), which is circumvented by drm_kms_heler.edid= What could do as a workaround is xrandr --output HDMI --off xrandr --set audio off; xrandr --output HDMI1 --preferred --set audio on;
Comment 5 Rob Engle 2014-08-18 05:52:12 UTC
I will try the work around... thanks!

That said, drm_kms_helper supplied EDID, in my case is on HDMI connector... audio *should* be enabled.  In other words, I would expect same behavior whether (same) EDID was detected from monitor or supplied by kernel.

  drm_kms_helper.edid_firmware=HDMI-A-1:edid/lg_D2342P_edid.bin

Am I missing something to properly force enabling my HDMI output (for video and sound) when monitor if off/disconnected during boot?
Comment 6 Chris Wilson 2014-08-18 05:57:08 UTC
Hmm, I may be getting the effect of the overrides mixed up then. The xrandr trick may not work if it is not skipping the detect() on the HDMI port. Can you attach the edid you are using just so we can run it through a decoder to check.

The other override for *forced**detection* (my mistake above!) is video=HDMI-1-A:e
Comment 7 Rob Engle 2014-08-18 06:09:03 UTC
Created attachment 104790 [details]
EDID file I am supplying to drm_kms_helper
Comment 8 Jani Nikula 2014-09-10 12:34:26 UTC
Rob, does this patch help?

Chris, does this patch make sense? ;) Should we check for connector type and only do this for HDMI/DP?

diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index 0a235fe61c9b..144a0368ccd0 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -288,6 +288,7 @@ int drm_load_edid_firmware(struct drm_connector *connector)
 
        drm_mode_connector_update_edid_property(connector, edid);
        ret = drm_add_edid_modes(connector, edid);
+       drm_edid_to_eld(connector, edid);
        kfree(edid);
 
        return ret;
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c
index 6857e9ad6339..5edc61f2f212 100644
--- a/drivers/gpu/drm/drm_probe_helper.c
+++ b/drivers/gpu/drm/drm_probe_helper.c
@@ -151,6 +151,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect
                        struct edid *edid = (struct edid *) connector->edid_blob_ptr->data;
 
                        count = drm_add_edid_modes(connector, edid);
+                       drm_edid_to_eld(connector, edid);
                } else
                        count = (*connector_funcs->get_modes)(connector);
        }
Comment 9 Jesse Barnes 2014-12-10 20:55:25 UTC
Timing out.  Seems like we need something like the fix Jani mentioned, but would need someone to test it (assuming it isn't already pushed).
Comment 10 Jolan Luff 2015-03-26 00:21:49 UTC
Hi,

I can confirm that this patch works; tested with 4.0-rc5.

Background:

I have an ASUS Chromebox (Celeron 2955U) connected to an Onkyo RT-393 AVR via HDMI.  It very rarely (5-10% of the time) can initiate a successful handshake to the AVR so I dumped the EDID and have been using grub to enable the output and force the EDID:

drm_kms_helper.edid_firmware=HDMI-A-1:edid/edid.bin video=HDMI-A-1:D

This caused video to work 100% of the time but audio to work 0% of the time; eld was always empty and the AVR was indicating no signal:

/proc/asound/card0/eld#0.0
monitor_present	0
eld_valid	0

Now with this patch I rebooted and audio/video worked 3/3 times which has never happened in the ~6 weeks that I've had this hardware combo.
Comment 11 Jani Nikula 2015-03-26 08:47:57 UTC
Patch submitted http://patchwork.freedesktop.org/patch/45675/
Comment 12 Jani Nikula 2015-03-26 09:04:00 UTC
Jolan, thanks for picking this up and testing the patch.

To sidetrack a bit, have you reported your EDID issues? Is there a bug? If you're having issues reading EDID, you might want to give drm-intel-nightly branch of http://cgit.freedesktop.org/drm-intel a spin. There are some fixes headed for v4.1 kernel that might help. Just be sure to drop the edid_firmware part.

N.b. we'll want to fix this EDID override issue no matter what.
Comment 13 Jolan Luff 2015-03-26 13:42:59 UTC
(In reply to Jani Nikula from comment #12)
> To sidetrack a bit, have you reported your EDID issues? Is there a bug? If
> you're having issues reading EDID, you might want to give drm-intel-nightly
> branch of http://cgit.freedesktop.org/drm-intel a spin. There are some fixes
> headed for v4.1 kernel that might help. Just be sure to drop the
> edid_firmware part.

No, I haven't reported the EDID issues yet as I haven't yet collected enough info to make a decent bug report.

There's definitely some sort of bug. Sometimes no EDID, sometimes EDID but the connector isn't enabled. I have a Raspberry Pi 2 connected to the same hardware with the same cable and it works 100% of the time so I don't think it's the other side.

I'll give drm-intel-nightly a try and report back results.
Comment 14 Jolan Luff 2015-03-27 14:55:54 UTC
I just booted a drm-intel-nightly kernel remotely and the EDID/ELD info is populated and connector is reporting connected. So it seems it woke the receiver out of stand by and properly initialized which is a good sign.

Will do some more tests once I'm home to verify.
Comment 15 Jolan Luff 2015-03-27 23:18:35 UTC
Created attachment 114673 [details]
nightly dmesg w/debug

Picks 720x480 instead of 1920x1080 but otherwise seems to initialize fine.

I can switch to 1920x1080 in X and audio has no problems either.
Comment 16 Jolan Luff 2015-03-27 23:19:57 UTC
Created attachment 114674 [details]
HT-R393 edid
Comment 17 Jani Nikula 2015-04-09 14:34:54 UTC
commit ad692b46dbf122ef90aadce3b389ef64c90e861d
Author: Jani Nikula <jani.nikula@intel.com>
Date:   Thu Mar 26 10:42:00 2015 +0200

    drm/edid: set ELD for firmware and debugfs override EDIDs

in Linus' tree. Thanks for the report.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.