summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-08-14 16:14:04 -0600
committerCommit Bot <commit-bot@chromium.org>2020-11-05 21:53:31 +0000
commit1baff54e05a5d2f9179615f717e3514d37a594cb (patch)
treeac4552c683b98214530e00df46835bac3f0a4878 /include/usb_pd.h
parent5ed63c8607fe6b58bfeb5ab1580d2c1585250846 (diff)
downloadchrome-ec-1baff54e05a5d2f9179615f717e3514d37a594cb.tar.gz
TCPMv2: Correct battery index detection
The battery index is located in the first byte after the extended header, which is not passed up to the PE layer. Additionally, the PRL will start copying the message from byte 0 so correct the extended message population. Add condition to fill in a valid response if the battery is not currently present, and correct the battery status response initialization. BRANCH=None BUG=b:161837550 TEST=with GRL-C2, invalid battery index tests pass Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I65ebe56f197b9822a42463f8d9dfb42b34c1ffe1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2357517 Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 01c061c8db..055008efd3 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -1116,7 +1116,17 @@ enum pd_ctrl_msg_type {
#define BSDO_DISCHARGING BIT(10)
#define BSDO_IDLE BIT(11)
-/* Get Battery Cap Message fields for REV 3.0 */
+/* Battery Capability offsets for 16-bit array indexes */
+#define BCDB_VID 0
+#define BCDB_PID 1
+#define BCDB_DESIGN_CAP 2
+#define BCDB_FULL_CAP 3
+#define BCDB_BATT_TYPE 4
+
+/*
+ * Get Battery Cap Message fields for REV 3.0 (assumes extended header is
+ * present in first two bytes)
+ */
#define BATT_CAP_REF(n) (((n) >> 16) & 0xff)
/* Extended message type for REV 3.0 */