Message ID | 20210202093342.738691-4-kyletso@google.com |
---|---|
State | New |
Headers | show |
Series | common SVDM version and VDO from dt | expand |
On 2/2/21 1:33 AM, Kyle Tso wrote: > PD Rev 3.0 introduces SVDM Version 2.0. This patch makes the field > configuable in the header in order to be able to be compatible with > older SVDM version. > > Signed-off-by: Kyle Tso <kyletso@google.com> > --- > include/linux/usb/pd_vdo.h | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h > index e9b6822c54c2..69ed6929ce6e 100644 > --- a/include/linux/usb/pd_vdo.h > +++ b/include/linux/usb/pd_vdo.h > @@ -21,22 +21,24 @@ > * ---------- > * <31:16> :: SVID > * <15> :: VDM type ( 1b == structured, 0b == unstructured ) > - * <14:13> :: Structured VDM version (can only be 00 == 1.0 currently) > + * <14:13> :: Structured VDM version > * <12:11> :: reserved > * <10:8> :: object position (1-7 valid ... used for enter/exit mode only) > * <7:6> :: command type (SVDM only?) > * <5> :: reserved (SVDM), command type (UVDM) > * <4:0> :: command > */ > -#define VDO(vid, type, custom) \ > +#define VDO(vid, type, ver, custom) \ > (((vid) << 16) | \ > ((type) << 15) | \ > + ((ver) << 13) | \ > ((custom) & 0x7FFF)) > Yu have to fix all users of VDO() as well, or the code will no longer compile after this patch. Guenter > #define VDO_SVDM_TYPE (1 << 15) > #define VDO_SVDM_VERS(x) ((x) << 13) > #define VDO_OPOS(x) ((x) << 8) > #define VDO_CMDT(x) ((x) << 6) > +#define VDO_SVDM_VERS_MASK VDO_SVDM_VERS(0x3) > #define VDO_OPOS_MASK VDO_OPOS(0x7) > #define VDO_CMDT_MASK VDO_CMDT(0x3) > > @@ -74,6 +76,7 @@ > > #define PD_VDO_VID(vdo) ((vdo) >> 16) > #define PD_VDO_SVDM(vdo) (((vdo) >> 15) & 1) > +#define PD_VDO_SVDM_VER(vdo) (((vdo) >> 13) & 0x3) > #define PD_VDO_OPOS(vdo) (((vdo) >> 8) & 0x7) > #define PD_VDO_CMD(vdo) ((vdo) & 0x1f) > #define PD_VDO_CMDT(vdo) (((vdo) >> 6) & 0x3) >
diff --git a/include/linux/usb/pd_vdo.h b/include/linux/usb/pd_vdo.h index e9b6822c54c2..69ed6929ce6e 100644 --- a/include/linux/usb/pd_vdo.h +++ b/include/linux/usb/pd_vdo.h @@ -21,22 +21,24 @@ * ---------- * <31:16> :: SVID * <15> :: VDM type ( 1b == structured, 0b == unstructured ) - * <14:13> :: Structured VDM version (can only be 00 == 1.0 currently) + * <14:13> :: Structured VDM version * <12:11> :: reserved * <10:8> :: object position (1-7 valid ... used for enter/exit mode only) * <7:6> :: command type (SVDM only?) * <5> :: reserved (SVDM), command type (UVDM) * <4:0> :: command */ -#define VDO(vid, type, custom) \ +#define VDO(vid, type, ver, custom) \ (((vid) << 16) | \ ((type) << 15) | \ + ((ver) << 13) | \ ((custom) & 0x7FFF)) #define VDO_SVDM_TYPE (1 << 15) #define VDO_SVDM_VERS(x) ((x) << 13) #define VDO_OPOS(x) ((x) << 8) #define VDO_CMDT(x) ((x) << 6) +#define VDO_SVDM_VERS_MASK VDO_SVDM_VERS(0x3) #define VDO_OPOS_MASK VDO_OPOS(0x7) #define VDO_CMDT_MASK VDO_CMDT(0x3) @@ -74,6 +76,7 @@ #define PD_VDO_VID(vdo) ((vdo) >> 16) #define PD_VDO_SVDM(vdo) (((vdo) >> 15) & 1) +#define PD_VDO_SVDM_VER(vdo) (((vdo) >> 13) & 0x3) #define PD_VDO_OPOS(vdo) (((vdo) >> 8) & 0x7) #define PD_VDO_CMD(vdo) ((vdo) & 0x1f) #define PD_VDO_CMDT(vdo) (((vdo) >> 6) & 0x3)
PD Rev 3.0 introduces SVDM Version 2.0. This patch makes the field configuable in the header in order to be able to be compatible with older SVDM version. Signed-off-by: Kyle Tso <kyletso@google.com> --- include/linux/usb/pd_vdo.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)