diff options
author | Keith Short <keithshort@chromium.org> | 2020-06-08 16:52:39 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-06-09 05:59:16 +0000 |
commit | 6de5b403a1e82cd171d52f26cec03c2beb5ed367 (patch) | |
tree | 689e40e498561f4e2cf083b87aa97dc6d64ecf51 | |
parent | 7766098000110567b5e551a05b5d91ef85b29f3c (diff) | |
download | chrome-ec-6de5b403a1e82cd171d52f26cec03c2beb5ed367.tar.gz |
tcpmv1: Add CONFIG_USB_PD_TCPMV1_DEBUG option
Several legacy boards are consistently running out of flash space. Add
CONFIG_USB_PD_TCPMV1_DEBUG option which can be disabled on a board to
save about 900 bytes of flash space in the RO and RW images.
BUG=none
BRANCH=none
TEST=make buildall
TEST=Verify Volteer board runs with CONFIG_USB_PD_TCPMV1_DEBUG disabled
and the PD debug level set to 1. Also run the "pd <port> state" command
and verify no side effects.
Signed-off-by: Keith Short <keithshort@chromium.org>
Change-Id: I29bb70b7d347d8c6d5797c01ed892329d90aa671
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2236629
Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
-rw-r--r-- | common/usb_pd_protocol.c | 11 | ||||
-rw-r--r-- | include/config.h | 6 |
2 files changed, 12 insertions, 5 deletions
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 032e559199..a82c2b79d0 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -283,7 +283,7 @@ static struct pd_protocol { uint64_t hard_reset_complete_timer; } pd[CONFIG_USB_PD_PORT_MAX_COUNT]; -#ifdef CONFIG_COMMON_RUNTIME +#ifdef CONFIG_USB_PD_TCPMV1_DEBUG static const char * const pd_state_names[] = { "DISABLED", "SUSPENDED", "SNK_DISCONNECTED", "SNK_DISCONNECTED_DEBOUNCE", @@ -836,10 +836,12 @@ static inline void set_state(int port, enum pd_states next_state) disable_sleep(SLEEP_MASK_USB_PD); #endif +#ifdef CONFIG_USB_PD_TCPMV1_DEBUG if (debug_level > 0) CPRINTF("C%d st%d %s\n", port, next_state, pd_state_names[next_state]); else +#endif CPRINTF("C%d st%d\n", port, next_state); } @@ -2568,11 +2570,11 @@ uint8_t pd_get_task_state(int port) const char *pd_get_task_state_name(int port) { -#ifdef CONFIG_COMMON_RUNTIME +#ifdef CONFIG_USB_PD_TCPMV1_DEBUG if (debug_level > 0) return pd_state_names[pd[port].task_state]; #endif - return NULL; + return ""; } bool pd_get_vconn_state(int port) @@ -5263,8 +5265,7 @@ static int command_pd(int argc, char **argv) pd[port].data_role == PD_ROLE_DFP ? "DFP" : "UFP", (pd[port].flags & PD_FLAGS_VCONN_ON) ? "-VC" : "", pd[port].task_state, - debug_level > 0 ? - pd_state_names[pd[port].task_state] : "", + debug_level > 0 ? pd_get_task_state_name(port) : "", pd[port].flags); } else { return EC_ERROR_PARAM1; diff --git a/include/config.h b/include/config.h index 180fd863c7..92be7de129 100644 --- a/include/config.h +++ b/include/config.h @@ -3679,6 +3679,12 @@ #undef CONFIG_USB_PD_TCPMV1 /* + * Enables PD protocol state names in the TPCMv1 console output. + * Disable to save ~900 bytes in flash space. + */ +#define CONFIG_USB_PD_TCPMV1_DEBUG + +/* * Enables Version 2 of the Power Delivery state machine * * Along with CONFIG_USB_PD_TCPMV2, you must ensure a device type is also |