Commit e8129a07 authored by Mario Limonciello's avatar Mario Limonciello Committed by Linus Walleij

pinctrl: amd: Use unicode for debugfs output

The output is currently split across two lines making it more
difficult to parse unless the newlines are removed between pins
or it's read in by a parser like Libreoffice Calc or Google docs.

To make it easier to follow to the naked eye in a terminal window:
* drop the newline in the middle of pin definitions
* shorten all output using unicode characters
* align all pipe delimitters
* output the same phrase even for disabled functions
  (but with a ∅ character)
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Link: https://lore.kernel.org/r/20220722220810.28894-2-mario.limonciello@amd.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent dc24b753
...@@ -202,8 +202,6 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) ...@@ -202,8 +202,6 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
struct amd_gpio *gpio_dev = gpiochip_get_data(gc); struct amd_gpio *gpio_dev = gpiochip_get_data(gc);
bool tmr_out_unit; bool tmr_out_unit;
unsigned int time;
unsigned int unit;
bool tmr_large; bool tmr_large;
char *level_trig; char *level_trig;
...@@ -217,13 +215,14 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) ...@@ -217,13 +215,14 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
char *pull_up_sel; char *pull_up_sel;
char *pull_up_enable; char *pull_up_enable;
char *pull_down_enable; char *pull_down_enable;
char *output_value; char *orientation;
char *output_enable; char *output_enable;
char debounce_value[40]; char debounce_value[40];
char *debounce_enable; char *debounce_enable;
for (bank = 0; bank < gpio_dev->hwbank_num; bank++) { for (bank = 0; bank < gpio_dev->hwbank_num; bank++) {
seq_printf(s, "GPIO bank%d\n", bank); unsigned int time = 0;
unsigned int unit = 0;
switch (bank) { switch (bank) {
case 0: case 0:
...@@ -246,8 +245,9 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) ...@@ -246,8 +245,9 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
/* Illegal bank number, ignore */ /* Illegal bank number, ignore */
continue; continue;
} }
seq_printf(s, "GPIO bank%d\n", bank);
for (; i < pin_num; i++) { for (; i < pin_num; i++) {
seq_printf(s, "pin%d\t", i); seq_printf(s, "📌%d\t", i);
raw_spin_lock_irqsave(&gpio_dev->lock, flags); raw_spin_lock_irqsave(&gpio_dev->lock, flags);
pin_reg = readl(gpio_dev->base + i * 4); pin_reg = readl(gpio_dev->base + i * 4);
raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); raw_spin_unlock_irqrestore(&gpio_dev->lock, flags);
...@@ -255,84 +255,91 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) ...@@ -255,84 +255,91 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
if (pin_reg & BIT(INTERRUPT_ENABLE_OFF)) { if (pin_reg & BIT(INTERRUPT_ENABLE_OFF)) {
u8 level = (pin_reg >> ACTIVE_LEVEL_OFF) & u8 level = (pin_reg >> ACTIVE_LEVEL_OFF) &
ACTIVE_LEVEL_MASK; ACTIVE_LEVEL_MASK;
interrupt_enable = "interrupt is enabled|"; interrupt_enable = "+";
if (level == ACTIVE_LEVEL_HIGH) if (level == ACTIVE_LEVEL_HIGH)
active_level = "Active high|"; active_level = "";
else if (level == ACTIVE_LEVEL_LOW) else if (level == ACTIVE_LEVEL_LOW)
active_level = "Active low|"; active_level = "";
else if (!(pin_reg & BIT(LEVEL_TRIG_OFF)) && else if (!(pin_reg & BIT(LEVEL_TRIG_OFF)) &&
level == ACTIVE_LEVEL_BOTH) level == ACTIVE_LEVEL_BOTH)
active_level = "Active on both|"; active_level = "b";
else else
active_level = "Unknown Active level|"; active_level = "?";
if (pin_reg & BIT(LEVEL_TRIG_OFF)) if (pin_reg & BIT(LEVEL_TRIG_OFF))
level_trig = "Level trigger|"; level_trig = "level";
else else
level_trig = "Edge trigger|"; level_trig = " edge";
} else { } else {
interrupt_enable = interrupt_enable = "∅";
"interrupt is disabled|"; active_level = "∅";
active_level = " "; level_trig = " ∅";
level_trig = " ";
} }
if (pin_reg & BIT(INTERRUPT_MASK_OFF)) if (pin_reg & BIT(INTERRUPT_MASK_OFF))
interrupt_mask = interrupt_mask = "-";
"interrupt is unmasked|";
else else
interrupt_mask = interrupt_mask = "+";
"interrupt is masked|"; seq_printf(s, "int %s (🎭 %s)| active-%s| %s-🔫| ",
interrupt_enable,
interrupt_mask,
active_level,
level_trig);
if (pin_reg & BIT(WAKE_CNTRL_OFF_S0I3)) if (pin_reg & BIT(WAKE_CNTRL_OFF_S0I3))
wake_cntrl0 = "enable wakeup in S0i3 state|"; wake_cntrl0 = "+";
else else
wake_cntrl0 = "disable wakeup in S0i3 state|"; wake_cntrl0 = "∅";
seq_printf(s, "S0i3 🌅 %s| ", wake_cntrl0);
if (pin_reg & BIT(WAKE_CNTRL_OFF_S3)) if (pin_reg & BIT(WAKE_CNTRL_OFF_S3))
wake_cntrl1 = "enable wakeup in S3 state|"; wake_cntrl1 = "+";
else else
wake_cntrl1 = "disable wakeup in S3 state|"; wake_cntrl1 = "∅";
seq_printf(s, "S3 🌅 %s| ", wake_cntrl1);
if (pin_reg & BIT(WAKE_CNTRL_OFF_S4)) if (pin_reg & BIT(WAKE_CNTRL_OFF_S4))
wake_cntrl2 = "enable wakeup in S4/S5 state|"; wake_cntrl2 = "+";
else else
wake_cntrl2 = "disable wakeup in S4/S5 state|"; wake_cntrl2 = "∅";
seq_printf(s, "S4/S5 🌅 %s| ", wake_cntrl2);
if (pin_reg & BIT(PULL_UP_ENABLE_OFF)) { if (pin_reg & BIT(PULL_UP_ENABLE_OFF)) {
pull_up_enable = "pull-up is enabled|"; pull_up_enable = "+";
if (pin_reg & BIT(PULL_UP_SEL_OFF)) if (pin_reg & BIT(PULL_UP_SEL_OFF))
pull_up_sel = "8k pull-up|"; pull_up_sel = "8k";
else else
pull_up_sel = "4k pull-up|"; pull_up_sel = "4k";
} else { } else {
pull_up_enable = "pull-up is disabled|"; pull_up_enable = "";
pull_up_sel = " "; pull_up_sel = " ";
} }
seq_printf(s, "pull-↑ %s (%s)| ",
pull_up_enable,
pull_up_sel);
if (pin_reg & BIT(PULL_DOWN_ENABLE_OFF)) if (pin_reg & BIT(PULL_DOWN_ENABLE_OFF))
pull_down_enable = "pull-down is enabled|"; pull_down_enable = "+";
else else
pull_down_enable = "Pull-down is disabled|"; pull_down_enable = "∅";
seq_printf(s, "pull-↓ %s| ", pull_down_enable);
if (pin_reg & BIT(OUTPUT_ENABLE_OFF)) { if (pin_reg & BIT(OUTPUT_ENABLE_OFF)) {
pin_sts = " "; pin_sts = "output";
output_enable = "output is enabled|";
if (pin_reg & BIT(OUTPUT_VALUE_OFF)) if (pin_reg & BIT(OUTPUT_VALUE_OFF))
output_value = "output is high|"; orientation = "↑";
else else
output_value = "output is low|"; orientation = "↓";
} else { } else {
output_enable = "output is disabled|"; pin_sts = "input ";
output_value = " ";
if (pin_reg & BIT(PIN_STS_OFF)) if (pin_reg & BIT(PIN_STS_OFF))
pin_sts = "input is high|"; orientation = "↑";
else else
pin_sts = "input is low|"; orientation = "↓";
} }
seq_printf(s, "%s %s| ", pin_sts, orientation);
db_cntrl = (DB_CNTRl_MASK << DB_CNTRL_OFF) & pin_reg; db_cntrl = (DB_CNTRl_MASK << DB_CNTRL_OFF) & pin_reg;
if (db_cntrl) { if (db_cntrl) {
...@@ -351,27 +358,18 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) ...@@ -351,27 +358,18 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)
unit = 61; unit = 61;
} }
if ((DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF) == db_cntrl) if ((DB_TYPE_REMOVE_GLITCH << DB_CNTRL_OFF) == db_cntrl)
debounce_enable = "debouncing filter (high and low) enabled|"; debounce_enable = "b +";
else if ((DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF) == db_cntrl) else if ((DB_TYPE_PRESERVE_LOW_GLITCH << DB_CNTRL_OFF) == db_cntrl)
debounce_enable = "debouncing filter (low) enabled|"; debounce_enable = "↓ +";
else else
debounce_enable = "debouncing filter (high) enabled|"; debounce_enable = "↑ +";
snprintf(debounce_value, sizeof(debounce_value),
"debouncing timeout is %u (us)|", time * unit);
} else { } else {
debounce_enable = "debouncing filter disabled|"; debounce_enable = " ∅";
snprintf(debounce_value, sizeof(debounce_value), " ");
} }
snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit);
seq_printf(s, "%s %s %s %s %s %s\n" seq_printf(s, "debounce %s (⏰ %sus)| ", debounce_enable, debounce_value);
" %s %s %s %s %s %s %s %s %s 0x%x\n", seq_printf(s, " 0x%x\n", pin_reg);
level_trig, active_level, interrupt_enable,
interrupt_mask, wake_cntrl0, wake_cntrl1,
wake_cntrl2, pin_sts, pull_up_sel,
pull_up_enable, pull_down_enable,
output_value, output_enable,
debounce_enable, debounce_value, pin_reg);
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment