diff mbox

drm/i915: Add delay on DPCD reads

Message ID 1458041938-3279-1-git-send-email-mika.kahola@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mika Kahola March 15, 2016, 11:38 a.m. UTC
Additional 50 ms delay is needed between DPCD reads on HP Bizlink 1326
DP to VGA adapter. Having said that, I haven't noticed a need for
additional delay between DPCD reads on other DP-VGA dongles.

While at it, let's replace mdelay() with usleep_range() routine.

Signed-off-by: Mika Kahola <mika.kahola@intel.com>
---
 drivers/gpu/drm/i915/intel_dp.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Daniel Vetter March 15, 2016, 1:26 p.m. UTC | #1
On Tue, Mar 15, 2016 at 01:38:58PM +0200, Mika Kahola wrote:
> Additional 50 ms delay is needed between DPCD reads on HP Bizlink 1326
> DP to VGA adapter. Having said that, I haven't noticed a need for
> additional delay between DPCD reads on other DP-VGA dongles.
> 
> While at it, let's replace mdelay() with usleep_range() routine.
> 
> Signed-off-by: Mika Kahola <mika.kahola@intel.com>

Please don't add more hacks to our own private copy of read_wake. This
stuff needs to move into drm core, since really we can't be the only ones
who try to plug in shit dongles ;-)

Would be great to test this with an amd DP card and the exact same
connector and see what happens. Then move these read_wake hacks into the
drm_dp_dpcd_read function. Lyude is also working on something like this,
but for DP MST hubs.
-Daniel

> ---
>  drivers/gpu/drm/i915/intel_dp.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 0e326e7..ff3883c 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -3125,9 +3125,11 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
>  
>  	for (i = 0; i < 3; i++) {
>  		ret = drm_dp_dpcd_read(aux, offset, buffer, size);
> -		if (ret == size)
> +		if (ret == size) {
> +			usleep_range(50000, 50100);
>  			return ret;
> -		msleep(1);
> +		}
> +		usleep_range(1000, 1100);
>  	}
>  
>  	return ret;
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Mika Kahola March 16, 2016, 7:43 a.m. UTC | #2
On Tue, 2016-03-15 at 14:26 +0100, Daniel Vetter wrote:
> On Tue, Mar 15, 2016 at 01:38:58PM +0200, Mika Kahola wrote:
> > Additional 50 ms delay is needed between DPCD reads on HP Bizlink 1326
> > DP to VGA adapter. Having said that, I haven't noticed a need for
> > additional delay between DPCD reads on other DP-VGA dongles.
> > 
> > While at it, let's replace mdelay() with usleep_range() routine.
> > 
> > Signed-off-by: Mika Kahola <mika.kahola@intel.com>
> 
> Please don't add more hacks to our own private copy of read_wake. This
> stuff needs to move into drm core, since really we can't be the only ones
> who try to plug in shit dongles ;-)
> 
> Would be great to test this with an amd DP card and the exact same
> connector and see what happens. Then move these read_wake hacks into the
> drm_dp_dpcd_read function. Lyude is also working on something like this,
> but for DP MST hubs.

This particular DP-VGA dongle has been problematic. I have used Windows
to benchmark the performance. It takes eternity to light up the display
on Windows but the eventually the driver is able to do that.

You're right, perhaps the best place for this sort of hacks is the drm
core. 

Cheers,
Mika
 
> -Daniel
> 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 0e326e7..ff3883c 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -3125,9 +3125,11 @@ intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
> >  
> >  	for (i = 0; i < 3; i++) {
> >  		ret = drm_dp_dpcd_read(aux, offset, buffer, size);
> > -		if (ret == size)
> > +		if (ret == size) {
> > +			usleep_range(50000, 50100);
> >  			return ret;
> > -		msleep(1);
> > +		}
> > +		usleep_range(1000, 1100);
> >  	}
> >  
> >  	return ret;
> > -- 
> > 1.9.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/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 0e326e7..ff3883c 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3125,9 +3125,11 @@  intel_dp_dpcd_read_wake(struct drm_dp_aux *aux, unsigned int offset,
 
 	for (i = 0; i < 3; i++) {
 		ret = drm_dp_dpcd_read(aux, offset, buffer, size);
-		if (ret == size)
+		if (ret == size) {
+			usleep_range(50000, 50100);
 			return ret;
-		msleep(1);
+		}
+		usleep_range(1000, 1100);
 	}
 
 	return ret;