diff mbox

[v3,3/3] drm/i915: Add retries for LSPCON detection

Message ID 1507630064-17908-4-git-send-email-shashank.sharma@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sharma, Shashank Oct. 10, 2017, 10:07 a.m. UTC
We read the dp dual mode Adapter identifier to detect the
LSPCON device. It's been observed from the CI testing that in
few cases, this read can get delayed or fail. For such scenarios,
LSPCON vendors suggest to retry the read operation.

This patch adds retry in the probe function, while reading
LSPCON identifier.

V3: added this patch in the series

Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Imre Deak <imre.deak@intel.com>
Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
---
 drivers/gpu/drm/i915/intel_lspcon.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Imre Deak Oct. 12, 2017, 1:47 p.m. UTC | #1
On Tue, Oct 10, 2017 at 03:37:44PM +0530, Shashank Sharma wrote:
> We read the dp dual mode Adapter identifier to detect the
> LSPCON device. It's been observed from the CI testing that in
> few cases, this read can get delayed or fail. For such scenarios,
> LSPCON vendors suggest to retry the read operation.
> 
> This patch adds retry in the probe function, while reading
> LSPCON identifier.
> 
> V3: added this patch in the series
> 
> Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
> Cc: Imre Deak <imre.deak@intel.com>
> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_lspcon.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
> index 7688254..dcbc786 100644
> --- a/drivers/gpu/drm/i915/intel_lspcon.c
> +++ b/drivers/gpu/drm/i915/intel_lspcon.c
> @@ -132,6 +132,7 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
>  
>  static bool lspcon_probe(struct intel_lspcon *lspcon)
>  {
> +	int retry;
>  	enum drm_dp_dual_mode_type adaptor_type;
>  	struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc;
>  	enum drm_lspcon_mode expected_mode;
> @@ -140,10 +141,18 @@ static bool lspcon_probe(struct intel_lspcon *lspcon)
>  			DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
>  
>  	/* Lets probe the adaptor and check its type */
> -	adaptor_type = drm_dp_dual_mode_detect(adapter);
> +	for (retry = 0; retry < 6; retry++) {
> +		if (retry)
> +			usleep_range(500, 1000);
> +
> +		adaptor_type = drm_dp_dual_mode_detect(adapter);
> +		if (adaptor_type == DRM_DP_DUAL_MODE_LSPCON)

I wondered if this should be (adaptor_type != DRM_DP_DUAL_MODE_UNKNOWN),
since the other cases are not known to cause a problem. But we'll probe
LSPCON only if VBT says so and if VBT is broken we'll anyway incur the
retry overhead here. So looks ok:

Reviewed-by: Imre Deak <imre.deak@intel.com>

> +			break;
> +	}
> +
>  	if (adaptor_type != DRM_DP_DUAL_MODE_LSPCON) {
>  		DRM_DEBUG_KMS("No LSPCON detected, found %s\n",
> -			drm_dp_get_dual_mode_type_name(adaptor_type));
> +			       drm_dp_get_dual_mode_type_name(adaptor_type));
>  		return false;
>  	}
>  
> -- 
> 2.7.4
>
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_lspcon.c b/drivers/gpu/drm/i915/intel_lspcon.c
index 7688254..dcbc786 100644
--- a/drivers/gpu/drm/i915/intel_lspcon.c
+++ b/drivers/gpu/drm/i915/intel_lspcon.c
@@ -132,6 +132,7 @@  static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon)
 
 static bool lspcon_probe(struct intel_lspcon *lspcon)
 {
+	int retry;
 	enum drm_dp_dual_mode_type adaptor_type;
 	struct i2c_adapter *adapter = &lspcon_to_intel_dp(lspcon)->aux.ddc;
 	enum drm_lspcon_mode expected_mode;
@@ -140,10 +141,18 @@  static bool lspcon_probe(struct intel_lspcon *lspcon)
 			DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS;
 
 	/* Lets probe the adaptor and check its type */
-	adaptor_type = drm_dp_dual_mode_detect(adapter);
+	for (retry = 0; retry < 6; retry++) {
+		if (retry)
+			usleep_range(500, 1000);
+
+		adaptor_type = drm_dp_dual_mode_detect(adapter);
+		if (adaptor_type == DRM_DP_DUAL_MODE_LSPCON)
+			break;
+	}
+
 	if (adaptor_type != DRM_DP_DUAL_MODE_LSPCON) {
 		DRM_DEBUG_KMS("No LSPCON detected, found %s\n",
-			drm_dp_get_dual_mode_type_name(adaptor_type));
+			       drm_dp_get_dual_mode_type_name(adaptor_type));
 		return false;
 	}