All of lore.kernel.org
 help / color / mirror / Atom feed
From: Imre Deak <imre.deak@intel.com>
To: Shashank Sharma <shashank.sharma@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v2 1/2] drm: Add retries for dp dual mode read
Date: Thu, 24 Aug 2017 14:49:55 +0300	[thread overview]
Message-ID: <20170824114955.5nu5uop2xcnxudvw@ideak-desk.fi.intel.com> (raw)
In-Reply-To: <1503492171-13446-1-git-send-email-shashank.sharma@intel.com>

On Wed, Aug 23, 2017 at 06:12:51PM +0530, Shashank Sharma wrote:
> From the CI builds, its been observed that during a driver
> reload/insert, dp dual mode read function sometimes fails to
> read from dual mode devices (like LSPCON) over i2c-over-aux
> channel.
> 
> This patch:
> - adds some delay and few retries, allowing a scope for these
>   devices to settle down and respond.
> - changes one error log's level from ERROR->DEBUG as we want
>   to call it an error only after all the retries are exhausted.
> 
> V2: Addressed review comments from Jani (for loop for retry)
> 
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/drm_dp_dual_mode_helper.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> index 80e62f6..09bf962 100644
> --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c
> @@ -75,8 +75,16 @@ ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter,
>  		},
>  	};
>  	int ret;
> +	int retry;
> +
> +	for (retry = 0; retry < 6; retry++) {
> +		if (retry)
> +			usleep_range(500, 1000);
> +		ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs));
> +		if (ret > 0)

I think the ret == 0 case should be handled with the rest of
partial-read cases (which we check against further down). So the above
should be
		if (ret >= 0)

With this fixed it looks ok to me, so fwiw:
Reviewed-by: Imre Deak <imre.deak@intel.com>

Note that ideally we wouldn't retry for error returns like
-ENOTSUPPORTED, -ENOMEM, -E2BIG, but it's not a big deal to do that
either. One possibility to solving that and also making this workaround
more generic is to reuse the existing retry logic in __i2c_transfer() by
making it retry in all relevant error cases (timeout/IO) and setting
i2c_adapter::retries for the LSPCON adaptor. But that can be done as a
follow-up.

> +			break;
> +	}
>  
> -	ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs));
>  	if (ret < 0)
>  		return ret;
>  	if (ret != ARRAY_SIZE(msgs))
> @@ -420,7 +428,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
>  	ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
>  				    &data, sizeof(data));
>  	if (ret < 0) {
> -		DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
> +		DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
>  		return -EFAULT;
>  	}
>  
> -- 
> 2.7.4
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-08-24 11:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-22 16:11 [PATCH 0/2] Add retries for dp dual mode reads Shashank Sharma
2017-08-22 16:11 ` [PATCH 1/2] drm: Add retries for dp dual mode read Shashank Sharma
2017-08-23 11:59   ` Jani Nikula
2017-08-23 12:42     ` [PATCH v2 " Shashank Sharma
2017-08-24 11:49       ` Imre Deak [this message]
2017-08-24 12:10         ` Sharma, Shashank
2017-08-24 12:19           ` Imre Deak
2017-08-24 12:20             ` Sharma, Shashank
2017-08-24 13:23             ` [PATCH v3 " Shashank Sharma
2017-08-24 14:08               ` Ville Syrjälä
2017-08-28  5:50                 ` Sharma, Shashank
2017-08-24 15:47               ` Manasi Navare
2017-08-22 16:11 ` [PATCH 2/2] drm/i915: Don't give up waiting on INVALID_MODE Shashank Sharma
2017-08-22 17:19 ` ✓ Fi.CI.BAT: success for Add retries for dp dual mode reads Patchwork
2017-08-23 12:58 ` ✓ Fi.CI.BAT: success for Add retries for dp dual mode reads (rev2) Patchwork
2017-08-24 14:30 ` ✗ Fi.CI.BAT: failure for Add retries for dp dual mode reads (rev3) Patchwork
2017-08-25  6:56 ` Patchwork
2017-08-25  9:27 ` Patchwork
2017-08-25 10:39 ` ✓ Fi.CI.BAT: success " Patchwork
2017-08-25 11:36 ` ✗ Fi.CI.IGT: failure " 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=20170824114955.5nu5uop2xcnxudvw@ideak-desk.fi.intel.com \
    --to=imre.deak@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=shashank.sharma@intel.com \
    /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.