usb: pd: Add helper macro to get Type C cable speed
authorUtkarsh Patel <utkarsh.h.patel@intel.com>
Wed, 20 Sep 2023 02:32:41 +0000 (19:32 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Oct 2023 11:58:59 +0000 (13:58 +0200)
Added a helper macro to get the Type C cable speed when provided the
cable VDO.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Link: https://lore.kernel.org/r/20230920023243.2494410-4-utkarsh.h.patel@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
include/linux/usb/pd_vdo.h

index b057250704e898d7a97a82d8b78e774e247b9e0f..3a747938cdab499ad77607aebfbddb38a0c09026 100644 (file)
         | ((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)
 
 /*