summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabio Baltieri <fabiobaltieri@google.com>2021-02-23 12:51:27 +0000
committerCommit Bot <commit-bot@chromium.org>2021-02-23 16:45:56 +0000
commit136b94b135c584c63673a1f3806ddd9ea5dbf8ac (patch)
treee8d3c8751157c48e33293b98f7253dfefacebe0e
parentd12c7a6c24fee895d16372036c95b1dda2590cad (diff)
downloadchrome-ec-136b94b135c584c63673a1f3806ddd9ea5dbf8ac.tar.gz
zephyr: add PD console command support
This adds support for actually building the code for "ec" and "pdcable" commands. The matching config were enabled, but the file was left out of the build. BRANCH=none BUG=b:177604307 TEST=tested the commands on volteer Change-Id: I996f4a4ab99f8ed36b090c8b7ffa3d8d0bee63dc Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2712968 Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r--zephyr/CMakeLists.txt2
-rw-r--r--zephyr/Kconfig.usbc12
-rw-r--r--zephyr/shim/include/config_chip.h5
3 files changed, 19 insertions, 0 deletions
diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt
index 69daa02ca9..8a7359ec65 100644
--- a/zephyr/CMakeLists.txt
+++ b/zephyr/CMakeLists.txt
@@ -303,6 +303,8 @@ zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_ALT_MODE_UFP
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_DUAL_ROLE
"${PLATFORM_EC}/common/usb_pd_dual_role.c")
+zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_CONSOLE_CMD
+ "${PLATFORM_EC}/common/usb_pd_console_cmd.c")
zephyr_sources_ifdef(CONFIG_PLATFORM_EC_USB_PD_HOST_CMD
"${PLATFORM_EC}/common/usb_pd_host_cmd.c"
"${PLATFORM_EC}/common/usbc/usb_pd_host.c")
diff --git a/zephyr/Kconfig.usbc b/zephyr/Kconfig.usbc
index 0eebb5ae8f..a4eabb0fcf 100644
--- a/zephyr/Kconfig.usbc
+++ b/zephyr/Kconfig.usbc
@@ -524,8 +524,17 @@ config PLATFORM_EC_USB_PD_LOGGING
The log events are stored in a circular buffer, each one being a
struct event_log_entry.
+menuconfig PLATFORM_EC_USB_PD_CONSOLE_CMD
+ bool "Enable USB PD console commands"
+ default y if PLATFORM_EC_USB_PD_ALT_MODE_DFP
+ help
+ Enables various USB-C PD related console commands.
+
+if PLATFORM_EC_USB_PD_CONSOLE_CMD
+
config PLATFORM_EC_CMD_USB_PD_PE
bool "Console command: pe"
+ default y
help
This command dumps information about the USB PD alternate mode options
discovered from the partner device. It can be useful for debugging.
@@ -545,6 +554,7 @@ config PLATFORM_EC_CMD_USB_PD_PE
config PLATFORM_EC_CMD_USB_PD_CABLE
bool "Console command: pdcable"
+ default y
help
This commands shows the USB cable charactistics as detected from the
device. It can be useful for debugging problems with cables and the
@@ -562,6 +572,8 @@ config PLATFORM_EC_CMD_USB_PD_CABLE
Link training: Bi-directional
Thunderbolt cable type: Passive
+endif # PLATFORM_EC_USB_PD_CONSOLE_CMD
+
choice "USB-C device type"
prompt "Select the USB-C device type"
default PLATFORM_EC_USB_DRP_ACC_TRYSRC
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 54466f8236..56e0ac7ae0 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -640,6 +640,11 @@ enum battery_type {
#define CONFIG_USBC_OCP
#endif
+#undef CONFIG_USB_PD_CONSOLE_CMD
+#ifdef CONFIG_PLATFORM_EC_USB_PD_CONSOLE_CMD
+#define CONFIG_USB_PD_CONSOLE_CMD
+#endif
+
#undef CONFIG_USB_PD_HOST_CMD
#ifdef CONFIG_PLATFORM_EC_USB_PD_HOST_CMD
#define CONFIG_USB_PD_HOST_CMD