[Intel-gfx] [PATCH 2/2] drm/i915: Try GPIO NAK discovery before GMBUS

David Weinehall david.weinehall at linux.intel.com
Mon Aug 22 16:52:26 UTC 2016


On Fri, Aug 19, 2016 at 05:45:03PM +0100, Chris Wilson wrote:
> Some GMBUS devices fail to report NAKs (even recent Skylakes), resulting
> in us hitting the 50ms timeout every time we try to read an EDID on a
> disconnected device. Try a quick GPIO discovery first by setting the
> clock line and seeing if the device responds.

Sadly doesn't work.  Doesn't make a difference on the problematic port
(HDMI-A-2 on a ThinkPad 13) -- still very slow, nor on the
non-problematic port (HDMI-A-1 on the same laptop) -- still fast,
but seems to make things a lot worse on HDMI-A-1 when there *is*
a display connected -- incredibly slow.

So, ironically I'd say NAK to the NAK-patch.


Kind regards, David Weinehall

> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: David Weinehall <david.weinehall at linux.intel.com>
> ---
>  drivers/gpu/drm/i915/intel_i2c.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index 6841c41281a3..72945a7c5547 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -461,6 +461,22 @@ gmbus_xfer_index_read(struct drm_i915_private *dev_priv, struct i2c_msg *msgs)
>  	return ret;
>  }
>  
> +static bool gpio_is_alive(struct intel_gmbus *bus)
> +{
> +	bool result = true;
> +
> +	intel_i2c_quirk_set(bus->dev_priv, true);
> +	set_clock(bus, 1);
> +
> +	if (wait_for_us(get_clock(bus), 10) && wait_for(get_clock(bus), 2))
> +		result = false;
> +
> +	set_clock(bus, 0);
> +	intel_i2c_quirk_set(bus->dev_priv, false);
> +
> +	return result;
> +}
> +
>  static int
>  do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
>  {
> @@ -474,6 +490,13 @@ do_gmbus_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, int num)
>  	int i = 0, inc, try = 0;
>  	int ret = 0;
>  
> +	/* Some GMBUS devices fail to report NAKs and so we hit the 50ms
> +	 * timeout, every time. Try a quick GPIO discovery first by seeing
> +	 * if the device responds to setting the clock line high.
> +	 */
> +	if (!gpio_is_alive(bus))
> +		return -ENXIO;
> +
>  	intel_uncore_forcewake_get(dev_priv, fw);
>  retry:
>  	I915_WRITE_FW(GMBUS0, bus->reg0);
> -- 
> 2.9.3
> 


More information about the Intel-gfx mailing list