[Intel-gfx] [PATCH] drm/i915/dp: return number of bytes written for short aux/i2c writes

Daniel Vetter daniel at ffwll.ch
Wed Mar 18 01:41:31 PDT 2015


On Tue, Mar 17, 2015 at 06:40:18PM +0200, Ville Syrjälä wrote:
> On Tue, Mar 17, 2015 at 05:18:54PM +0200, Jani Nikula wrote:
> > Allow for a larger receive data size, and check if the receiver returned
> > the number of bytes written. Without this, we've basically skipped all
> > the unwritten bytes for short writes.
> > 
> > Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> 
> Whoops :)
> 
> Looks correct to me.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

Queued for -next, thanks for the patch.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c | 11 ++++++++---
> >  1 file changed, 8 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 5256c064da05..3967af10f53c 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -951,7 +951,7 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
> >  	case DP_AUX_NATIVE_WRITE:
> >  	case DP_AUX_I2C_WRITE:
> >  		txsize = msg->size ? HEADER_SIZE + msg->size : BARE_ADDRESS_SIZE;
> > -		rxsize = 1;
> > +		rxsize = 2; /* 0 or 1 data bytes */
> >  
> >  		if (WARN_ON(txsize > 20))
> >  			return -E2BIG;
> > @@ -962,8 +962,13 @@ intel_dp_aux_transfer(struct drm_dp_aux *aux, struct drm_dp_aux_msg *msg)
> >  		if (ret > 0) {
> >  			msg->reply = rxbuf[0] >> 4;
> >  
> > -			/* Return payload size. */
> > -			ret = msg->size;
> > +			if (ret > 1) {
> > +				/* Number of bytes written in a short write. */
> > +				ret = clamp_t(int, rxbuf[1], 0, msg->size);
> > +			} else {
> > +				/* Return payload size. */
> > +				ret = msg->size;
> > +			}
> >  		}
> >  		break;
> >  
> > -- 
> > 2.1.4
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list