From 8c26ccbc151e8e270e04af74719d5e4befcc8ff3 Mon Sep 17 00:00:00 2001 From: Wei-Ning Huang Date: Tue, 2 May 2017 19:32:52 +0800 Subject: uart: add config to optionally enable EC_CMD_CONSOLE_READ v1 The cros_ec_debugfs creates the `console_log` debugfs entry if EC supports EC_CMD_CONSOLE_READ version 1. On device where i2c command latency is critical, periodic console_read is impacting the timing of commands. BRANCH=none BUG=b:37584134 TEST=on rose with CONFIG_CONSOLE_ENABLE_READ_V1 undefined, the kernel should not create cros_tp/console_log. Change-Id: I40d0b959ef36f2f410155fa30e01c8169032a3e9 Signed-off-by: Wei-Ning Huang Reviewed-on: https://chromium-review.googlesource.com/494546 Commit-Ready: Wei-Ning Huang Tested-by: Wei-Ning Huang Reviewed-by: Gwendal Grignou --- common/uart_buffering.c | 8 +++++++- include/config.h | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/common/uart_buffering.c b/common/uart_buffering.c index b81c8cf065..e8dfacd11d 100644 --- a/common/uart_buffering.c +++ b/common/uart_buffering.c @@ -405,6 +405,7 @@ static int host_command_console_read(struct host_cmd_handler_args *args) * snapshot. */ return console_read_helper(args, &tx_snapshot_tail); +#ifdef CONFIG_CONSOLE_ENABLE_READ_V1 } else if (args->version == 1) { /* Check the params to figure out where to start reading. */ p = args->params; @@ -413,9 +414,14 @@ static int host_command_console_read(struct host_cmd_handler_args *args) else if (p->subcmd == CONSOLE_READ_RECENT) return console_read_helper(args, &tx_last_snapshot_head); +#endif } return EC_RES_INVALID_PARAM; } DECLARE_HOST_COMMAND(EC_CMD_CONSOLE_READ, host_command_console_read, - EC_VER_MASK(0) | EC_VER_MASK(1)); + EC_VER_MASK(0) +#ifdef CONFIG_CONSOLE_ENABLE_READ_V1 + | EC_VER_MASK(1) +#endif + ); diff --git a/include/config.h b/include/config.h index 2b08abde9b..817dc659f6 100644 --- a/include/config.h +++ b/include/config.h @@ -774,6 +774,12 @@ /* The default .flags field value is zero, unless overridden with this. */ #undef CONFIG_CONSOLE_COMMAND_FLAGS_DEFAULT +/* + * Enable EC_CMD_CONSOLE_READ V1. One could disable this config to prevent + * kernel from creating the `console_log` debugfs entry. + */ +#define CONFIG_CONSOLE_ENABLE_READ_V1 + /* * Number of entries in console history buffer. * -- cgit v1.2.1