All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 28/29] drm/i915/hdmi: Only enable audio if supported by the monitor
Date: Sun, 22 Aug 2010 12:05:47 +0100	[thread overview]
Message-ID: <1282475148-15951-29-git-send-email-chris@chris-wilson.co.uk> (raw)
In-Reply-To: <1282475148-15951-1-git-send-email-chris@chris-wilson.co.uk>

References:

  Bug 26864 - Green Screen in LG Projector using HDMI output
  https://bugs.freedesktop.org/show_bug.cgi?id=26864

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_hdmi.c |   12 ++++++++----
 drivers/gpu/drm/i915/intel_sdvo.c |   11 +++++++----
 2 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index ccd4c97..88faa0b 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -40,6 +40,7 @@
 struct intel_hdmi {
 	struct intel_encoder base;
 	u32 sdvox_reg;
+	bool has_audio_sink;
 	bool has_hdmi_sink;
 };
 
@@ -65,11 +66,10 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
 	if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
 		sdvox |= SDVO_HSYNC_ACTIVE_HIGH;
 
-	if (intel_hdmi->has_hdmi_sink) {
+	if (intel_hdmi->has_audio_sink)
 		sdvox |= SDVO_AUDIO_ENABLE;
-		if (HAS_PCH_CPT(dev))
-			sdvox |= HDMI_MODE_SELECT;
-	}
+	if (intel_hdmi->has_hdmi_sink && HAS_PCH_CPT(dev))
+		sdvox |= HDMI_MODE_SELECT;
 
 	if (intel_crtc->pipe == 1) {
 		if (HAS_PCH_CPT(dev))
@@ -147,12 +147,16 @@ intel_hdmi_detect(struct drm_connector *connector)
 	enum drm_connector_status status = connector_status_disconnected;
 
 	intel_hdmi->has_hdmi_sink = false;
+	intel_hdmi->has_audio_sink = false;
+
 	edid = drm_get_edid(connector, intel_hdmi->base.ddc_bus);
 
 	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->has_hdmi_sink)
+				intel_hdmi->has_audio_sink = drm_edid_supports_audio(edid);
 		}
 		connector->display_info.raw_edid = NULL;
 		kfree(edid);
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 41962f8..dfaa547 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -104,6 +104,7 @@ struct intel_sdvo {
 	 * This is set if we treat the device as HDMI, instead of DVI.
 	 */
 	bool is_hdmi;
+	bool has_hdmi_audio;
 
 	/**
 	 * This is set if we detect output of sdvo device as LVDS.
@@ -1114,12 +1115,12 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
 				  &in_out, sizeof(in_out)))
 		return;
 
-	if (intel_sdvo->is_hdmi) {
+	if (intel_sdvo->is_hdmi)
 		if (!intel_sdvo_set_avi_infoframe(intel_sdvo, mode))
 			return;
 
+	if (intel_sdvo->has_hdmi_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
-	}
 
 	/* We have tried to get input timing in mode_fixup, and filled into
 	   adjusted_mode */
@@ -1476,9 +1477,11 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector)
 		bool need_digital = !!(intel_sdvo_connector->output_flag & SDVO_TMDS_MASK);
 
 		/* DDC bus is shared, match EDID to connector type */
-		if (is_digital && need_digital)
+		if (is_digital && need_digital) {
 			intel_sdvo->is_hdmi = drm_detect_hdmi_monitor(edid);
-		else if (is_digital != need_digital)
+			if (intel_sdvo->is_hdmi)
+				intel_sdvo->has_hdmi_audio = drm_edid_supports_audio(edid);
+		} else if (is_digital != need_digital)
 			status = connector_status_disconnected;
 
 		connector->display_info.raw_edid = NULL;
