summaryrefslogtreecommitdiff
path: root/common/gpio_commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/gpio_commands.c')
-rw-r--r--common/gpio_commands.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/common/gpio_commands.c b/common/gpio_commands.c
index d922ad5891..32bd896c0c 100644
--- a/common/gpio_commands.c
+++ b/common/gpio_commands.c
@@ -9,7 +9,6 @@
#include "console.h"
#include "gpio.h"
#include "host_command.h"
-#include "printf.h"
#include "system.h"
#include "util.h"
@@ -80,39 +79,30 @@ static enum ec_error_list set(const char *name, int value)
static void print_gpio_info(int gpio)
{
- int changed, v;
- char flags_str[33];
+ int changed, v, flags;
if (!gpio_is_implemented(gpio))
return; /* Skip unsupported signals */
v = gpio_get_level(gpio);
#ifdef CONFIG_CMD_GPIO_EXTENDED
- {
- int flags;
-
- flags = gpio_get_flags(gpio);
- snprintf(flags_str, sizeof(flags_str),
- "%s%s%s%s%s%s%s%s%s%s%s",
- flags & GPIO_INPUT ? "I " : "",
- flags & GPIO_OUTPUT ? "O " : "",
- flags & GPIO_LOW ? "L " : "",
- flags & GPIO_HIGH ? "H " : "",
- flags & GPIO_ANALOG ? "A " : "",
- flags & GPIO_OPEN_DRAIN ? "ODR " : "",
- flags & GPIO_PULL_UP ? "PU " : "",
- flags & GPIO_PULL_DOWN ? "PD " : "",
- flags & GPIO_ALTERNATE ? "ALT " : "",
- flags & GPIO_SEL_1P8V ? "1P8 " : "",
- flags & GPIO_LOCKED ? "LCK " : "");
- }
+ flags = gpio_get_flags(gpio);
#else
- flags_str[0] = 0;
+ flags = 0;
#endif
changed = last_val_changed(gpio, v);
- ccprintf(" %d%c %s%s\n", v,
- (changed ? '*' : ' '), flags_str, gpio_get_name(gpio));
+ ccprintf(" %d%c %s%s%s%s%s%s%s%s%s%s\n", v, (changed ? '*' : ' '),
+ (flags & GPIO_INPUT ? "I " : ""),
+ (flags & GPIO_OUTPUT ? "O " : ""),
+ (flags & GPIO_LOW ? "L " : ""),
+ (flags & GPIO_HIGH ? "H " : ""),
+ (flags & GPIO_ANALOG ? "A " : ""),
+ (flags & GPIO_OPEN_DRAIN ? "ODR " : ""),
+ (flags & GPIO_PULL_UP ? "PU " : ""),
+ (flags & GPIO_PULL_DOWN ? "PD " : ""),
+ (flags & GPIO_ALTERNATE ? "ALT " : ""),
+ gpio_get_name(gpio));
/* Flush console to avoid truncating output */
cflush();