diff mbox series

[3/5] drm/dp: Implement I2C_M_STOP for i2c-over-aux

Message ID 20180928180403.22499-3-ville.syrjala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [1/5] drm/dp/mst: Configure no_stop_bit correctly for remote i2c xfers | expand

Commit Message

Ville Syrjälä Sept. 28, 2018, 6:04 p.m. UTC
From: Ville Syrjälä <ville.syrjala@linux.intel.com>

Consult the I2C_M_STOP flag to determine whether to set the MOT bit or
not. Makes it possible to send multiple messages in one go with
stop+start generated between the messages (as opposed nothing or
repstart depending on whether thr address/rw changed).

Not sure anyone has actual use for this but figured I'd handle it
since I started to look at that flag for MST remote i2c xfers.

Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
---
 drivers/gpu/drm/drm_dp_helper.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Dhinakaran Pandiyan Dec. 11, 2018, 2:47 a.m. UTC | #1
On Fri, 2018-09-28 at 21:04 +0300, Ville Syrjala wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> 
> Consult the I2C_M_STOP flag to determine whether to set the MOT bit
> or
> not. Makes it possible to send multiple messages in one go with
> stop+start generated between the messages (as opposed nothing or
> repstart depending on whether thr address/rw changed).
> 
> Not sure anyone has actual use for this but figured I'd handle it
> since I started to look at that flag for MST remote i2c xfers.
> 
Don't see the I2C_M_STOP flag anywhere in drm_edid.c, but the change
introduced here does make sense.

Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> ---
>  drivers/gpu/drm/drm_dp_helper.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_dp_helper.c
> b/drivers/gpu/drm/drm_dp_helper.c
> index 37c01b6076ec..e85cea299d2a 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -884,7 +884,8 @@ static void drm_dp_i2c_msg_set_request(struct
> drm_dp_aux_msg *msg,
>  {
>  	msg->request = (i2c_msg->flags & I2C_M_RD) ?
>  		DP_AUX_I2C_READ : DP_AUX_I2C_WRITE;
> -	msg->request |= DP_AUX_I2C_MOT;
> +	if (!(i2c_msg->flags & I2C_M_STOP))
> +		msg->request |= DP_AUX_I2C_MOT;
>  }
>  
>  /*
Daniel Vetter Dec. 12, 2018, 10:30 a.m. UTC | #2
On Mon, Dec 10, 2018 at 06:47:00PM -0800, Dhinakaran Pandiyan wrote:
> On Fri, 2018-09-28 at 21:04 +0300, Ville Syrjala wrote:
> > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > 
> > Consult the I2C_M_STOP flag to determine whether to set the MOT bit
> > or
> > not. Makes it possible to send multiple messages in one go with
> > stop+start generated between the messages (as opposed nothing or
> > repstart depending on whether thr address/rw changed).
> > 
> > Not sure anyone has actual use for this but figured I'd handle it
> > since I started to look at that flag for MST remote i2c xfers.
> > 
> Don't see the I2C_M_STOP flag anywhere in drm_edid.c, but the change
> introduced here does make sense.

Iirc it's the i2c core library which takes an entire transaction, splits
it up, and sets the stop flag only on the very last one. Or something like
that.
-Daniel

> 
> Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > ---
> >  drivers/gpu/drm/drm_dp_helper.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_dp_helper.c
> > b/drivers/gpu/drm/drm_dp_helper.c
> > index 37c01b6076ec..e85cea299d2a 100644
> > --- a/drivers/gpu/drm/drm_dp_helper.c
> > +++ b/drivers/gpu/drm/drm_dp_helper.c
> > @@ -884,7 +884,8 @@ static void drm_dp_i2c_msg_set_request(struct
> > drm_dp_aux_msg *msg,
> >  {
> >  	msg->request = (i2c_msg->flags & I2C_M_RD) ?
> >  		DP_AUX_I2C_READ : DP_AUX_I2C_WRITE;
> > -	msg->request |= DP_AUX_I2C_MOT;
> > +	if (!(i2c_msg->flags & I2C_M_STOP))
> > +		msg->request |= DP_AUX_I2C_MOT;
> >  }
> >  
> >  /*
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjälä Dec. 12, 2018, 12:12 p.m. UTC | #3
On Wed, Dec 12, 2018 at 11:30:30AM +0100, Daniel Vetter wrote:
> On Mon, Dec 10, 2018 at 06:47:00PM -0800, Dhinakaran Pandiyan wrote:
> > On Fri, 2018-09-28 at 21:04 +0300, Ville Syrjala wrote:
> > > From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > 
> > > Consult the I2C_M_STOP flag to determine whether to set the MOT bit
> > > or
> > > not. Makes it possible to send multiple messages in one go with
> > > stop+start generated between the messages (as opposed nothing or
> > > repstart depending on whether thr address/rw changed).
> > > 
> > > Not sure anyone has actual use for this but figured I'd handle it
> > > since I started to look at that flag for MST remote i2c xfers.
> > > 
> > Don't see the I2C_M_STOP flag anywhere in drm_edid.c, but the change
> > introduced here does make sense.
> 
> Iirc it's the i2c core library which takes an entire transaction, splits
> it up, and sets the stop flag only on the very last one. Or something like
> that.

The last msg of the transfer has an implicit stop even without
the flag. The core won't add the flag for you. So the flag
is purely meant to force a stop+start between two messages
of the same transfer.

Well, it's not really specific anywhere IIRC but that's how
i2c-algo-bit behaves, and I tend to think of that one as the
defacto specification.


> -Daniel
> 
> > 
> > Reviewed-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
> > > Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> > > ---
> > >  drivers/gpu/drm/drm_dp_helper.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/gpu/drm/drm_dp_helper.c
> > > b/drivers/gpu/drm/drm_dp_helper.c
> > > index 37c01b6076ec..e85cea299d2a 100644
> > > --- a/drivers/gpu/drm/drm_dp_helper.c
> > > +++ b/drivers/gpu/drm/drm_dp_helper.c
> > > @@ -884,7 +884,8 @@ static void drm_dp_i2c_msg_set_request(struct
> > > drm_dp_aux_msg *msg,
> > >  {
> > >  	msg->request = (i2c_msg->flags & I2C_M_RD) ?
> > >  		DP_AUX_I2C_READ : DP_AUX_I2C_WRITE;
> > > -	msg->request |= DP_AUX_I2C_MOT;
> > > +	if (!(i2c_msg->flags & I2C_M_STOP))
> > > +		msg->request |= DP_AUX_I2C_MOT;
> > >  }
> > >  
> > >  /*
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c
index 37c01b6076ec..e85cea299d2a 100644
--- a/drivers/gpu/drm/drm_dp_helper.c
+++ b/drivers/gpu/drm/drm_dp_helper.c
@@ -884,7 +884,8 @@  static void drm_dp_i2c_msg_set_request(struct drm_dp_aux_msg *msg,
 {
 	msg->request = (i2c_msg->flags & I2C_M_RD) ?
 		DP_AUX_I2C_READ : DP_AUX_I2C_WRITE;
-	msg->request |= DP_AUX_I2C_MOT;
+	if (!(i2c_msg->flags & I2C_M_STOP))
+		msg->request |= DP_AUX_I2C_MOT;
 }
 
 /*