summaryrefslogtreecommitdiff
path: root/include/pwr_defs.h
diff options
context:
space:
mode:
authorJan Dabros <jsd@semihalf.com>2020-12-29 12:46:20 +0100
committerCommit Bot <commit-bot@chromium.org>2021-01-14 14:40:18 +0000
commit4ccfbe2d22b5c7f65a182dfb5bb35fe033799a2f (patch)
tree5348c7d6f1fe2ee0b87b34e95dc92e39fa39b08e /include/pwr_defs.h
parent0873122c27b50455b0618d7cf58a4e7cde4f2aef (diff)
downloadchrome-ec-4ccfbe2d22b5c7f65a182dfb5bb35fe033799a2f.tar.gz
gl3590: Add method for querying UFP connection power capabilities
GL3590's registers allow to gather information about host connection, e.g. available power. This may be used by platforms which are powered by hub's UFP. Add missing license headers. BUG=b:144776402 BRANCH=main TEST=With consecutive patch applied, verify that available input power reported by servo_v4p1 is correct. Signed-off-by: Jan Dabros <jsd@semihalf.com> Change-Id: I6a9881fe844b293800653f141c418257c6ebc4e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2606237 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'include/pwr_defs.h')
-rw-r--r--include/pwr_defs.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/pwr_defs.h b/include/pwr_defs.h
new file mode 100644
index 0000000000..c01e602397
--- /dev/null
+++ b/include/pwr_defs.h
@@ -0,0 +1,25 @@
+/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __CROS_EC_PWR_DEFS_H
+#define __CROS_EC_PWR_DEFS_H
+
+#include "system.h"
+
+struct pwr_con_t {
+ uint16_t volts;
+ uint16_t milli_amps;
+};
+
+/*
+ * Return power (in milliwatts) corresponding to input power connection
+ * struct entry.
+ */
+inline int pwr_con_to_milliwatts(struct pwr_con_t *pwr)
+{
+ return (pwr->volts * pwr->milli_amps);
+}
+
+#endif