summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/usb_pd_protocol.c8
-rw-r--r--common/usbc/usb_pd_console.c6
-rw-r--r--include/usb_pd.h12
3 files changed, 24 insertions, 2 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index d01299339c..37c6803a7d 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -5098,6 +5098,11 @@ static int command_pd(int argc, char **argv)
}
#endif
#endif
+ else if (!strcasecmp(argv[1], "version")) {
+ ccprintf("%d\n", PD_STACK_VERSION);
+ return EC_SUCCESS;
+ }
+
/* command: pd <port> <subcmd> [args] */
port = strtoi(argv[1], &e, 10);
if (argc < 3)
@@ -5264,7 +5269,8 @@ static int command_pd(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(pd, command_pd,
- "dump"
+ "version"
+ "|dump"
#ifdef CONFIG_USB_PD_TRY_SRC
"|trysrc"
#endif
diff --git a/common/usbc/usb_pd_console.c b/common/usbc/usb_pd_console.c
index 70b51bbf1a..bc89daca05 100644
--- a/common/usbc/usb_pd_console.c
+++ b/common/usbc/usb_pd_console.c
@@ -55,6 +55,9 @@ test_export_static int command_pd(int argc, char **argv)
ccprintf("Try.SRC Forced %s\n", ov ? "ON" : "OFF");
return EC_SUCCESS;
+ } else if (!strcasecmp(argv[1], "version")) {
+ ccprintf("%d\n", PD_STACK_VERSION);
+ return EC_SUCCESS;
}
/* command: pd <port> <subcmd> [args] */
@@ -169,7 +172,8 @@ test_export_static int command_pd(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(pd, command_pd,
- "dump [0|1|2|3]"
+ "version"
+ "\ndump [0|1|2|3]"
#ifdef CONFIG_USB_PD_TRY_SRC
"\ntrysrc [0|1|2]"
#endif
diff --git a/include/usb_pd.h b/include/usb_pd.h
index fdf19bb882..124d9ff2c6 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -527,6 +527,12 @@ struct pd_discovery {
*/
#define INVALID_MSG_ID_COUNTER 0xff
+/* PD Stack Version */
+enum pd_stack_version {
+ TCPMV1 = 1,
+ TCPMV2,
+};
+
/* Protocol revision */
enum pd_rev_type {
PD_REV10,
@@ -540,6 +546,12 @@ enum pd_rev_type {
#define PD_REVISION PD_REV20
#endif
+#if defined(CONFIG_USB_PD_TCPMV1)
+#define PD_STACK_VERSION TCPMV1
+#elif defined(CONFIG_USB_PD_TCPMV2)
+#define PD_STACK_VERSION TCPMV2
+#endif
+
/* Cable structure for storing cable attributes */
struct pd_cable {
/* Note: the following fields are used by TCPMv1 */