diff mbox

[v3,2/7] drm/i915/dp: Use intel_dp_aux_wait_done() to wait for previous aux xfer

Message ID 20180517222118.14246-2-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Souza, Jose May 17, 2018, 10:21 p.m. UTC
This reduces the spaghetti that intel_dp_aux_xfer() and reuses code.
The only difference is that now it will wait up to 10ms instead of
3ms.

Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

Comments

Dhinakaran Pandiyan June 6, 2018, 11:47 p.m. UTC | #1
On Thursday, May 17, 2018 3:21:13 PM PDT José Roberto de Souza wrote:
> This reduces the spaghetti that intel_dp_aux_xfer() and reuses code.
> The only difference is that now it will wait up to 10ms instead of
> 3ms.
> 
> Cc: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/i915/intel_dp.c | 20 +++-----------------
>  1 file changed, 3 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c
> b/drivers/gpu/drm/i915/intel_dp.c index 2cc58596ff5a..b86da48fd38e 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -1102,23 +1102,9 @@ intel_dp_aux_xfer(struct intel_dp *intel_dp,
>  	intel_dp_check_edp(intel_dp);
> 
>  	/* Try to wait for any previous AUX channel activity */
> -	for (try = 0; try < 3; try++) {
> -		status = I915_READ_NOTRACE(ch_ctl);
> -		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
> -			break;
> -		msleep(1);
> -	}
> -
> -	if (try == 3) {
> -		static u32 last_status = -1;
> -		const u32 status = I915_READ(ch_ctl);
> -
> -		if (status != last_status) {
> -			WARN(1, "dp_aux_ch not started status 0x%08x\n",
> -			     status);
> -			last_status = status;
> -		}
> -
> +	status = intel_dp_aux_wait_done(intel_dp, has_aux_irq);
Isn't intel_dp_aux_wait_done(intel_dp, false) better? Assuming busy bit is set 
for HW initiated AUX transactions, the current behavior of polling for idle is 
better. 

> +	if (status & DP_AUX_CH_CTL_SEND_BUSY) {
> +		DRM_WARN("dp_aux_ch not started status 0x%08x\n", status);

Retain the current code to avoid log spam and fix it in a second patch with a 
per AUX channel flag?

>  		ret = -EBUSY;
>  		goto out;
>  	}
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 2cc58596ff5a..b86da48fd38e 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -1102,23 +1102,9 @@  intel_dp_aux_xfer(struct intel_dp *intel_dp,
 	intel_dp_check_edp(intel_dp);
 
 	/* Try to wait for any previous AUX channel activity */
-	for (try = 0; try < 3; try++) {
-		status = I915_READ_NOTRACE(ch_ctl);
-		if ((status & DP_AUX_CH_CTL_SEND_BUSY) == 0)
-			break;
-		msleep(1);
-	}
-
-	if (try == 3) {
-		static u32 last_status = -1;
-		const u32 status = I915_READ(ch_ctl);
-
-		if (status != last_status) {
-			WARN(1, "dp_aux_ch not started status 0x%08x\n",
-			     status);
-			last_status = status;
-		}
-
+	status = intel_dp_aux_wait_done(intel_dp, has_aux_irq);
+	if (status & DP_AUX_CH_CTL_SEND_BUSY) {
+		DRM_WARN("dp_aux_ch not started status 0x%08x\n", status);
 		ret = -EBUSY;
 		goto out;
 	}