diff mbox

drm/i915: Don't spew errors when resetting HDMI scrambling/bit clock ratio fails

Message ID 20180322132227.23810-1-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ville Syrjälä March 22, 2018, 1:22 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

When we're disabling the HDMI link we try to reset the scrambling and
TMDS bit clock ratio back to the default values. This will fail if the
sink has already been disconnected. Thus we should not print an error
message when resetting the scrambling/TMDS bit clock ratio fail during
disable. During enable we do want the error, and during disable we may
still want to know what happended for debug purposes so let's use
DRM_DEBUG_KMS() there.

Cc: Shashank Sharma <shashank.sharma@intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105644
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105655
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/i915/intel_ddi.c  |  11 ++--
 drivers/gpu/drm/i915/intel_drv.h  |  10 ++--
 drivers/gpu/drm/i915/intel_hdmi.c | 104 +++++++++++++++++++++++++-------------
 3 files changed, 78 insertions(+), 47 deletions(-)

Comments

Ville Syrjälä March 23, 2018, 2:07 p.m. UTC | #1
On Thu, Mar 22, 2018 at 06:47:21PM -0000, Patchwork wrote:
> == Series Details ==
> 
> Series: drm/i915: Don't spew errors when resetting HDMI scrambling/bit clock ratio fails (rev4)
> URL   : https://patchwork.freedesktop.org/series/40461/
> State : warning
> 
> == Summary ==
> 
> ---- Possible new issues:
> 
> Test kms_flip:
>         Subgroup 2x-flip-vs-dpms:
>                 pass       -> DMESG-WARN (shard-hsw)

Seems unrelated
[ 1018.018832] [drm:intel_set_pch_fifo_underrun_reporting [i915]] *ERROR* uncleared pch fifo underrun on pch transcoder A
[ 1018.019149] [drm:cpt_irq_handler [i915]] *ERROR* PCH transcoder A FIFO underrun

> 
> ---- Known issues:
> 
> Test kms_flip:
>         Subgroup 2x-plain-flip-ts-check-interruptible:
>                 pass       -> FAIL       (shard-hsw) fdo#100368 +1
>         Subgroup modeset-vs-vblank-race-interruptible:
>                 pass       -> FAIL       (shard-hsw) fdo#103060 +2
> Test kms_sysfs_edid_timing:
>                 warn       -> PASS       (shard-apl) fdo#100047
> 
> fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
> fdo#103060 https://bugs.freedesktop.org/show_bug.cgi?id=103060
> fdo#100047 https://bugs.freedesktop.org/show_bug.cgi?id=100047
> 
> shard-apl        total:3484 pass:1821 dwarn:1   dfail:0   fail:7   skip:1655 time:13153s
> shard-hsw        total:3484 pass:1770 dwarn:2   dfail:0   fail:4   skip:1707 time:11827s
> shard-snb        total:3484 pass:1363 dwarn:1   dfail:0   fail:3   skip:2117 time:7284s
> Blacklisted hosts:
> shard-kbl        total:3484 pass:1945 dwarn:1   dfail:0   fail:10  skip:1528 time:9960s
> 
> == Logs ==
> 
> For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_8453/shards.html
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c
index 8c2d778560f0..e151c073debb 100644
--- a/drivers/gpu/drm/i915/intel_ddi.c
+++ b/drivers/gpu/drm/i915/intel_ddi.c
@@ -2426,10 +2426,8 @@  static void intel_enable_ddi_hdmi(struct intel_encoder *encoder,
 	struct intel_digital_port *dig_port = enc_to_dig_port(&encoder->base);
 	enum port port = encoder->port;
 
-	intel_hdmi_handle_sink_scrambling(encoder,
-					  conn_state->connector,
-					  crtc_state->hdmi_high_tmds_clock_ratio,
-					  crtc_state->hdmi_scrambling);
+	intel_hdmi_sink_scrambling_enable(encoder,
+					  crtc_state, conn_state);
 
 	/* Display WA #1143: skl,kbl,cfl */
 	if (IS_GEN9_BC(dev_priv)) {
@@ -2524,9 +2522,8 @@  static void intel_disable_ddi_hdmi(struct intel_encoder *encoder,
 		intel_audio_codec_disable(encoder,
 					  old_crtc_state, old_conn_state);
 
-	intel_hdmi_handle_sink_scrambling(encoder,
-					  old_conn_state->connector,
-					  false, false);
+	intel_hdmi_sink_scrambling_enable(encoder,
+					  old_crtc_state, old_conn_state);
 }
 
 static void intel_disable_ddi(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index a215aa78b0be..90ea6e8e8f5b 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1783,10 +1783,12 @@  struct intel_hdmi *enc_to_intel_hdmi(struct drm_encoder *encoder);
 bool intel_hdmi_compute_config(struct intel_encoder *encoder,
 			       struct intel_crtc_state *pipe_config,
 			       struct drm_connector_state *conn_state);
-void intel_hdmi_handle_sink_scrambling(struct intel_encoder *intel_encoder,
-				       struct drm_connector *connector,
-				       bool high_tmds_clock_ratio,
-				       bool scrambling);
+void intel_hdmi_sink_scrambling_enable(struct intel_encoder *encoder,
+				       struct intel_crtc_state *crtc_state,
+				       struct drm_connector_state *conn_state);
+void intel_hdmi_sink_scrambling_disable(struct intel_encoder *encoder,
+					struct intel_crtc_state *old_crtc_state,
+					struct drm_connector_state *old_conn_state);
 void intel_dp_dual_mode_set_tmds_output(struct intel_hdmi *hdmi, bool enable);
 void intel_infoframe_init(struct intel_digital_port *intel_dig_port);
 
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 1baef4ac7ecb..a27da73147fd 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -2068,55 +2068,87 @@  intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
 	connector->state->picture_aspect_ratio = HDMI_PICTURE_ASPECT_NONE;
 }
 
-/*
- * intel_hdmi_handle_sink_scrambling: handle sink scrambling/clock ratio setup
- * @encoder: intel_encoder
- * @connector: drm_connector
- * @high_tmds_clock_ratio = bool to indicate if the function needs to set
- *  or reset the high tmds clock ratio for scrambling
- * @scrambling: bool to Indicate if the function needs to set or reset
- *  sink scrambling
- *
- * This function handles scrambling on HDMI 2.0 capable sinks.
- * If required clock rate is > 340 Mhz && scrambling is supported by sink
- * it enables scrambling. This should be called before enabling the HDMI
- * 2.0 port, as the sink can choose to disable the scrambling if it doesn't
- * detect a scrambled clock within 100 ms.
- */
-void intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
-				       struct drm_connector *connector,
-				       bool high_tmds_clock_ratio,
-				       bool scrambling)
+static int intel_hdmi_handle_sink_scrambling(struct intel_encoder *encoder,
+					     struct drm_connector *connector,
+					     bool high_tmds_clock_ratio,
+					     bool scrambling)
 {
+	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
-	struct drm_i915_private *dev_priv = connector->dev->dev_private;
 	struct drm_scrambling *sink_scrambling =
 				&connector->display_info.hdmi.scdc.scrambling;
-	struct i2c_adapter *adptr = intel_gmbus_get_adapter(dev_priv,
-							   intel_hdmi->ddc_bus);
+	struct i2c_adapter *adapter =
+		intel_gmbus_get_adapter(dev_priv, intel_hdmi->ddc_bus);
 	bool ret;
 
 	if (!sink_scrambling->supported)
-		return;
+		return 0;
 
-	DRM_DEBUG_KMS("Setting sink scrambling for enc:%s connector:%s\n",
-		      encoder->base.name, connector->name);
+	DRM_DEBUG_KMS("[CONNECTOR:%d:%s] scrambling=%s, TMDS bit clock ratio=1/%dX\n",
+		      connector->base.id, connector->name,
+		      yesno(scrambling), high_tmds_clock_ratio ? 40 : 10);
 
 	/* Set TMDS bit clock ratio to 1/40 or 1/10 */
-	ret = drm_scdc_set_high_tmds_clock_ratio(adptr, high_tmds_clock_ratio);
-	if (!ret) {
-		DRM_ERROR("Set TMDS ratio failed\n");
-		return;
-	}
+	ret = drm_scdc_set_high_tmds_clock_ratio(adapter,
+						 high_tmds_clock_ratio);
+	if (ret)
+		return ret;
 
 	/* Enable/disable sink scrambling */
-	ret = drm_scdc_set_scrambling(adptr, scrambling);
-	if (!ret) {
-		DRM_ERROR("Set sink scrambling failed\n");
-		return;
-	}
+	ret = drm_scdc_set_scrambling(adapter, scrambling);
+	if (ret)
+		return ret;
+
+	return 0;
+}
 
-	DRM_DEBUG_KMS("sink scrambling handled\n");
+/*
+ * intel_hdmi_sink_scrambling_enable: configure sink scrambling/TMDS bit clock ratio
+ * @crtc_state: new crtc state
+ * @conn_state: new connector state
+ *
+ * Configure scrambling and TMDS bit clock ratio on HDMI 2.0 capable sinks.
+ * If required clock rate is > 340 Mhz && scrambling is supported by sink
+ * it enables scrambling. This should be called before enabling the HDMI
+ * 2.0 port, as the sink can choose to disable the scrambling if it doesn't
+ * detect a scrambled clock within 100 ms.
+ */
+void intel_hdmi_sink_scrambling_enable(struct intel_encoder *encoder,
+				       struct intel_crtc_state *crtc_state,
+				       struct drm_connector_state *conn_state)
+{
+	struct drm_connector *connector = conn_state->connector;
+	int ret;
+
+	ret = intel_hdmi_handle_sink_scrambling(encoder, connector,
+						crtc_state->hdmi_high_tmds_clock_ratio,
+						crtc_state->hdmi_scrambling);
+	if (ret)
+		DRM_ERROR("[CONNECTOR:%d:%s] Failed to configure sink scrambling/TMDS bit clock ratio\n",
+			  connector->base.id, connector->name);
+}
+
+/*
+ * intel_hdmi_sink_scrambling_disable: handle sink scrambling/clock ratio setup during disable
+ * @old_crtc_state: old crtc state
+ * @old_conn_state: old connector state
+ *
+ * Reset scrambling and TMDS bit clock ratio on HDMI 2.0 capable sinks.
+ * We do this to make sure the sink returns to the default settings once
+ * we're done using it.
+ */
+void intel_hdmi_sink_scrambling_disable(struct intel_encoder *encoder,
+					struct intel_crtc_state *old_crtc_state,
+					struct drm_connector_state *old_conn_state)
+{
+	struct drm_connector *connector = old_conn_state->connector;
+	int ret;
+
+	ret = intel_hdmi_handle_sink_scrambling(encoder, connector,
+						false, false);
+	if (ret)
+		DRM_DEBUG_KMS("[CONNECTOR:%d:%s] Failed to reset sink scrambling/TMDS bit clock ratio\n",
+			      connector->base.id, connector->name);
 }
 
 static u8 chv_port_to_ddc_pin(struct drm_i915_private *dev_priv, enum port port)