From 1dee3ef51fb66a139f2dbb98f8b923199366467d Mon Sep 17 00:00:00 2001 From: Sam Hurst Date: Thu, 4 Mar 2021 14:59:44 -0800 Subject: TCPMV2: Add explicit setting of VPD VDO CT Current Add the capablility to explicity set a CTVPDs VDO current. BUG=b:165934405 BRANCH=none TEST=make runtests Verified that returned VDO from chocodile_vpdmcu was correct. Signed-off-by: Sam Hurst Change-Id: I2292024986fa89b228b56678d61d1aef2866c817 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748427 Tested-by: Sam Hurst Reviewed-by: Diana Z Commit-Queue: Sam Hurst --- include/usb_pd_vdo.h | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include/usb_pd_vdo.h') diff --git a/include/usb_pd_vdo.h b/include/usb_pd_vdo.h index 2cb1804a69..ac8e67b73e 100644 --- a/include/usb_pd_vdo.h +++ b/include/usb_pd_vdo.h @@ -526,7 +526,7 @@ union active_cable_vdo2_rev30 { * 0b - 3A capable; * 1b - 5A capable * Charge Through Support bit = 0b: Reserved, Shall be set to zero - * <14:13> : Reserved Shall be set to zero. + * <13> : Reserved Shall be set to zero. * <12:7> : VBUS Impedance * Charge Through Support bit = 1b: * Vbus impedance through the VPD in 2 mΩ increments. @@ -541,12 +541,18 @@ union active_cable_vdo2_rev30 { * 1b – the VPD supports Charge Through * 0b – the VPD does not support Charge Through */ -#define VDO_VPD(hw, fw, vbus, vbusz, gndz, cts) \ +#define VDO_VPD(hw, fw, vbus, ctc, vbusz, gndz, cts) \ (((hw) & 0xf) << 28 | ((fw) & 0xf) << 24 \ | ((vbus) & 0x3) << 15 \ + | ((ctc) & 0x1) << 14 \ | ((vbusz) & 0x3f) << 7 \ | ((gndz) & 0x3f) << 1 | (cts)) +enum vpd_ctc_support { + VPD_CT_CURRENT_3A, + VPD_CT_CURRENT_5A +}; + enum vpd_vbus { VPD_MAX_VBUS_20V, VPD_MAX_VBUS_30V, @@ -560,6 +566,7 @@ enum vpd_cts_support { }; #define VPD_VDO_MAX_VBUS(vdo) (((vdo) >> 15) & 0x3) +#define VPD_VDO_CURRENT(vdo) (((vdo) >> 14) & 1) #define VPD_VDO_VBUS_IMP(vdo) (((vdo) >> 7) & 0x3f) #define VPD_VDO_GND_IMP(vdo) (((vdo) >> 1) & 0x3f) #define VPD_VDO_CTS(vdo) ((vdo) & 1) -- cgit v1.2.1