summaryrefslogtreecommitdiff
path: root/common/usb_pd_dual_role.c
diff options
context:
space:
mode:
authorVijay Hiremath <vijay.p.hiremath@intel.com>2020-02-11 11:47:50 -0800
committerCommit Bot <commit-bot@chromium.org>2020-02-12 20:05:33 +0000
commitd34cf65162e9b75dd4e3c929ecacdb450b5a73e5 (patch)
tree2ff6c282bc1cf1d2b62ea1f8bfe8a077f1059a3e /common/usb_pd_dual_role.c
parent7bbdd3cc90d174343cdc863515258de339f4c4dc (diff)
downloadchrome-ec-d34cf65162e9b75dd4e3c929ecacdb450b5a73e5.tar.gz
TCPMv1/v2: Move pd_get/set_max_voltage() to common file
BUG=b:148528713 BRANCH=none TEST=make buildall -j Change-Id: I6fd4c870b8821a2393c67fda7003583b91ef7f5c Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051218 Reviewed-by: Keith Short <keithshort@chromium.org>
Diffstat (limited to 'common/usb_pd_dual_role.c')
-rw-r--r--common/usb_pd_dual_role.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/usb_pd_dual_role.c b/common/usb_pd_dual_role.c
index f00b5981b9..d94d9f5e21 100644
--- a/common/usb_pd_dual_role.c
+++ b/common/usb_pd_dual_role.c
@@ -7,6 +7,24 @@
#include "usb_pd.h"
+#if defined(PD_MAX_VOLTAGE_MV) && defined(PD_OPERATING_POWER_MW)
+/*
+ * As a sink, this is the max voltage (in millivolts) we can request
+ * before getting source caps
+ */
+static unsigned int max_request_mv = PD_MAX_VOLTAGE_MV;
+
+void pd_set_max_voltage(unsigned int mv)
+{
+ max_request_mv = mv;
+}
+
+unsigned int pd_get_max_voltage(void)
+{
+ return max_request_mv;
+}
+#endif /* defined(PD_MAX_VOLTAGE_MV) && defined(PD_OPERATING_POWER_MW) */
+
int pd_charge_from_device(uint16_t vid, uint16_t pid)
{
/* TODO: rewrite into table if we get more of these */