intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Shashank Sharma <shashank.sharma@intel.com>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH v3 1/2] drm: Add retries for dp dual mode read
Date: Thu, 24 Aug 2017 17:08:11 +0300	[thread overview]
Message-ID: <20170824140811.GL4914@intel.com> (raw)
In-Reply-To: <1503581023-19748-1-git-send-email-shashank.sharma@intel.com>

On Thu, Aug 24, 2017 at 06:53:43PM +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)
> V3: Addressed review comments from Imre (break on partial read too)
> 
> 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..8263660 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)
> +			break;
> +	}

I can't say I really like this approach. It's going to slow down
every failed DP++ dongle detection by several millieconds. I'd prefer
that we pay that cost only for LSPCON and not for every HDMI connector.

Alternatives I discussed with Imre would be:
1) Get the i2c core to do the retries for us, but just for LSPCON
   This would require checking which error we get exactly in this failure
   case and checking of the i2c core will perform retries for tha
   particular error. If the i2c core doesn't do what we need then we
   can't use this approach
2) Raise the abstraction level on the DP++ helper and have it do the
   retries only for LSPCON. This seems like a lot of work for little
   gain
3) Just handle the retries on a higher level in LSPCON specific code

I guess 1) and 3) would be the interesting options to try.

>  
> -	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

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2017-08-24 14:08 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
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ä [this message]
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=20170824140811.GL4914@intel.com \
    --to=ville.syrjala@linux.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 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).