diff mbox series

[v2,3/5] usb: pd: Add helper macro to get Type C cable speed

Message ID 20230830223950.1360865-4-utkarsh.h.patel@intel.com (mailing list archive)
State Superseded
Headers show
Series Displayport Alternate Mode 2.1 Support | expand

Commit Message

Patel, Utkarsh H Aug. 30, 2023, 10:39 p.m. UTC
Added a helper macro to get the Type C cable speed when provided the
cable VDO.

Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
---
Changes in v2:
- This change is being added as new patch in this series.

 include/linux/usb/pd_vdo.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Heikki Krogerus Sept. 4, 2023, 7:08 a.m. UTC | #1
On Wed, Aug 30, 2023 at 03:39:48PM -0700, Utkarsh Patel wrote:
> Added a helper macro to get the Type C cable speed when provided the
> cable VDO.
> 
> Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Changes in v2:
> - This change is being added as new patch in this series.
> 
>  include/linux/usb/pd_vdo.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h
> index b057250704e8..3a747938cdab 100644
> --- a/include/linux/usb/pd_vdo.h
> +++ b/include/linux/usb/pd_vdo.h
> @@ -376,6 +376,7 @@
>  	 | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5	\
>  	 | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7))
>  
> +#define VDO_TYPEC_CABLE_SPEED(vdo)	((vdo) & 0x7)
>  #define VDO_TYPEC_CABLE_TYPE(vdo)	(((vdo) >> 18) & 0x3)
>  
>  /*
> -- 
> 2.25.1
Heikki Krogerus Sept. 4, 2023, 7:11 a.m. UTC | #2
On Mon, Sep 04, 2023 at 10:08:42AM +0300, Heikki Krogerus wrote:
> On Wed, Aug 30, 2023 at 03:39:48PM -0700, Utkarsh Patel wrote:
> > Added a helper macro to get the Type C cable speed when provided the
> > cable VDO.
> > 
> > Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
> 
> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> > ---
> > Changes in v2:
> > - This change is being added as new patch in this series.
> > 
> >  include/linux/usb/pd_vdo.h | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h
> > index b057250704e8..3a747938cdab 100644
> > --- a/include/linux/usb/pd_vdo.h
> > +++ b/include/linux/usb/pd_vdo.h
> > @@ -376,6 +376,7 @@
> >  	 | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5	\
> >  	 | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7))
> >  
> > +#define VDO_TYPEC_CABLE_SPEED(vdo)	((vdo) & 0x7)
> >  #define VDO_TYPEC_CABLE_TYPE(vdo)	(((vdo) >> 18) & 0x3)

Hold on! You are not using this anywhere in the patch set?

Since this is just a helper, I think it would be appropriate to
introduce it together with a user for it.

thanks,
Patel, Utkarsh H Sept. 5, 2023, 11:47 p.m. UTC | #3
Hi Heikki,

Thank you for the review.

> -----Original Message-----
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Sent: Monday, September 4, 2023 12:12 AM
> To: Patel, Utkarsh H <utkarsh.h.patel@intel.com>
> Cc: linux-kernel@vger.kernel.org; linux-usb@vger.kernel.org;
> pmalani@chromium.org; chrome-platform@lists.linux.dev;
> andriy.shevchenko@linux.intel.com; bleung@chromium.org
> Subject: Re: [PATCH v2 3/5] usb: pd: Add helper macro to get Type C cable
> speed
> 
> On Mon, Sep 04, 2023 at 10:08:42AM +0300, Heikki Krogerus wrote:
> > On Wed, Aug 30, 2023 at 03:39:48PM -0700, Utkarsh Patel wrote:
> > > Added a helper macro to get the Type C cable speed when provided the
> > > cable VDO.
> > >
> > > Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
> >
> > Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > > ---
> > > Changes in v2:
> > > - This change is being added as new patch in this series.
> > >
> > >  include/linux/usb/pd_vdo.h | 1 +
> > >  1 file changed, 1 insertion(+)
> > >
> > > diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h
> > > index b057250704e8..3a747938cdab 100644
> > > --- a/include/linux/usb/pd_vdo.h
> > > +++ b/include/linux/usb/pd_vdo.h
> > > @@ -376,6 +376,7 @@
> > >  	 | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5
> 	\
> > >  	 | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7))
> > >
> > > +#define VDO_TYPEC_CABLE_SPEED(vdo)	((vdo) & 0x7)
> > >  #define VDO_TYPEC_CABLE_TYPE(vdo)	(((vdo) >> 18) & 0x3)
> 
> Hold on! You are not using this anywhere in the patch set?
> 
> Since this is just a helper, I think it would be appropriate to introduce it
> together with a user for it.
> 

Ack. 

Sincerely,
Utkarsh Patel.
diff mbox series

Patch

diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h
index b057250704e8..3a747938cdab 100644
--- a/include/linux/usb/pd_vdo.h
+++ b/include/linux/usb/pd_vdo.h
@@ -376,6 +376,7 @@ 
 	 | ((vbm) & 0x3) << 9 | (sbu) << 8 | (sbut) << 7 | ((cur) & 0x3) << 5	\
 	 | (vbt) << 4 | (sopp) << 3 | ((spd) & 0x7))
 
+#define VDO_TYPEC_CABLE_SPEED(vdo)	((vdo) & 0x7)
 #define VDO_TYPEC_CABLE_TYPE(vdo)	(((vdo) >> 18) & 0x3)
 
 /*