Skip to contentSkip to conversation

force DVI mode without audio

PATCH In review Wu Fengguang 2 participants 7 messages Dec 31, 2011 – Jan 11, 2012 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Wu Fengguang

author Reviewed-by Keith Packard
#1 lore raw

Hi Andrea,

Quoted 13 lines · Andrea Arcangeli

Hi,

after upgrading my HTPC to HD3000 graphics (2700K), I didn't find anymore a way to disable the hdmi audio from the DVI2HDMI cable (I connect DVI output of the motherboard to the HDMI input of the LCDTV in HD). So I added it to the driver as it looks a missing tweak that I need.

(I also have proper audio setup connected to the second output of the soundcard, but unless I watch a movie or listen music I keep it off so I like the LCDTV speaker to work too, and if I turn on the proper sound then I mute the TV)

Quoted 6 lines

With the readon I was using radeon.audio=0 at boot to achieve the exact same thing. Without this, the LCDTV won't play the audio coming from the line in analog cable as it's fooled into thinking the audio comes through the hdmi cable when it cannot.

It's all working perfectly now.

Have you tried the "audio" property which can be listed with

        xrandr --prop

Thanks,
Fengguang
---

Related commits:

commit 3f43c48d333777e815ae68d66396cb6dfbc2dd79

Author: Chris Wilson <[email protected]>
Date:   Thu May 12 22:17:24 2011 +0100

drm/i915: Share the common force-audio property between connectors

Make the audio property creation routine common and share the single property between the connectors.

commit 55b7d6e8c4690047ac001026cb75a47f747db816

Author: Chris Wilson <[email protected]>
Date:   Sun Sep 19 09:29:33 2010 +0100

drm/i915/hdmi: Add 'force_audio' property

Allow the user to override the detection of the sink's audio capabilities from EDID. Not all sinks support the required EDID level to specify whether they handle audio over the display connection, so allow the user to enable it manually.

Thanks,
Fengguang

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 36 lines · Andrea Arcangeli
Quoted 21 lines · Wu Fengguang

Hi Andrea,

Quoted 18 lines · Andrea Arcangeli

Hi,

after upgrading my HTPC to HD3000 graphics (2700K), I didn't find anymore a way to disable the hdmi audio from the DVI2HDMI cable (I connect DVI output of the motherboard to the HDMI input of the LCDTV in HD). So I added it to the driver as it looks a missing tweak that I need.

(I also have proper audio setup connected to the second output of the soundcard, but unless I watch a movie or listen music I keep it off so I like the LCDTV speaker to work too, and if I turn on the proper sound then I mute the TV)

With the readon I was using radeon.audio=0 at boot to achieve the exact same thing. Without this, the LCDTV won't play the audio coming from the line in analog cable as it's fooled into thinking the audio comes through the hdmi cable when it cannot.

Quoted 5 lines
Quoted 1 line

It's all working perfectly now.

Have you tried the "audio" property which can be listed with

        xrandr --prop

I wasn't aware about this one, thanks for the tip.

I tried:

        xrandr --output HDMI1 --set "audio" off

that made the sound working for half a second, then it stops working.

Quoted 7 lines

If I run:

        xrandr --output HDMI1 --set "audio" on
        xrandr --output HDMI1 --set "audio" off

at every invocation (including "on") I can hear sound for half a second and then it stops no matter if it's left on or off.

That's an interesting bug. What's the kernel version you are running? The dmesg may tell something (especially if boot with "drm.debug=6").

Quoted 2 lines

So I applied my patch again for now. If you fix the above I guess adding a little script to my KDE autostart directory would work fine.

OK.

Quoted 3 lines

Also note, CTRL+ALT+F1 going back to console doesn't help either. I didn't try to play audio before starting X though, not sure what happens if I never run X and I try to play audio.

Yeah, that could be a problem. I see that

/sys/class/drm/card0/card0-HDMI-A-1/

exports several drm connector properties, however the (currently still i915 specific) "audio" property is not there. It should be good to make it a general one and export it in drivers/gpu/drm/drm_sysfs.c.

Quoted 3 lines

BTW, initially I tried to set only has_audio to false, but that wasn't enough I had to set hdmi to off too and force it to DVI mode to make audio work with my TVLCD (LG brand).

