Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: intel-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH v6 11/12] drm/i915: Handle force_audio correctly in intel_sdvo
Date: Mon,  1 May 2017 15:38:03 +0200	[thread overview]
Message-ID: <20170501133804.8116-12-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <20170501133804.8116-1-maarten.lankhorst@linux.intel.com>

Do the same as other connectors, attempt to detect hdmi audio in
the detect() callback, and only use the force_audio property as
override. Compute has_audio in pipe_config, and use that value
instead of the probed value directly.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_sdvo.c | 51 ++++++++++++++-------------------------
 1 file changed, 18 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index ef6fa87b2f8a..4be8be162058 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1122,6 +1122,8 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 				      struct drm_connector_state *conn_state)
 {
 	struct intel_sdvo *intel_sdvo = to_sdvo(encoder);
+	struct intel_sdvo_connector *intel_sdvo_connector =
+		to_intel_sdvo_connector(conn_state->connector);
 	struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode;
 	struct drm_display_mode *mode = &pipe_config->base.mode;
 
@@ -1160,7 +1162,12 @@ static bool intel_sdvo_compute_config(struct intel_encoder *encoder,
 	pipe_config->pixel_multiplier =
 		intel_sdvo_get_pixel_multiplier(adjusted_mode);
 
-	pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor;
+	if (intel_sdvo_connector->force_audio != HDMI_AUDIO_OFF_DVI)
+		pipe_config->has_hdmi_sink = intel_sdvo->has_hdmi_monitor;
+
+	if (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON ||
+	    (intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO && intel_sdvo->has_hdmi_audio))
+		pipe_config->has_audio = true;
 
 	if (intel_sdvo->color_range_auto) {
 		/* See CEA-861-E - 5.1 Default Encoding Parameters */
@@ -1285,7 +1292,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder,
 	else
 		sdvox |= SDVO_PIPE_SEL(crtc->pipe);
 
-	if (intel_sdvo->has_hdmi_audio)
+	if (crtc_state->has_audio)
 		sdvox |= SDVO_AUDIO_ENABLE;
 
 	if (INTEL_GEN(dev_priv) >= 4) {
@@ -1694,12 +1701,6 @@ intel_sdvo_tmds_sink_detect(struct drm_connector *connector)
 		kfree(edid);
 	}
 
-	if (status == connector_status_connected) {
-		struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
-		if (intel_sdvo_connector->force_audio != HDMI_AUDIO_AUTO)
-			intel_sdvo->has_hdmi_audio = (intel_sdvo_connector->force_audio == HDMI_AUDIO_ON);
-	}
-
 	return status;
 }
 
@@ -1978,23 +1979,6 @@ static void intel_sdvo_destroy(struct drm_connector *connector)
 	kfree(intel_sdvo_connector);
 }
 
-static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
-{
-	struct intel_sdvo *intel_sdvo = intel_attached_sdvo(connector);
-	struct edid *edid;
-	bool has_audio = false;
-
-	if (!intel_sdvo->is_hdmi)
-		return false;
-
-	edid = intel_sdvo_get_edid(connector);
-	if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
-		has_audio = drm_detect_monitor_audio(edid);
-	kfree(edid);
-
-	return has_audio;
-}
-
 static int
 intel_sdvo_set_property(struct drm_connector *connector,
 			struct drm_property *property,
@@ -2013,22 +1997,23 @@ intel_sdvo_set_property(struct drm_connector *connector,
 
 	if (property == dev_priv->force_audio_property) {
 		int i = val;
-		bool has_audio;
-
-		if (i == intel_sdvo_connector->force_audio)
-			return 0;
+		bool has_audio, old_audio;
 
-		intel_sdvo_connector->force_audio = i;
+		if (intel_sdvo_connector->force_audio == HDMI_AUDIO_AUTO)
+			old_audio = intel_sdvo->has_hdmi_audio;
+		else
+			old_audio = intel_sdvo_connector->force_audio == HDMI_AUDIO_ON;
 
 		if (i == HDMI_AUDIO_AUTO)
-			has_audio = intel_sdvo_detect_hdmi_audio(connector);
+			has_audio = intel_sdvo->has_hdmi_audio;
 		else
 			has_audio = (i == HDMI_AUDIO_ON);
 
-		if (has_audio == intel_sdvo->has_hdmi_audio)
+		intel_sdvo_connector->force_audio = i;
+
+		if (has_audio == old_audio)
 			return 0;
 
-		intel_sdvo->has_hdmi_audio = has_audio;
 		goto done;
 	}
 
-- 
2.9.3

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2017-05-01 13:38 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-01 13:37 [PATCH v6 00/12] drm/i915: Convert connector properties to atomic Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 01/12] drm/atomic: Handle picture_aspect_ratio in atomic core Maarten Lankhorst
2017-05-01 18:27   ` Manasi Navare
2017-05-02  9:54   ` Daniel Vetter
2017-05-01 13:37 ` [PATCH v6 02/12] drm/atomic: Add support for custom scaling mode properties, v2 Maarten Lankhorst
2017-05-02  9:44   ` Daniel Vetter
2017-05-02 11:06     ` Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 03/12] drm/i915: Use atomic scaling_mode instead of panel.fitting_mode Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 04/12] drm/i915: Use per-connector scaling mode property Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 05/12] drm/i915: Add plumbing for digital connector state, v3 Maarten Lankhorst
2017-05-02  9:56   ` Daniel Vetter
2017-05-30 10:28     ` Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 06/12] drm/i915: Convert DSI connector properties to atomic Maarten Lankhorst
2017-05-01 13:37 ` [PATCH v6 07/12] drm/i915: Convert LVDS " Maarten Lankhorst
2017-05-01 13:38 ` [PATCH v6 08/12] drm/i915: Make intel_dp->has_audio reflect hw state only Maarten Lankhorst
2017-05-01 13:38 ` [PATCH v6 09/12] drm/i915: Convert intel_dp properties to atomic, v2 Maarten Lankhorst
2017-05-01 13:38 ` [PATCH v6 10/12] drm/i915: Convert intel_hdmi connector properties to atomic Maarten Lankhorst
2017-05-01 13:38 ` Maarten Lankhorst [this message]
2017-05-01 13:38 ` [PATCH v6 12/12] drm/i915: Convert intel_sdvo " Maarten Lankhorst
2017-05-01 14:14 ` ✗ Fi.CI.BAT: failure for drm/i915: Convert connector properties to atomic. (rev7) Patchwork
2017-05-02  6:28 ` ✓ Fi.CI.BAT: success " Patchwork

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=20170501133804.8116-12-maarten.lankhorst@linux.intel.com \
    --to=maarten.lankhorst@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox