All of lore.kernel.org
 help / color / mirror / Atom feed
From: "José Roberto de Souza" <jose.souza@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [PATCH 2/2] drm/i915/icl: Probe again type-c connectors that failed
Date: Fri,  8 Feb 2019 17:47:53 -0800	[thread overview]
Message-ID: <20190209014753.16944-2-jose.souza@intel.com> (raw)
In-Reply-To: <20190209014753.16944-1-jose.souza@intel.com>

Unpowered type-c dongles can take some time to boot and be
responsible, causing the probe to fail and sink never be detected
without further actions from userspace.

It was not a issue for older platforms because there was a hardware
bridge between DDI/DP ports and type-c controller adding a implicit
delay that hid this issue but ICL have type-c controllers integrated
to the SOC bring this issue to users.

So here after the first probe interation over every connector with
a hotplug event set, it sleeps for half a second to give some time to
dongles to be ready and then try to probe again every type-c
connector that failed in the initial probe.

Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c      |  3 +++
 drivers/gpu/drm/i915/intel_drv.h     |  2 +-
 drivers/gpu/drm/i915/intel_hotplug.c | 39 +++++++++++++++++++++++-----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index cf709835fb9a..b91b9700755f 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -6968,6 +6968,9 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
 		I915_WRITE(PEG_BAND_GAP_DATA, (temp & ~0xf) | 0xd);
 	}
 
+	if (intel_port_is_tc(dev_priv, port) && !intel_dig_port->tc_legacy_port)
+		intel_dig_port->tc_delay_wa_needed = true;
+
 	return true;
 
 fail:
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index fd50c962eaa3..3ae95679c2a9 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1257,7 +1257,7 @@ struct intel_digital_port {
 	/* Used for DP and ICL+ TypeC/DP and TypeC/HDMI ports. */
 	enum aux_ch aux_ch;
 	enum intel_display_power_domain ddi_io_power_domain;
-	bool tc_legacy_port:1;
+	bool tc_legacy_port:1, tc_delay_wa_needed:1;
 	enum tc_port_type tc_type;
 
 	void (*write_infoframe)(struct intel_encoder *encoder,
diff --git a/drivers/gpu/drm/i915/intel_hotplug.c b/drivers/gpu/drm/i915/intel_hotplug.c
index 72e0203bcbb2..eeac29f2dc70 100644
--- a/drivers/gpu/drm/i915/intel_hotplug.c
+++ b/drivers/gpu/drm/i915/intel_hotplug.c
@@ -343,7 +343,7 @@ static void i915_digport_work_func(struct work_struct *work)
 }
 
 static bool
-i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits)
+i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits, u32 *hpd_tc_delay_wa)
 {
 	struct drm_connector_list_iter conn_iter;
 	struct drm_connector *connector;
@@ -356,16 +356,27 @@ i915_hotplug_iterate(struct drm_device *dev, u32 hpd_event_bits)
 
 		intel_connector = to_intel_connector(connector);
 		intel_encoder = intel_connector->encoder;
-
 		if (!intel_encoder)
 			continue;
 
 		if (hpd_event_bits & (1 << intel_encoder->hpd_pin)) {
+			bool ret;
+
 			DRM_DEBUG_KMS("Connector %s (pin %i) received hotplug event.\n",
 				      connector->name, intel_encoder->hpd_pin);
 
-			changed |= intel_encoder->hotplug(intel_encoder,
-							  intel_connector);
+			ret = intel_encoder->hotplug(intel_encoder,
+						     intel_connector);
+			changed |= ret;
+
+			if (hpd_tc_delay_wa && !ret &&
+			    connector->status != connector_status_connected) {
+				struct intel_digital_port *dig_port = enc_to_dig_port(&intel_encoder->base);
+
+				if (dig_port && dig_port->tc_delay_wa_needed &&
+				    !dig_port->dp.is_mst)
+					*hpd_tc_delay_wa |= (1 << intel_encoder->hpd_pin);
+			}
 		}
 	}
 	drm_connector_list_iter_end(&conn_iter);
@@ -382,7 +393,7 @@ static void i915_hotplug_work_func(struct work_struct *work)
 		container_of(work, struct drm_i915_private, hotplug.hotplug_work);
 	struct drm_device *dev = &dev_priv->drm;
 	bool changed;
-	u32 hpd_event_bits;
+	u32 hpd_event_bits, hpd_tc_delay_wa = 0;
 
 	mutex_lock(&dev->mode_config.mutex);
 	DRM_DEBUG_KMS("running encoder hotplug functions\n");
@@ -397,12 +408,28 @@ static void i915_hotplug_work_func(struct work_struct *work)
 
 	spin_unlock_irq(&dev_priv->irq_lock);
 
-	changed = i915_hotplug_iterate(dev, hpd_event_bits);
+	changed = i915_hotplug_iterate(dev, hpd_event_bits, &hpd_tc_delay_wa);
 
 	mutex_unlock(&dev->mode_config.mutex);
 
 	if (changed)
 		drm_kms_helper_hotplug_event(dev);
+
+	/*
+	 * Unpowered type-c dongles can take some time to boot and be
+	 * responsible, so here giving some type to those dongles to power up
+	 * and then probing again.
+	 */
+	if (hpd_tc_delay_wa) {
+		msleep(500);
+
+		mutex_lock(&dev->mode_config.mutex);
+		changed = i915_hotplug_iterate(dev, hpd_tc_delay_wa, NULL);
+		mutex_unlock(&dev->mode_config.mutex);
+
+		if (changed)
+			drm_kms_helper_hotplug_event(dev);
+	}
 }
 
 
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-02-09  1:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-09  1:47 [PATCH 1/2] drm/i915/hotplug: Move iteration over connectors to other function José Roberto de Souza
2019-02-09  1:47 ` José Roberto de Souza [this message]
2019-02-09  1:54 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/2] " Patchwork
2019-02-09  2:15 ` ✓ Fi.CI.BAT: success " Patchwork
2019-02-09  8:49 ` ✗ Fi.CI.IGT: failure " Patchwork
2019-02-22 21:08 [PATCH 1/2] drm/i915: Add support for retrying hotplug José Roberto de Souza
2019-02-22 21:08 ` [PATCH 2/2] drm/i915/icl: Probe again type-c connectors that failed José Roberto de Souza
2019-02-26 14:08   ` Imre Deak
2019-02-26 15:34     ` Jani Nikula
2019-02-28  0:32     ` Souza, Jose
2019-02-28 16:06       ` Imre Deak
2019-03-13  1:03         ` Souza, Jose

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=20190209014753.16944-2-jose.souza@intel.com \
    --to=jose.souza@intel.com \
    --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.