-- 
1.7.1

  parent reply	other threads:[~2010-08-22 11:06 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-22 11:05 More patches (resend) Chris Wilson
2010-08-22 11:05 ` [PATCH 01/29] drm/i915: unload: fix intel dp encoder cleanup Chris Wilson
2010-08-22 11:05 ` [PATCH 02/29] drm/i915: unload: fix error_work races Chris Wilson
2010-08-22 11:05 ` [PATCH 03/29] drm/i915: unload: fix hotplug_work races Chris Wilson
2010-08-22 11:05 ` [PATCH 04/29] drm/i915: unload: don't leak error state Chris Wilson
2010-08-22 11:05 ` [PATCH 05/29] drm/i915: unload: fix idle_timer/idle_work races Chris Wilson
2010-08-22 11:05 ` [PATCH 06/29] drm/i915: unload: fix unpin_work related races Chris Wilson
2010-08-22 11:05 ` [PATCH 07/29] drm/i915: unload: ensure that gem is idle Chris Wilson
2010-08-22 11:05 ` [PATCH 08/29] drm/i915: unload: fix retire_work races Chris Wilson
2010-08-22 11:05 ` [PATCH 09/29] drm/i915: Fixup intel_wait_for_vblank*() Chris Wilson
2010-08-23 16:56   ` [PATCH] drm/i915: Drop the msleep parameter to wait_for() Chris Wilson
2010-08-23 23:16     ` Peter Clifton
2010-08-23 23:33       ` Chris Wilson
2010-08-23 23:42         ` Peter Clifton
2010-08-22 11:05 ` [PATCH 10/29] drm/i915: Avoid using msleep under kdb and wait_for() Chris Wilson
2010-08-22 11:05 ` [PATCH 11/29] drm/i915: Include a generation number in the device info Chris Wilson
2010-08-22 11:05 ` [PATCH 12/29] drm/i915: Fix offset page-flips on i965+ Chris Wilson
2010-08-22 11:05 ` [PATCH 13/29] drm/i915: Clear scanline waits after disabling the pipe Chris Wilson
2010-08-22 11:05 ` [PATCH 14/29] drm/i915: Sanity check user framebuffer parameters on creation Chris Wilson
2010-08-22 11:05 ` [PATCH 15/29] drm/i915: Re-use set_base_atomic to share setting of the display registers Chris Wilson
2010-08-22 11:05 ` [PATCH 16/29] drm/i915/sdvo: Propagate error from switching control buses Chris Wilson
2010-08-22 11:05 ` [PATCH 17/29] drm/i915: Add ringbuffer wait reset to hangcheck Chris Wilson
2010-08-22 11:05 ` [PATCH 18/29] drm/i915/crt: Flush register prior to waiting for vblank Chris Wilson
2010-08-22 11:05 ` [PATCH 19/29] drm/i915/dp: Boost timeout for enabling transcoder to 100ms Chris Wilson
2010-08-22 11:05 ` [PATCH 20/29] drm/i915/sdvo: Guess the DDC bus in absence of VBIOS Chris Wilson
2010-08-22 11:05 ` [PATCH 21/29] drm/i915/tv: Flush register writes before sleeping Chris Wilson
2010-08-22 11:05 ` [PATCH 22/29] drm/i915/dp: Really try 5 times before giving up Chris Wilson
2010-08-30 22:35   ` Eric Anholt
2010-08-22 11:05 ` [PATCH 23/29] drm/i915/debug: Include Ironlake in self-refresh status Chris Wilson
2010-08-22 11:05 ` [PATCH 24/29] drm/i915: Allocate the PCI resource for the MCHBAR Chris Wilson
2010-08-22 11:05 ` [PATCH 25/29] drm/i915: Use the VBT from OpRegion when available (v2) Chris Wilson
2010-08-22 11:05 ` [PATCH 26/29] drm/i915: Invert watermarks used for i8xx, i9xx Chris Wilson
2010-08-30 22:39   ` Eric Anholt
2010-08-22 11:05 ` [PATCH 27/29] drm: Scan EDID for an audio-capable HDMI output Chris Wilson
2010-08-23 15:05   ` Adam Jackson
2010-08-22 11:05 ` Chris Wilson [this message]
2010-08-22 11:05 ` [PATCH 29/29] drm/i915: Tightly scope intel_encoder to prevent invalid use Chris Wilson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1282475148-15951-29-git-send-email-chris@chris-wilson.co.uk \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.