You mean the "has_hdmi_sink = false"? Well does that mean we need to one more property for it? The property _interface_ is per port, which can support 2+ HDMI/DP jacks well.

Thanks,
Fengguang

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw

PATCH 1/1 drm/i915: add an "off-dvi" HDMI audio mode

Andrea,

Would you test this patch at convenient time?

Thanks,
Fengguang

---
Subject: drm/i915: add an "off-dvi" HDMI audio mode
Date: Fri Jan 06 11:04:00 CST 2012

When HDMI-DVI converter is used, it's not only necessary to turn off audio, but also to disable HDMI_MODE_SELECT and video infoframe. Since the DVI mode is mainly tied to audio functionality from end user POV, add a new "off-dvi" audio mode:

	xrandr --output HDMI1 --set audio off-dvi
---
 drivers/gpu/drm/i915/i915_drv.h    |    7 +++++++
 drivers/gpu/drm/i915/intel_hdmi.c  |    8 +++++---
 drivers/gpu/drm/i915/intel_modes.c |    4 +++-
 3 files changed, 15 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +7 -0
@@ -736,6 +736,13 @@ typedef struct drm_i915_private {
 	atomic_t forcewake_count;
 } drm_i915_private_t;
 
+enum hdmi_force_audio {
+	HDMI_AUDIO_OFF_DVI = -2,	/* no aux data for HDMI-DVI converter */
+	HDMI_AUDIO_OFF,			/* force turn off HDMI audio */
+	HDMI_AUDIO_AUTO,		/* trust EDID */
+	HDMI_AUDIO_ON,			/* force turn on HDMI audio */
+};
+
 enum i915_cache_level {
 	I915_CACHE_NONE,
 	I915_CACHE_LLC,
drivers/gpu/drm/i915/intel_hdmi.c +5 -3
@@ -335,7 +335,9 @@ intel_hdmi_detect(struct drm_connector *
 	if (edid) {
 		if (edid->input & DRM_EDID_INPUT_DIGITAL) {
 			status = connector_status_connected;
-			intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
+			if (intel_hdmi->force_audio != HDMI_AUDIO_OFF_DVI)
+				intel_hdmi->has_hdmi_sink =
+						drm_detect_hdmi_monitor(edid);
 			intel_hdmi->has_audio = drm_detect_monitor_audio(edid);
 		}
 		connector->display_info.raw_edid = NULL;
@@ -411,8 +413,8 @@ intel_hdmi_set_property(struct drm_conne
 		else
 			has_audio = i > 0;
 
-		if (has_audio == intel_hdmi->has_audio)
-			return 0;
+		if (i == HDMI_AUDIO_OFF_DVI)
+			intel_hdmi->has_hdmi_sink = 0;
 
 		intel_hdmi->has_audio = has_audio;
 		goto done;
drivers/gpu/drm/i915/intel_modes.c +3 -1
@@ -84,6 +84,7 @@ int intel_ddc_get_modes(struct drm_conne
 }
 
 static const char *force_audio_names[] = {
+	"off-dvi",
 	"off",
 	"auto",
 	"on",
@@ -106,7 +107,8 @@ intel_attach_force_audio_property(struct
 			return;
 
 		for (i = 0; i < ARRAY_SIZE(force_audio_names); i++)
-			drm_property_add_enum(prop, i, i-1, force_audio_names[i]);
+			drm_property_add_enum(prop, i, i-2,
+					      force_audio_names[i]);
 
 		dev_priv->force_audio_property = prop;
 	}
#6 lore raw

Re: [PATCH] drm/i915: add an "off-dvi" HDMI audio mode

Quoted 16 lines · On Fri, 6 Jan 2012 11:26:40 +0800 Wu Fengguang <[email protected]> wrote:

Andrea,

Would you test this patch at convenient time?

Thanks,
Fengguang

---
Subject: drm/i915: add an "off-dvi" HDMI audio mode
Date: Fri Jan 06 11:04:00 CST 2012

When HDMI-DVI converter is used, it's not only necessary to turn off audio, but also to disable HDMI_MODE_SELECT and video infoframe. Since the DVI mode is mainly tied to audio functionality from end user POV, add a new "off-dvi" audio mode:

Quoted 5 lines
	xrandr --output HDMI1 --set audio off-dvi

---

My only complaint here is that off-dvi isn't an intuitive name. We don't have any better way of detecting an HDMI->DVI converter with other EDID bits perhaps?

A better name might be off-dvi-mode or off-dvi-only or something.

Signature · 1 line
Jesse Barnes, Intel Open Source Technology Center
#7 lore raw

Re: [PATCH] drm/i915: add an "off-dvi" HDMI audio mode

Quoted 21 lines · Jesse Barnes
Quoted 18 lines · On Fri, 6 Jan 2012 11:26:40 +0800 Wu Fengguang <[email protected]> wrote:

Andrea,

Would you test this patch at convenient time?

Thanks,
Fengguang

---
Subject: drm/i915: add an "off-dvi" HDMI audio mode
Date: Fri Jan 06 11:04:00 CST 2012

When HDMI-DVI converter is used, it's not only necessary to turn off audio, but also to disable HDMI_MODE_SELECT and video infoframe. Since the DVI mode is mainly tied to audio functionality from end user POV, add a new "off-dvi" audio mode:

	xrandr --output HDMI1 --set audio off-dvi
Quoted 7 lines
Quoted 3 lines

---

My only complaint here is that off-dvi isn't an intuitive name. We don't have any better way of detecting an HDMI->DVI converter with other EDID bits perhaps?

We have

        intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid);

which _should_ auto detect HDMI/DVI connections.

I guess Andrea ran into problem with that due to broken EDID. Anyway I'll try to test if that drm_detect_hdmi_monitor() will ever work for the HDMI/DVI monitors in my lab.

Quoted 1 line

A better name might be off-dvi-mode or off-dvi-only or something.

OK, will change to "off-dvi-mode".

Thanks,
Fengguang

#8 lore raw

Re: [PATCH] drm/i915: add an "off-dvi" HDMI audio mode

Quoted 32 lines · Wu Fengguang
Quoted 21 lines · Jesse Barnes
Quoted 18 lines · On Fri, 6 Jan 2012 11:26:40 +0800 Wu Fengguang <[email protected]> wrote:

Andrea,

Would you test this patch at convenient time?

Thanks,
Fengguang

---
Subject: drm/i915: add an "off-dvi" HDMI audio mode
Date: Fri Jan 06 11:04:00 CST 2012

When HDMI-DVI converter is used, it's not only necessary to turn off audio, but also to disable HDMI_MODE_SELECT and video infoframe. Since the DVI mode is mainly tied to audio functionality from end user POV, add a new "off-dvi" audio mode:

	xrandr --output HDMI1 --set audio off-dvi
Quoted 7 lines
Quoted 3 lines

---

My only complaint here is that off-dvi isn't an intuitive name. We don't have any better way of detecting an HDMI->DVI converter with other EDID bits perhaps?

We have

Quoted 7 lines
        intel_hdmi->has_hdmi_sink = drm_detect_hdmi_monitor(edid);

which _should_ auto detect HDMI/DVI connections.

I guess Andrea ran into problem with that due to broken EDID. Anyway I'll try to test if that drm_detect_hdmi_monitor() will ever work for the HDMI/DVI monitors in my lab.

I verified that drm_detect_hdmi_monitor() at least works fine for me when HDMI<>DVI converter is used:

[   12.567158] [drm:intel_hdmi_detect], has_hdmi_sink=0 has_audio=0 force_audio=0

So it's probably Andrea's monitor sending the wrong EDID.

Thanks,
Fengguang

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw

Re: [PATCH] drm/i915: add an "off-dvi" HDMI audio mode

Quoted 4 lines · Andrea Arcangeli
Quoted 1 line · Jesse Barnes

A better name might be off-dvi-mode or off-dvi-only or something.

force-dvi is probably better name, off is counter intuitive.

Yeah, "force-dvi" looks good!

Quoted 1 line

I didn't test the patch yet, I'll do soon.

Thank you! It did take effect judging from the dmesg on my HDMI box, however I've not yet tested the HDMI-to-DVI setup.

Thanks,
Fengguang