summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/build.mk1
-rw-r--r--common/usb_pd_alt_mode_ufp.c22
2 files changed, 23 insertions, 0 deletions
diff --git a/common/build.mk b/common/build.mk
index 9b20fc1369..1acc35347b 100644
--- a/common/build.mk
+++ b/common/build.mk
@@ -162,6 +162,7 @@ common-$(CONFIG_USB_PD_HOST_CMD)+=usb_pd_host_cmd.o
common-$(CONFIG_USB_PD_CONSOLE_CMD)+=usb_pd_console_cmd.o
endif
common-$(CONFIG_USB_PD_ALT_MODE_DFP)+=usb_pd_alt_mode_dfp.o
+common-$(CONFIG_USB_PD_ALT_MODE_UFP)+=usb_pd_alt_mode_ufp.o
common-$(CONFIG_USB_PD_LOGGING)+=event_log.o pd_log.o
common-$(CONFIG_USB_PD_TCPC)+=usb_pd_tcpc.o
common-$(CONFIG_USB_UPDATE)+=usb_update.o update_fw.o
diff --git a/common/usb_pd_alt_mode_ufp.c b/common/usb_pd_alt_mode_ufp.c
new file mode 100644
index 0000000000..3db60166d2
--- /dev/null
+++ b/common/usb_pd_alt_mode_ufp.c
@@ -0,0 +1,22 @@
+/* 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.
+ *
+ * Alternate Mode Upstream Facing Port (UFP) USB-PD module.
+ */
+#include "usb_pd.h"
+#include "usb_tbt_alt_mode.h"
+
+static uint32_t ufp_enter_mode[CONFIG_USB_PD_PORT_MAX_COUNT];
+
+/* Save port partner's enter mode message */
+void pd_ufp_set_enter_mode(int port, uint32_t *payload)
+{
+ ufp_enter_mode[port] = payload[1];
+}
+
+/* Return port partner's enter mode message */
+uint32_t pd_ufp_get_enter_mode(int port)
+{
+ return ufp_enter_mode[port];
+}