From 49c776b5b78462ae2118fca240f7fb5df7dc444c Mon Sep 17 00:00:00 2001 From: Todd Broch Date: Thu, 20 Apr 2017 09:08:15 -0700 Subject: [PATCH] pd: Ignore Augmented PDOs when choosing PDO to request. Augmented PDOs are part of the PD3.0 specification. As present USB PD sinks can't support these PDO types we need to ignore them. BRANCH=samus,glados,oak,gru,reef BUG=b:37476637 TEST=manual, On samus, plug-in blackcat (EVT) charger and see it ignore these Augmented PDOs when making its PDO request. Change-Id: I28a0377e1486368f25f37cad640af71244a4c30b Reviewed-on: https://chromium-review.googlesource.com/484687 Commit-Ready: Todd Broch Tested-by: Todd Broch Reviewed-by: Benson Leung Reviewed-by: Vincent Palatin --- common/usb_pd_policy.c | 4 ++++ include/usb_pd.h | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/common/usb_pd_policy.c b/common/usb_pd_policy.c index 568169fbbf..62f9ecbfa5 100644 --- a/common/usb_pd_policy.c +++ b/common/usb_pd_policy.c @@ -106,6 +106,10 @@ static int pd_find_pdo_index(int cnt, uint32_t *src_caps, int max_mv) /* Get max power that is under our max voltage input */ for (i = 0; i < cnt; i++) { + /* its an unsupported Augmented PDO (PD3.0) */ + if ((src_caps[i] & PDO_TYPE_MASK) == PDO_TYPE_AUGMENTED) + continue; + mv = ((src_caps[i] >> 10) & 0x3FF) * 50; /* Skip invalid voltage */ if (!mv) diff --git a/include/usb_pd.h b/include/usb_pd.h index 01b4ed5358..4f7ce8c52b 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -57,11 +57,14 @@ enum pd_rx_errors { * if present shall be sent in Minimum Voltage order; lowest to highest. * 4. The Variable Supply (non battery) Objects, * if present, shall be sent in Minimum Voltage order; lowest to highest. + * 5. (PD3.0) The Augmented PDO is defined to allow extension beyond the 4 PDOs + * above by examining bits <29:28> to determine the additional PDO function. */ -#define PDO_TYPE_FIXED (0 << 30) -#define PDO_TYPE_BATTERY (1 << 30) -#define PDO_TYPE_VARIABLE (2 << 30) -#define PDO_TYPE_MASK (3 << 30) +#define PDO_TYPE_FIXED (0 << 30) +#define PDO_TYPE_BATTERY (1 << 30) +#define PDO_TYPE_VARIABLE (2 << 30) +#define PDO_TYPE_AUGMENTED (3 << 30) +#define PDO_TYPE_MASK (3 << 30) #define PDO_FIXED_DUAL_ROLE (1 << 29) /* Dual role device */ #define PDO_FIXED_SUSPEND (1 << 28) /* USB Suspend supported */