diff options
author | Sam Hurst <shurst@google.com> | 2021-03-08 13:54:51 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-03-17 00:13:04 +0000 |
commit | c080bfcd9a47e9ed49b77fa87ad4f0ae73df2d72 (patch) | |
tree | 71b2b6034c09ce525c2daaf001687a5671230876 /common/usbc/usb_pe_drp_sm.c | |
parent | 75b35c97c65788a21c7429f9f555b9ca301ae4eb (diff) | |
download | chrome-ec-c080bfcd9a47e9ed49b77fa87ad4f0ae73df2d72.tar.gz |
TCPMV2: Add support for (CT) Vconn Powered Devices
Add support for Charge Through Vconn Powered Devices
BUG=b:165934405
BRANCH=none
TEST=make runtests
1) Verified that Apple VPD audio device worked.
2) With charger plugged into Chocodile_Vpdmcu,
verified that a Voxel could be charged.
3) FAILED: Plugging Chocodile_Vpdmcu into Voxel
first and then plugging in charger to
Chocodile_Vpdmcu, Chocodile is detected
as a Debug Accessory (CC1 = Rd and CC2 = Rd)
and VCONN is never applied.
Signed-off-by: Sam Hurst <shurst@google.com>
Change-Id: I977b316dc531aa33bb6a236523c8ddbbb23014d0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2748429
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'common/usbc/usb_pe_drp_sm.c')
-rw-r--r-- | common/usbc/usb_pe_drp_sm.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c index 46cf5fc185..14f59cf624 100644 --- a/common/usbc/usb_pe_drp_sm.c +++ b/common/usbc/usb_pe_drp_sm.c @@ -1683,12 +1683,26 @@ static void send_source_cap(int port) */ static void pe_send_request_msg(int port) { + uint32_t vpd_vdo = 0; uint32_t rdo; uint32_t curr_limit; uint32_t supply_voltage; + /* + * If we are charging through a VPD, the requested voltage and current + * might need adjusting. + */ + if ((get_usb_pd_cable_type(port) == IDH_PTYPE_VPD) && + is_vpd_ct_supported(port)) { + union vpd_vdo vpd = pd_get_am_discovery(port, + TCPC_TX_SOP_PRIME)->identity.product_t1.vpd; + + /* The raw vpd_vdo is passed to pd_build_request */ + vpd_vdo = vpd.raw_value; + } + /* Build and send request RDO */ - pd_build_request(pe[port].vpd_vdo, &rdo, &curr_limit, + pd_build_request(vpd_vdo, &rdo, &curr_limit, &supply_voltage, port); CPRINTF("C%d: Req [%d] %dmV %dmA", port, RDO_POS(rdo), @@ -2704,7 +2718,8 @@ static void pe_src_disabled_entry(int port) { print_current_state(port); - if ((pe[port].vpd_vdo >= 0) && VPD_VDO_CTS(pe[port].vpd_vdo)) { + if ((get_usb_pd_cable_type(port) == IDH_PTYPE_VPD) && + is_vpd_ct_supported(port)) { /* * Inform the Device Policy Manager that a Charge-Through VCONN * Powered Device was detected. |