* [PATCH 1/2] pinctrl: amd: Fix newline declaration in debugfs output @ 2022-07-22 22:08 Mario Limonciello 2022-07-22 22:08 ` [PATCH 2/2] pinctrl: amd: Use unicode for " Mario Limonciello 2022-07-26 8:00 ` [PATCH 1/2] pinctrl: amd: Fix newline declaration in " Linus Walleij 0 siblings, 2 replies; 5+ messages in thread From: Mario Limonciello @ 2022-07-22 22:08 UTC (permalink / raw) To: mario.limonciello, Basavaraj Natikar, Shyam Sundar S K, Linus Walleij Cc: linux-gpio, linux-kernel Currently the debugfs output for pinctrl-amd puts the first line combined with "GPIO bank". This makes it a little harder to process as the file needs to be manually corrected for the mistake. Change this to be a new line character instead. Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> --- drivers/pinctrl/pinctrl-amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index 0645c2c24f50..b7f34352b5d4 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -224,7 +224,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) char *debounce_enable; for (bank = 0; bank < gpio_dev->hwbank_num; bank++) { - seq_printf(s, "GPIO bank%d\t", bank); + seq_printf(s, "GPIO bank%d\n", bank); switch (bank) { case 0: -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] pinctrl: amd: Use unicode for debugfs output 2022-07-22 22:08 [PATCH 1/2] pinctrl: amd: Fix newline declaration in debugfs output Mario Limonciello @ 2022-07-22 22:08 ` Mario Limonciello 2022-07-26 8:02 ` Linus Walleij 2022-07-26 8:00 ` [PATCH 1/2] pinctrl: amd: Fix newline declaration in " Linus Walleij 1 sibling, 1 reply; 5+ messages in thread From: Mario Limonciello @ 2022-07-22 22:08 UTC (permalink / raw) To: mario.limonciello, Basavaraj Natikar, Shyam Sundar S K, Linus Walleij Cc: linux-gpio, linux-kernel 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: Mario Limonciello <mario.limonciello@amd.com> --- drivers/pinctrl/pinctrl-amd.c | 114 +++++++++++++++++----------------- 1 file changed, 56 insertions(+), 58 deletions(-) diff --git a/drivers/pinctrl/pinctrl-amd.c b/drivers/pinctrl/pinctrl-amd.c index b7f34352b5d4..14183b493954 100644 --- a/drivers/pinctrl/pinctrl-amd.c +++ b/drivers/pinctrl/pinctrl-amd.c @@ -203,8 +203,6 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) struct amd_gpio *gpio_dev = gpiochip_get_data(gc); bool tmr_out_unit; - unsigned int time; - unsigned int unit; bool tmr_large; char *level_trig; @@ -218,13 +216,14 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) char *pull_up_sel; char *pull_up_enable; char *pull_down_enable; - char *output_value; + char *orientation; char *output_enable; char debounce_value[40]; char *debounce_enable; 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) { case 0: @@ -247,8 +246,9 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) /* Illegal bank number, ignore */ continue; } + seq_printf(s, "GPIO bank%d\n", bank); 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); pin_reg = readl(gpio_dev->base + i * 4); raw_spin_unlock_irqrestore(&gpio_dev->lock, flags); @@ -256,84 +256,91 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) if (pin_reg & BIT(INTERRUPT_ENABLE_OFF)) { u8 level = (pin_reg >> ACTIVE_LEVEL_OFF) & ACTIVE_LEVEL_MASK; - interrupt_enable = "interrupt is enabled|"; + interrupt_enable = "+"; if (level == ACTIVE_LEVEL_HIGH) - active_level = "Active high|"; + active_level = "↑"; else if (level == ACTIVE_LEVEL_LOW) - active_level = "Active low|"; + active_level = "↓"; else if (!(pin_reg & BIT(LEVEL_TRIG_OFF)) && level == ACTIVE_LEVEL_BOTH) - active_level = "Active on both|"; + active_level = "b"; else - active_level = "Unknown Active level|"; + active_level = "?"; if (pin_reg & BIT(LEVEL_TRIG_OFF)) - level_trig = "Level trigger|"; + level_trig = "level"; else - level_trig = "Edge trigger|"; + level_trig = " edge"; } else { - interrupt_enable = - "interrupt is disabled|"; - active_level = " "; - level_trig = " "; + interrupt_enable = "∅"; + active_level = "∅"; + level_trig = " ∅"; } if (pin_reg & BIT(INTERRUPT_MASK_OFF)) - interrupt_mask = - "interrupt is unmasked|"; + interrupt_mask = "-"; else - interrupt_mask = - "interrupt is masked|"; + interrupt_mask = "+"; + 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)) - wake_cntrl0 = "enable wakeup in S0i3 state|"; + wake_cntrl0 = "+"; 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)) - wake_cntrl1 = "enable wakeup in S3 state|"; + wake_cntrl1 = "+"; 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)) - wake_cntrl2 = "enable wakeup in S4/S5 state|"; + wake_cntrl2 = "+"; 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)) { - pull_up_enable = "pull-up is enabled|"; + pull_up_enable = "+"; if (pin_reg & BIT(PULL_UP_SEL_OFF)) - pull_up_sel = "8k pull-up|"; + pull_up_sel = "8k"; else - pull_up_sel = "4k pull-up|"; + pull_up_sel = "4k"; } else { - pull_up_enable = "pull-up is disabled|"; - pull_up_sel = " "; + pull_up_enable = "∅"; + pull_up_sel = " "; } + seq_printf(s, "pull-↑ %s (%s)| ", + pull_up_enable, + pull_up_sel); if (pin_reg & BIT(PULL_DOWN_ENABLE_OFF)) - pull_down_enable = "pull-down is enabled|"; + pull_down_enable = "+"; 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)) { - pin_sts = " "; - output_enable = "output is enabled|"; + pin_sts = "output"; if (pin_reg & BIT(OUTPUT_VALUE_OFF)) - output_value = "output is high|"; + orientation = "↑"; else - output_value = "output is low|"; + orientation = "↓"; } else { - output_enable = "output is disabled|"; - output_value = " "; - + pin_sts = "input "; if (pin_reg & BIT(PIN_STS_OFF)) - pin_sts = "input is high|"; + orientation = "↑"; 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; if (db_cntrl) { @@ -352,27 +359,18 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) unit = 61; } 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) - debounce_enable = "debouncing filter (low) enabled|"; + debounce_enable = "↓ +"; else - debounce_enable = "debouncing filter (high) enabled|"; + debounce_enable = "↑ +"; - snprintf(debounce_value, sizeof(debounce_value), - "debouncing timeout is %u (us)|", time * unit); } else { - debounce_enable = "debouncing filter disabled|"; - snprintf(debounce_value, sizeof(debounce_value), " "); + debounce_enable = " ∅"; } - - seq_printf(s, "%s %s %s %s %s %s\n" - " %s %s %s %s %s %s %s %s %s 0x%x\n", - 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); + snprintf(debounce_value, sizeof(debounce_value), "%u", time * unit); + seq_printf(s, "debounce %s (⏰ %sus)| ", debounce_enable, debounce_value); + seq_printf(s, " 0x%x\n", pin_reg); } } } -- 2.34.1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] pinctrl: amd: Use unicode for debugfs output 2022-07-22 22:08 ` [PATCH 2/2] pinctrl: amd: Use unicode for " Mario Limonciello @ 2022-07-26 8:02 ` Linus Walleij 2022-07-26 13:27 ` Limonciello, Mario 0 siblings, 1 reply; 5+ messages in thread From: Linus Walleij @ 2022-07-26 8:02 UTC (permalink / raw) To: Mario Limonciello Cc: Basavaraj Natikar, Shyam Sundar S K, linux-gpio, linux-kernel On Sat, Jul 23, 2022 at 12:08 AM Mario Limonciello <mario.limonciello@amd.com> wrote: > 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: Mario Limonciello <mario.limonciello@amd.com> That's a bit unorthodox, what happens when someone uses their old VT100 terminal to look at this file? BIUT! It is a debugfs file, and you folks at AMD are going to be using this and I just assume that you folks have aligned internally that this is how you want things so I just applied this. We need testing in linux-next for this anyway, the merge window is close. If the other AMD people don't like it for some reason I can always pull it out. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH 2/2] pinctrl: amd: Use unicode for debugfs output 2022-07-26 8:02 ` Linus Walleij @ 2022-07-26 13:27 ` Limonciello, Mario 0 siblings, 0 replies; 5+ messages in thread From: Limonciello, Mario @ 2022-07-26 13:27 UTC (permalink / raw) To: Linus Walleij Cc: Natikar, Basavaraj, S-k, Shyam-sundar, linux-gpio, linux-kernel [Public] > -----Original Message----- > From: Linus Walleij <linus.walleij@linaro.org> > Sent: Tuesday, July 26, 2022 03:02 > To: Limonciello, Mario <Mario.Limonciello@amd.com> > Cc: Natikar, Basavaraj <Basavaraj.Natikar@amd.com>; S-k, Shyam-sundar > <Shyam-sundar.S-k@amd.com>; linux-gpio@vger.kernel.org; linux- > kernel@vger.kernel.org > Subject: Re: [PATCH 2/2] pinctrl: amd: Use unicode for debugfs output > > On Sat, Jul 23, 2022 at 12:08 AM Mario Limonciello > <mario.limonciello@amd.com> wrote: > > > 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: Mario Limonciello <mario.limonciello@amd.com> > > That's a bit unorthodox, what happens when someone uses their > old VT100 terminal to look at this file? I guess it would look pretty terrible, but given it's debugfs very unlikely. > > BIUT! It is a debugfs file, and you folks at AMD are going to be > using this and I just assume that you folks have aligned internally > that this is how you want things so I just applied this. > > We need testing in linux-next for this anyway, the merge window > is close. If the other AMD people don't like it for some reason > I can always pull it out. > I didn't pre-align this with the other AMD guys. It was just something I noticed that has annoyed me as I look at bugs that I'm looking at and since it's not sensitive content figured public review is fine for it. That's why I left them on To: line. But yes as you say if others don't like it reverts are cheap and it's better to have enough time for good testing coverage. Thanks! ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] pinctrl: amd: Fix newline declaration in debugfs output 2022-07-22 22:08 [PATCH 1/2] pinctrl: amd: Fix newline declaration in debugfs output Mario Limonciello 2022-07-22 22:08 ` [PATCH 2/2] pinctrl: amd: Use unicode for " Mario Limonciello @ 2022-07-26 8:00 ` Linus Walleij 1 sibling, 0 replies; 5+ messages in thread From: Linus Walleij @ 2022-07-26 8:00 UTC (permalink / raw) To: Mario Limonciello Cc: Basavaraj Natikar, Shyam Sundar S K, linux-gpio, linux-kernel On Sat, Jul 23, 2022 at 12:08 AM Mario Limonciello <mario.limonciello@amd.com> wrote: > Currently the debugfs output for pinctrl-amd puts the first line > combined with "GPIO bank". This makes it a little harder to process > as the file needs to be manually corrected for the mistake. > > Change this to be a new line character instead. > > Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Patch applied as obviously correct. Yours, Linus Walleij ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-07-26 13:27 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-22 22:08 [PATCH 1/2] pinctrl: amd: Fix newline declaration in debugfs output Mario Limonciello 2022-07-22 22:08 ` [PATCH 2/2] pinctrl: amd: Use unicode for " Mario Limonciello 2022-07-26 8:02 ` Linus Walleij 2022-07-26 13:27 ` Limonciello, Mario 2022-07-26 8:00 ` [PATCH 1/2] pinctrl: amd: Fix newline declaration in " Linus Walleij
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®