stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Fix DDC probe for passive adapters
@ 2015-05-28  8:51 Jani Nikula
  2015-05-28 10:05 ` [PATCH v2] " Jani Nikula
  0 siblings, 1 reply; 15+ messages in thread
From: Jani Nikula @ 2015-05-28  8:51 UTC (permalink / raw)
  To: intel-gfx; +Cc: stable, jani.nikula, tprevite, jim.bride

Passive DP->DVI/HDMI dongles on DP++ ports show up to the system as HDMI
devices, as they do not have a sink device in them to respond to any AUX
traffic. When probing these dongles over the DDC, sometimes they will
NAK the first attempt even though the transaction is valid and they
support the DDC protocol. The retry loop inside of
drm_do_probe_ddc_edid() would normally catch this case and try the
transaction again, resulting in success.

That, however, was thwarted by the fix for [1]:

commit 9292f37e1f5c79400254dca46f83313488093825
Author: Eugeni Dodonov <eugeni.dodonov@intel.com>
Date:   Thu Jan 5 09:34:28 2012 -0200

    drm: give up on edid retries when i2c bus is not responding

This added code to exit immediately if the return code from the
i2c_transfer function was -ENXIO in order to reduce the amount of time
spent in waiting for unresponsive or disconnected devices. That was
possible because the underlying i2c bit banging algorithm had retries of
its own (which, of course, were part of the reason for the bug the
commit fixes).

Since its introduction in

commit f899fc64cda8569d0529452aafc0da31c042df2e
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jul 20 15:44:45 2010 -0700

    drm/i915: use GMBUS to manage i2c links

we've been flipping back and forth enabling the GMBUS transfers, but
we've settled since then. The GMBUS implementation does not do any
retries, however, bailing out of the drm_do_probe_ddc_edid() retry loop
on first encounter of -ENXIO. This, combined with Eugeni's commit, broke
the retry on -ENXIO.

Retry GMBUS once on -ENXIO to mitigate the issues with passive adapters.

This patch is based on the work, and commit message, by Todd Previte
<tprevite@gmail.com>.

[1] https://bugs.freedesktop.org/show_bug.cgi?id=41059

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=85924
Cc: Todd Previte <tprevite@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/intel_i2c.c | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
index 92072f56e418..e58f39e167fb 100644
--- a/drivers/gpu/drm/i915/intel_i2c.c
+++ b/drivers/gpu/drm/i915/intel_i2c.c
@@ -478,9 +478,7 @@ gmbus_xfer_index_read(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)
 }
 
 static int
-gmbus_xfer(struct i2c_adapter *adapter,
-	   struct i2c_msg *msgs,
-	   int num)
+do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
 {
 	struct intel_gmbus *bus = container_of(adapter,
 					       struct intel_gmbus,
@@ -593,6 +591,24 @@ out:
 	return ret;
 }
 
+static int
+gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
+{
+	int ret;
+
+	ret = do_gmbus_xfer(adapter, msgs, num);
+
+	/*
+	 * Passive adapters sometimes NAK the first probe. Retry once on
+	 * -ENXIO. See also the retry loop in drm_do_probe_ddc_edid, which bails
+	 * out on the first -ENXIO.
+	 */
+	if (ret == -ENXIO)
+		ret = do_gmbus_xfer(adapter, msgs, num);
+
+	return ret;
+}
+
 static u32 gmbus_func(struct i2c_adapter *adapter)
 {
 	return i2c_bit_algo.functionality(adapter) &
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2015-06-09  7:42 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28  8:51 [PATCH] drm/i915: Fix DDC probe for passive adapters Jani Nikula
2015-05-28 10:05 ` [PATCH v2] " Jani Nikula
2015-05-28 10:48   ` [Intel-gfx] " Ville Syrjälä
2015-05-28 11:36     ` Jani Nikula
2015-05-28 12:26       ` Ville Syrjälä
2015-05-28 12:28       ` Daniel Vetter
2015-05-28 12:34         ` Jani Nikula
2015-06-02  8:29   ` [PATCH v3] " Jani Nikula
2015-06-02 10:35     ` [Intel-gfx] " Ville Syrjälä
2015-06-02 10:42       ` [PATCH v4] " Jani Nikula
2015-06-02 13:09         ` Ville Syrjälä
2015-06-02 16:21           ` [PATCH v5] " Jani Nikula
2015-06-02 16:40             ` Ville Syrjälä
2015-06-02 16:43               ` Jani Nikula
2015-06-09  7:44               ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).