summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2021-06-04 15:16:37 -0600
committerCommit Bot <commit-bot@chromium.org>2021-06-09 17:49:18 +0000
commitf22f1ea5cf373357ae4f3de525cd2cb6c09ea44c (patch)
tree9a2dd48eafc6b679fd730b2687ae940dcc712036
parent7837e2011cf7c4d8690a17f9b7d89768a5a01d4c (diff)
downloadchrome-ec-f22f1ea5cf373357ae4f3de525cd2cb6c09ea44c.tar.gz
zephyr: Add CONFIG_PLATFORM_EC_CONSOLE_CHANNEL
Add a KConfig option to enable/disable the CONFIG_CONSOLE_CHANNEL option. Enabled by default, but can be turned off to save code space. BUG=b:180421120 BRANCH=none TEST=zmake testall TEST=Boot lazor, verify 'chan' command is present or not based on this config. Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I9f5f10582ef6161a38bb2f5f7f48bae631ba9cf6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2946964 Commit-Queue: Wai-Hong Tam <waihong@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
-rw-r--r--util/config_allowed.txt1
-rw-r--r--zephyr/Kconfig.console19
-rw-r--r--zephyr/shim/include/config_chip.h5
-rw-r--r--zephyr/shim/src/console.c4
4 files changed, 26 insertions, 3 deletions
diff --git a/util/config_allowed.txt b/util/config_allowed.txt
index 98d66d786a..015cf49ba5 100644
--- a/util/config_allowed.txt
+++ b/util/config_allowed.txt
@@ -352,7 +352,6 @@ CONFIG_COMMON_GPIO_SHORTNAMES
CONFIG_COMMON_PANIC_OUTPUT
CONFIG_COMMON_RUNTIME
CONFIG_COMMON_TIMER
-CONFIG_CONSOLE_CHANNEL
CONFIG_CONSOLE_CMDHELP
CONFIG_CONSOLE_COMMAND_FLAGS
CONFIG_CONSOLE_COMMAND_FLAGS_DEFAULT
diff --git a/zephyr/Kconfig.console b/zephyr/Kconfig.console
index 03b01cb45b..4e8807b9a4 100644
--- a/zephyr/Kconfig.console
+++ b/zephyr/Kconfig.console
@@ -2,6 +2,25 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+config PLATFORM_EC_CONSOLE_CHANNEL
+ bool "Console channels"
+ depends on CONSOLE
+ default y
+ help
+ Make it possible for console to be output to different channels that
+ can be turned on and off. Channels are organized by functional area
+ such as "charger", "motionsense", "usbpd" and others.
+
+ This is useful as a developer convenience when the console is crowded
+ with messages, to make it easier to use the interactive console.
+
+ The `chan` console command with no arguments shows all available
+ channels.
+
+ FAFT and servod also use this feature.
+
+ Boards may #undef this to reduce image size.
+
menuconfig PLATFORM_EC_HOSTCMD_CONSOLE
bool "Console Host Command"
depends on PLATFORM_EC_HOSTCMD
diff --git a/zephyr/shim/include/config_chip.h b/zephyr/shim/include/config_chip.h
index 544627da5d..9a23b725e2 100644
--- a/zephyr/shim/include/config_chip.h
+++ b/zephyr/shim/include/config_chip.h
@@ -1587,4 +1587,9 @@
#define CONFIG_ACCEL_LIS2DW_AS_BASE
#endif
+#undef CONFIG_CONSOLE_CHANNEL
+#ifdef CONFIG_PLATFORM_EC_CONSOLE_CHANNEL
+#define CONFIG_CONSOLE_CHANNEL
+#endif
+
#endif /* __CROS_EC_CONFIG_CHIP_H */
diff --git a/zephyr/shim/src/console.c b/zephyr/shim/src/console.c
index 22272a9c8d..5d4e2de16f 100644
--- a/zephyr/shim/src/console.c
+++ b/zephyr/shim/src/console.c
@@ -175,7 +175,7 @@ int zshim_run_ec_console_command(int (*handler)(int argc, char **argv),
return handler(argc, argv);
}
-#if DT_NODE_EXISTS(DT_PATH(ec_console))
+#if defined(CONFIG_CONSOLE_CHANNEL) && DT_NODE_EXISTS(DT_PATH(ec_console))
#define EC_CONSOLE DT_PATH(ec_console)
static const char * const disabled_channels[] = DT_PROP(EC_CONSOLE, disabled);
@@ -187,7 +187,7 @@ static int init_ec_console(const struct device *unused)
return 0;
} SYS_INIT(init_ec_console, PRE_KERNEL_1, 50);
-#endif
+#endif /* CONFIG_CONSOLE_CHANNEL && DT_NODE_EXISTS(DT_PATH(ec_console)) */
/*
* Minimal implementation of a few uart_* functions we need.