summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2014-11-12 14:47:24 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-13 16:13:22 +0000
commitafd993b1bd2863baedba2399603f1c9fea1b7c31 (patch)
treeddc82a950c83ce340ae1894821acbc3fcf1a09a6
parentf2aeae1efdd82439154d2d811d4e5e47a258c2b8 (diff)
downloadchrome-ec-afd993b1bd2863baedba2399603f1c9fea1b7c31.tar.gz
ryu: disable pd console command
Disable most of the pd console command to save space. The command can still be used with subcommands "state" and "dump" to get state information and change debug level. BUG=none BRANCH=none TEST=make buildall with CONFIG_CMD_PD defined and undefined. Also undefined the config option and loaded onto samus and verified that the pd 0 state command still works. Change-Id: Ie41bad53122a1e2a9ef4bad6423b9cdc85f53742 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229420 Reviewed-by: Vic Yang <victoryang@chromium.org>
-rw-r--r--board/ryu_p1/board.h1
-rw-r--r--common/usb_pd_protocol.c17
-rw-r--r--include/config.h1
3 files changed, 16 insertions, 3 deletions
diff --git a/board/ryu_p1/board.h b/board/ryu_p1/board.h
index 4530db90cf..a06c4cbf38 100644
--- a/board/ryu_p1/board.h
+++ b/board/ryu_p1/board.h
@@ -41,6 +41,7 @@
/* Disable unused console command to save flash space */
#undef CONFIG_CMD_POWERINDEBUG
+#undef CONFIG_CMD_PD
/*
* Pericom I2C workaround
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index 0f791c2841..cfdfe8b163 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -1985,6 +1985,7 @@ void pd_set_suspend(int port, int enable)
task_wake(PORT_TO_TASK_ID(port));
}
+#ifdef CONFIG_CMD_PD
static int hex8tou32(char *str, uint32_t *val)
{
char *ptr = str;
@@ -2060,6 +2061,7 @@ static int remote_flashing(int argc, char **argv)
ccprintf("DONE %d\n", pd[port].vdm_state);
return EC_SUCCESS;
}
+#endif
#if defined(CONFIG_USB_PD_ALT_MODE) && !defined(CONFIG_USB_PD_ALT_MODE_DFP)
void pd_send_hpd(int port, enum hpd_event hpd)
@@ -2109,6 +2111,7 @@ static int command_pd(int argc, char **argv)
if (argc < 2)
return EC_ERROR_PARAM_COUNT;
+#ifdef CONFIG_CMD_PD
/* command: pd <subcmd> <args> */
if (!strcasecmp(argv[1], "dualrole")) {
if (argc < 3) {
@@ -2140,7 +2143,9 @@ static int command_pd(int argc, char **argv)
return EC_ERROR_PARAM3;
}
return EC_SUCCESS;
- } else if (!strcasecmp(argv[1], "dump")) {
+ } else
+#endif
+ if (!strcasecmp(argv[1], "dump")) {
int level;
if (argc < 3)
@@ -2152,7 +2157,9 @@ static int command_pd(int argc, char **argv)
debug_level = level;
}
return EC_SUCCESS;
- } else if (!strcasecmp(argv[1], "enable")) {
+ }
+#ifdef CONFIG_CMD_PD
+ else if (!strcasecmp(argv[1], "enable")) {
int enable;
if (argc < 3)
@@ -2174,12 +2181,14 @@ static int command_pd(int argc, char **argv)
return EC_SUCCESS;
}
+#endif
/* command: pd <port> <subcmd> [args] */
port = strtoi(argv[1], &e, 10);
if (argc < 3)
return EC_ERROR_PARAM_COUNT;
if (*e || port >= PD_PORT_COUNT)
return EC_ERROR_PARAM2;
+#ifdef CONFIG_CMD_PD
if (!strcasecmp(argv[2], "tx")) {
set_state(port, PD_STATE_SNK_DISCOVERY);
@@ -2265,7 +2274,9 @@ static int command_pd(int argc, char **argv)
}
} else if (!strncasecmp(argv[2], "flash", 4)) {
return remote_flashing(argc, argv);
- } else if (!strncasecmp(argv[2], "state", 5)) {
+ } else
+#endif
+ if (!strncasecmp(argv[2], "state", 5)) {
const char * const state_names[] = {
"DISABLED", "SUSPENDED",
#ifdef CONFIG_USB_PD_DUAL_ROLE
diff --git a/include/config.h b/include/config.h
index 0cc350bd02..cd0f5ed4d4 100644
--- a/include/config.h
+++ b/include/config.h
@@ -324,6 +324,7 @@
#undef CONFIG_CMD_HOSTCMD
#undef CONFIG_CMD_ILIM
#undef CONFIG_CMD_JUMPTAGS
+#define CONFIG_CMD_PD
#undef CONFIG_CMD_PLL
#undef CONFIG_CMD_PMU
#define CONFIG_CMD_POWERINDEBUG