diff mbox

[8/9] drm/dp: Export AUX_RETRY_INTERVAL

Message ID 20180127024923.3093-8-dhinakaran.pandiyan@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dhinakaran Pandiyan Jan. 27, 2018, 2:49 a.m. UTC
Drivers can use this in their retry loops too.

Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 12 +++++-------
 include/drm/drm_dp_helper.h     |  2 ++
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Rodrigo Vivi Feb. 1, 2018, 7:04 a.m. UTC | #1
On Sat, Jan 27, 2018 at 02:49:22AM +0000, Dhinakaran Pandiyan wrote:
> Drivers can use this in their retry loops too.

with all this layers of retries it is good that we find some consistency somewhere

is this written down on any part of eDP spec?
Last time I saw there was different retries values on different cases.
So I'm afraid this here would confuse instead of helping.

> 
> Cc: dri-devel@lists.freedesktop.org
> Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 12 +++++-------
>  include/drm/drm_dp_helper.h     |  2 ++
>  2 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
> index ffe14ec3e7f2..0a7c8d6e7d8c 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -169,8 +169,6 @@ int drm_dp_bw_code_to_link_rate(u8 link_bw)
>  }
>  EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate);
>  
> -#define AUX_RETRY_INTERVAL 500 /* us */
> -
>  /**
>   * DOC: dp helpers
>   *
> @@ -206,8 +204,8 @@ static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
>  	 */
>  	for (retry = 0; retry < 32; retry++) {
>  		if (ret != 0 && ret != -ETIMEDOUT) {
> -			usleep_range(AUX_RETRY_INTERVAL,
> -				     AUX_RETRY_INTERVAL + 100);
> +			usleep_range(DP_AUX_RETRY_INTERVAL,
> +				     DP_AUX_RETRY_INTERVAL + 100);
>  		}
>  
>  		ret = aux->transfer(aux, &msg);
> @@ -718,7 +716,7 @@ static int drm_dp_i2c_retry_count(const struct drm_dp_aux_msg *msg,
>  		drm_dp_aux_reply_duration(msg);
>  	int i2c_time_us = drm_dp_i2c_msg_duration(msg, i2c_speed_khz);
>  
> -	return DIV_ROUND_UP(i2c_time_us, aux_time_us + AUX_RETRY_INTERVAL);
> +	return DIV_ROUND_UP(i2c_time_us, aux_time_us + DP_AUX_RETRY_INTERVAL);
>  }
>  
>  /*
> @@ -795,7 +793,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
>  			 * For now just defer for long enough to hopefully be
>  			 * safe for all use-cases.
>  			 */
> -			usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);
> +			usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100);
>  			continue;
>  
>  		default:
> @@ -827,7 +825,7 @@ static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
>  			aux->i2c_defer_count++;
>  			if (defer_i2c < 7)
>  				defer_i2c++;
> -			usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);
> +			usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100);
>  			drm_dp_i2c_msg_write_status_update(msg);
>  
>  			continue;
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index c239e6e24a10..2eae1aed2d26 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -61,6 +61,8 @@
>  #define DP_AUX_I2C_REPLY_DEFER		(0x2 << 2)
>  #define DP_AUX_I2C_REPLY_MASK		(0x3 << 2)
>  
> +#define DP_AUX_RETRY_INTERVAL		500 /* us */
> +
>  /* AUX CH addresses */
>  /* DPCD */
>  #define DP_DPCD_REV                         0x000
> -- 
> 2.14.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index ffe14ec3e7f2..0a7c8d6e7d8c 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -169,8 +169,6 @@  int drm_dp_bw_code_to_link_rate(u8 link_bw)
 }
 EXPORT_SYMBOL(drm_dp_bw_code_to_link_rate);
 
-#define AUX_RETRY_INTERVAL 500 /* us */
-
 /**
  * DOC: dp helpers
  *
@@ -206,8 +204,8 @@  static int drm_dp_dpcd_access(struct drm_dp_aux *aux, u8 request,
 	 */
 	for (retry = 0; retry < 32; retry++) {
 		if (ret != 0 && ret != -ETIMEDOUT) {
-			usleep_range(AUX_RETRY_INTERVAL,
-				     AUX_RETRY_INTERVAL + 100);
+			usleep_range(DP_AUX_RETRY_INTERVAL,
+				     DP_AUX_RETRY_INTERVAL + 100);
 		}
 
 		ret = aux->transfer(aux, &msg);
@@ -718,7 +716,7 @@  static int drm_dp_i2c_retry_count(const struct drm_dp_aux_msg *msg,
 		drm_dp_aux_reply_duration(msg);
 	int i2c_time_us = drm_dp_i2c_msg_duration(msg, i2c_speed_khz);
 
-	return DIV_ROUND_UP(i2c_time_us, aux_time_us + AUX_RETRY_INTERVAL);
+	return DIV_ROUND_UP(i2c_time_us, aux_time_us + DP_AUX_RETRY_INTERVAL);
 }
 
 /*
@@ -795,7 +793,7 @@  static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 			 * For now just defer for long enough to hopefully be
 			 * safe for all use-cases.
 			 */
-			usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);
+			usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100);
 			continue;
 
 		default:
@@ -827,7 +825,7 @@  static int drm_dp_i2c_do_msg(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
 			aux->i2c_defer_count++;
 			if (defer_i2c < 7)
 				defer_i2c++;
-			usleep_range(AUX_RETRY_INTERVAL, AUX_RETRY_INTERVAL + 100);
+			usleep_range(DP_AUX_RETRY_INTERVAL, DP_AUX_RETRY_INTERVAL + 100);
 			drm_dp_i2c_msg_write_status_update(msg);
 
 			continue;
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index c239e6e24a10..2eae1aed2d26 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -61,6 +61,8 @@ 
 #define DP_AUX_I2C_REPLY_DEFER		(0x2 << 2)
 #define DP_AUX_I2C_REPLY_MASK		(0x3 << 2)
 
+#define DP_AUX_RETRY_INTERVAL		500 /* us */
+
 /* AUX CH addresses */
 /* DPCD */
 #define DP_DPCD_REV                         0x000