pinctrl-amd debugfs improvements
Subsystems (3)
cover pinctrl-amd debugfs improvements
Debugging an issue recently of poor residency in a low power state concluded it was caused by GPIO controller misprogrammed in BIOS.
What happened was _CRS was missing a configuration but device was trying to assert an interrupt. This is found by interrupt status bit which isn't currently covered in debug output.
Add this and also the similar wake status bit to debug output. As the display is very busy and growing long again with so much info, adjust the display to only render characters for relevant bits and to now use headers for each GPIO bank.
New sample output, including demonstrating detection of BIOS issue (by π₯):
gpio int|active|trigger|S0i3| S3|S4/S5| Z|wake|pull| orient| debounce|reg #0 π| β| edge| β°| β°| |β°| |4k β|input β|b (π 046875us)|0x81578e3 #1 β | | | | | | | |4k β|input β| |0x150000 #2 π| β| edge| β°| β°| | | |4k β|input β| |0x157a00 #3 π| β| edge| β°| β°| | | |4k β|input β| |0x157a00 #4 β | | | | | | | |4k β|input β| |0x150000 #5 β | | | | | | | |4k β|input β| |0x150000 #6 π·| β| level| | | |β°| |4k β|input β| |0x8150b00 #7 β | | | | | | | |4k β|input β| |0x150200
#8 π₯ π·| β| level| | | |β°| |4k β|input β| |0x18140b00
Mario Limonciello (2):
pinctrl: amd: Adjust debugfs output
pinctrl: amd: Add fields for interrupt status and wake status
drivers/pinctrl/pinctrl-amd.c | 90 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 46 deletions(-)
Signature Β· 1 line
2.34.1
PATCH 1/2 pinctrl: amd: Adjust debugfs output
More fields are to be added, so to keep the display from being too busy, adjust it.
1) Add a header to all columns
2) Except for interrupt, when fields have no data show empty
3) Remove otherwise blank whitespace
--- drivers/pinctrl/pinctrl-amd.c | 76 ++++++++++++++--------------------- 1 file changed, 30 insertions(+), 46 deletions(-)
drivers/pinctrl/pinctrl-amd.c +30 -46
@@ -206,15 +206,12 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)char *level_trig;char *active_level; -char *interrupt_enable;char *interrupt_mask;char *wake_cntrl0;char *wake_cntrl1;char *wake_cntrl2;char *pin_sts;char *pull_up_sel; -char *pull_up_enable; -char *pull_down_enable;char *orientation;char debounce_value[40 ];char *debounce_enable;
@@ -246,6 +243,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)continue ; }seq_printf (s,"GPIO bank%d\n" , bank); +seq_puts (s,"gpio\tint|active|trigger|S0i3| S3|S4/S5| Z|wake|pull| orient| debounce|reg\n" );for (; i < pin_num; i++) {seq_printf (s,"#%d\t" , i);raw_spin_lock_irqsave (&gpio_dev->lock, flags);
@@ -255,7 +253,6 @@ 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 ="+" ;if (level ==ACTIVE_LEVEL_HIGH ) active_level ="β" ;
@@ -272,65 +269,54 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)else level_trig =" edge" ; - }else { - interrupt_enable ="β " ; - active_level ="β " ; - level_trig =" β " ; - } +if (pin_reg &BIT (INTERRUPT_MASK_OFF )) + interrupt_mask ="π" ; +else + interrupt_mask ="π·" ; -if (pin_reg &BIT (INTERRUPT_MASK_OFF )) - interrupt_mask ="π" ; -else - interrupt_mask ="π·" ; -seq_printf (s,"int %s (%s)| active-%s| %s-β‘| " , - interrupt_enable, +seq_printf (s,"%s| %s| %s|" , interrupt_mask, active_level, level_trig); + }else +seq_puts (s," β | | |" );if (pin_reg &BIT (WAKE_CNTRL_OFF_S0I3 )) wake_cntrl0 ="β°" ;else - wake_cntrl0 =" β " ; -seq_printf (s,"S0i3 %s| " , wake_cntrl0); + wake_cntrl0 =" " ; +seq_printf (s," %s| " , wake_cntrl0);if (pin_reg &BIT (WAKE_CNTRL_OFF_S3 )) wake_cntrl1 ="β°" ;else - wake_cntrl1 =" β " ; -seq_printf (s,"S3 %s| " , wake_cntrl1); + wake_cntrl1 =" " ; +seq_printf (s,"%s|" , wake_cntrl1);if (pin_reg &BIT (WAKE_CNTRL_OFF_S4 )) wake_cntrl2 ="β°" ;else - wake_cntrl2 =" β " ; -seq_printf (s,"S4/S5 %s| " , wake_cntrl2); + wake_cntrl2 =" " ; +seq_printf (s," %s|" , wake_cntrl2);if (pin_reg &BIT (WAKECNTRL_Z_OFF )) wake_cntrlz ="β°" ;else - wake_cntrlz =" β " ; -seq_printf (s,"Z %s| " , wake_cntrlz); + wake_cntrlz =" " ; +seq_printf (s,"%s|" , wake_cntrlz);if (pin_reg &BIT (PULL_UP_ENABLE_OFF )) { - pull_up_enable ="+" ;if (pin_reg &BIT (PULL_UP_SEL_OFF )) pull_up_sel ="8k" ;else pull_up_sel ="4k" ; - }else { - pull_up_enable ="β " ; - pull_up_sel =" " ; +seq_printf (s,"%s β|" , + pull_up_sel); + }else if (pin_reg &BIT (PULL_DOWN_ENABLE_OFF )) { +seq_puts (s," β|" ); + }else { +seq_puts (s," |" ); } -seq_printf (s,"pull-β %s (%s)| " , - pull_up_enable, - pull_up_sel); - -if (pin_reg &BIT (PULL_DOWN_ENABLE_OFF )) - pull_down_enable ="+" ; -else - pull_down_enable ="β " ; -seq_printf (s,"pull-β %s| " , pull_down_enable);if (pin_reg &BIT (OUTPUT_ENABLE_OFF )) { pin_sts ="output" ;
@@ -345,7 +331,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)else orientation ="β" ; } -seq_printf (s,"%s %s| " , pin_sts, orientation); +seq_printf (s,"%s %s|" , pin_sts, orientation); db_cntrl = (DB_CNTRl_MASK <<DB_CNTRL_OFF ) & pin_reg;if (db_cntrl) {
@@ -364,19 +350,17 @@ 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 ="b +" ; + debounce_enable ="b" ;else if ((DB_TYPE_PRESERVE_LOW_GLITCH <<DB_CNTRL_OFF ) == db_cntrl) - debounce_enable ="β +" ; + debounce_enable ="β" ;else - debounce_enable ="β +" ; - + debounce_enable ="β" ; +snprintf (debounce_value,sizeof (debounce_value),"%06u" , time * unit); +seq_printf (s,"%s (π %sus)|" , debounce_enable, debounce_value); }else { - debounce_enable =" β " ; - time =0 ; +seq_puts (s," |" ); } -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); +seq_printf (s,"0x%x\n" , pin_reg); } } }
Signature Β· 1 line
2.34.1
Re: [PATCH 1/2] pinctrl: amd: Adjust debugfs output
Quoted 8 lines Β· Mario Limonciello
More fields are to be added, so to keep the display from being too busy, adjust it.
1) Add a header to all columns
2) Except for interrupt, when fields have no data show empty
3) Remove otherwise blank whitespaceSigned-off-by Mario Limonciello <[email protected]>
Patches applied!
Yours,
Linus Walleij
PATCH 2/2 pinctrl: amd: Add fields for interrupt status and wake status
In reply to Mario LimoncielloIf the firmware has misconfigured a GPIO it may cause interrupt status or wake status bits to be set and not asserted. Add these to debug output to catch this case.
--- drivers/pinctrl/pinctrl-amd.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-)
drivers/pinctrl/pinctrl-amd.c +17 -3
@@ -211,6 +211,8 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)char *wake_cntrl1;char *wake_cntrl2;char *pin_sts; +char *interrupt_sts; +char *wake_sts;char *pull_up_sel;char *orientation;char debounce_value[40 ];
@@ -243,7 +245,7 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)continue ; }seq_printf (s,"GPIO bank%d\n" , bank); -seq_puts (s,"gpio\tint|active|trigger|S0i3| S3|S4/S5| Z|wake|pull| orient| debounce|reg\n" ); +seq_puts (s,"gpio\t int|active|trigger|S0i3| S3|S4/S5| Z|wake|pull| orient| debounce|reg\n" );for (; i < pin_num; i++) {seq_printf (s,"#%d\t" , i);raw_spin_lock_irqsave (&gpio_dev->lock, flags);
@@ -274,12 +276,18 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc)else interrupt_mask ="π·" ; -seq_printf (s,"%s| %s| %s|" , +if (pin_reg &BIT (INTERRUPT_STS_OFF )) + interrupt_sts ="π₯" ; +else + interrupt_sts =" " ; + +seq_printf (s,"%s %s| %s| %s|" , + interrupt_sts, interrupt_mask, active_level, level_trig); }else -seq_puts (s," β | | |" ); +seq_puts (s," β | | |" );if (pin_reg &BIT (WAKE_CNTRL_OFF_S0I3 )) wake_cntrl0 ="β°" ;
@@ -305,6 +313,12 @@ static void amd_gpio_dbg_show(struct seq_file *s, struct gpio_chip *gc) wake_cntrlz =" " ;seq_printf (s,"%s|" , wake_cntrlz); +if (pin_reg &BIT (WAKE_STS_OFF )) + wake_sts ="π₯" ; +else + wake_sts =" " ; +seq_printf (s," %s|" , wake_sts); +if (pin_reg &BIT (PULL_UP_ENABLE_OFF )) {if (pin_reg &BIT (PULL_UP_SEL_OFF )) pull_up_sel ="8k" ;
Signature Β· 1 line
2.34.1