This series updates gpiolib debugfs code to show more information about
GPIOs requested as IRQ.
First patch ensures that information about GPIOs requested as IRQ only
will be provided through GPIO debugfs.
Other two patches extend information for GPIOs requested as IRQ
- show Linux irq number
- show marker '<irq-only>' for GPIOs requested as IRQ only
After this series sys/kernel/debug/gpio will produce following output:
...
GPIOs 160-191, platform/4805d000.gpio, gpio:
gpio-171 ((null) ) in hi IRQ-209 <irq-only>
^^^ GPIO requested as IRQ only and its Linux IRQ number is 209
gpio-172 (xxyy ) in hi IRQ-210
^^^ GPIO requested as IRQ and as GPIO and its Linux IRQ number is 209
GPIOs 192-223, platform/48051000.gpio, gpio:
gpio-203 (vtt_fixed ) out hi
^^^ GPIO requested as GPIO only
Changes in v2:
- split original patch on three patcehs
- apply comments from Linus and Johan
v1:
https://lkml.org/lkml/2015/5/15/364
Cc: Johan Hovold <[email protected]>
Grygorii Strashko (3):
gpiolib: debugfs: display gpios requested as irq only
gpiolib: debugfs: show linux irq number for gpios requested as irq
gpiolib: debugfs: identify gpios requested as irq only
drivers/gpio/gpiolib.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--
1.9.1
Now GPIOs, wich are requested as IRQ only, will not be displayed
through GPIO debugfs. For example:
# cat /proc/interrupts
CPU0 CPU1
...
209: 0 0 4805d000.gpio 11 Edge 0-0021
# cat /debug/gpio
...
GPIOs 160-191, platform/4805d000.gpio, gpio:
<--- no info about gpio used as IRQ only here
GPIOs 192-223, platform/48051000.gpio, gpio:
gpio-203 (vtt_fixed ) out hi
...
Hence, improve GPIO debugfs code to show such kind of GPIOs
After this patch sys/kernel/debug/gpio will produce following output:
# cat /debug/gpio
...
GPIOs 160-191, platform/4805d000.gpio, gpio:
gpio-171 ((null) ) in hi IRQ
GPIOs 192-223, platform/48051000.gpio, gpio:
gpio-203 (vtt_fixed ) out hi
Cc: Johan Hovold <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
---
drivers/gpio/gpiolib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 59eaa23..399ce2f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2259,7 +2259,8 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
int is_irq;
for (i = 0; i < chip->ngpio; i++, gpio++, gdesc++) {
- if (!test_bit(FLAG_REQUESTED, &gdesc->flags))
+ if (!test_bit(FLAG_REQUESTED, &gdesc->flags) &&
+ !test_bit(FLAG_USED_AS_IRQ, &gdesc->flags))
continue;
gpiod_get_direction(gdesc);
--
1.9.1
This patch updates GPIO debugfs code to show Linux IRQ number
for GPIOs requested as irq.
After this patch sys/kernel/debug/gpio will produce following output:
...
GPIOs 160-191, platform/4805d000.gpio, gpio:
gpio-171 ((null) ) in hi IRQ-209
Cc: Johan Hovold <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
---
drivers/gpio/gpiolib.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 399ce2f..f1dcb5b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2266,13 +2266,14 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
gpiod_get_direction(gdesc);
is_out = test_bit(FLAG_IS_OUT, &gdesc->flags);
is_irq = test_bit(FLAG_USED_AS_IRQ, &gdesc->flags);
- seq_printf(s, " gpio-%-3d (%-20.20s) %s %s %s",
+ seq_printf(s, " gpio-%-3d (%-20.20s) %s %s",
gpio, gdesc->label,
is_out ? "out" : "in ",
chip->get
? (chip->get(chip, i) ? "hi" : "lo")
- : "? ",
- is_irq ? "IRQ" : " ");
+ : "? ");
+ if (is_irq)
+ seq_printf(s, " IRQ-%d", gpiod_to_irq(gdesc));
seq_printf(s, "\n");
}
}
--
1.9.1
Now many of GPIO drivers implement two interfaces gpiolib and irqchip
which are essentially orthogonal. So, now GPIO line can be requested
in three ways:
1) As pure GPIO (gpioX_request())
2) As pure GPIO IRQ, especially in DT boot case.
DT:
interrupt-parent = <&gpio6>;
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
Code:
platform_get_irq() or of_irq_get()
request_irq()
3) combination of (1) and (2).
And from GPIO debugfs it could be identified when GPIO is
requested/used or used as IRQ, but there is no way to determine
when GPIO is requested/used as IRQ only.
Such information is useful for debugging, so update GPIO debugfs code
to show marker '<irq-only>' for GPIO lines which are requested/used as
GPIO IRQ only.
After this patch sys/kernel/debug/gpio will produce following output:
...
GPIOs 160-191, platform/4805d000.gpio, gpio:
gpio-171 ((null) ) in hi IRQ-209 <irq-only>
GPIOs 192-223, platform/48051000.gpio, gpio:
gpio-203 (vtt_fixed ) out hi
Cc: Johan Hovold <[email protected]>
Signed-off-by: Grygorii Strashko <[email protected]>
---
drivers/gpio/gpiolib.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index f1dcb5b..d69fc58 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -2272,8 +2272,11 @@ static void gpiolib_dbg_show(struct seq_file *s, struct gpio_chip *chip)
chip->get
? (chip->get(chip, i) ? "hi" : "lo")
: "? ");
- if (is_irq)
+ if (is_irq) {
seq_printf(s, " IRQ-%d", gpiod_to_irq(gdesc));
+ if (!test_bit(FLAG_REQUESTED, &gdesc->flags))
+ seq_puts(s, " <irq-only>");
+ }
seq_printf(s, "\n");
}
}
--
1.9.1
On Wed, May 20, 2015 at 7:30 PM, Grygorii Strashko
<[email protected]> wrote:
> This series updates gpiolib debugfs code to show more information about
> GPIOs requested as IRQ.
>
> First patch ensures that information about GPIOs requested as IRQ only
> will be provided through GPIO debugfs.
>
> Other two patches extend information for GPIOs requested as IRQ
> - show Linux irq number
> - show marker '<irq-only>' for GPIOs requested as IRQ only
>
> After this series sys/kernel/debug/gpio will produce following output:
> ...
> GPIOs 160-191, platform/4805d000.gpio, gpio:
> gpio-171 ((null) ) in hi IRQ-209 <irq-only>
> ^^^ GPIO requested as IRQ only and its Linux IRQ number is 209
> gpio-172 (xxyy ) in hi IRQ-210
> ^^^ GPIO requested as IRQ and as GPIO and its Linux IRQ number is 209
>
> GPIOs 192-223, platform/48051000.gpio, gpio:
> gpio-203 (vtt_fixed ) out hi
> ^^^ GPIO requested as GPIO only
>
> Changes in v2:
> - split original patch on three patcehs
> - apply comments from Linus and Johan
This looks like useful information indeed.
The series,
Reviewed-by: Alexandre Courbot <[email protected]>
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<[email protected]> wrote:
> Now GPIOs, wich are requested as IRQ only, will not be displayed
> through GPIO debugfs. For example:
> # cat /proc/interrupts
> CPU0 CPU1
> ...
> 209: 0 0 4805d000.gpio 11 Edge 0-0021
>
> # cat /debug/gpio
> ...
> GPIOs 160-191, platform/4805d000.gpio, gpio:
> <--- no info about gpio used as IRQ only here
>
> GPIOs 192-223, platform/48051000.gpio, gpio:
> gpio-203 (vtt_fixed ) out hi
> ...
>
> Hence, improve GPIO debugfs code to show such kind of GPIOs
>
> After this patch sys/kernel/debug/gpio will produce following output:
>
> # cat /debug/gpio
> ...
> GPIOs 160-191, platform/4805d000.gpio, gpio:
> gpio-171 ((null) ) in hi IRQ
>
> GPIOs 192-223, platform/48051000.gpio, gpio:
> gpio-203 (vtt_fixed ) out hi
>
> Cc: Johan Hovold <[email protected]>
> Signed-off-by: Grygorii Strashko <[email protected]>
OK why not.
Patch applied.
Yours,
Linus Walleij
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<[email protected]> wrote:
> This patch updates GPIO debugfs code to show Linux IRQ number
> for GPIOs requested as irq.
>
> After this patch sys/kernel/debug/gpio will produce following output:
> ...
> GPIOs 160-191, platform/4805d000.gpio, gpio:
> gpio-171 ((null) ) in hi IRQ-209
>
> Cc: Johan Hovold <[email protected]>
> Signed-off-by: Grygorii Strashko <[email protected]>
Patch applied.
Yours,
Linus Walleij
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<[email protected]> wrote:
> Now many of GPIO drivers implement two interfaces gpiolib and irqchip
> which are essentially orthogonal. So, now GPIO line can be requested
> in three ways:
> 1) As pure GPIO (gpioX_request())
> 2) As pure GPIO IRQ, especially in DT boot case.
> DT:
> interrupt-parent = <&gpio6>;
> interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
> Code:
> platform_get_irq() or of_irq_get()
> request_irq()
> 3) combination of (1) and (2).
>
> And from GPIO debugfs it could be identified when GPIO is
> requested/used or used as IRQ, but there is no way to determine
> when GPIO is requested/used as IRQ only.
>
> Such information is useful for debugging, so update GPIO debugfs code
> to show marker '<irq-only>' for GPIO lines which are requested/used as
> GPIO IRQ only.
>
> After this patch sys/kernel/debug/gpio will produce following output:
> ...
> GPIOs 160-191, platform/4805d000.gpio, gpio:
> gpio-171 ((null) ) in hi IRQ-209 <irq-only>
>
> GPIOs 192-223, platform/48051000.gpio, gpio:
> gpio-203 (vtt_fixed ) out hi
>
> Cc: Johan Hovold <[email protected]>
> Signed-off-by: Grygorii Strashko <[email protected]>
Patch applied.
Yours,
Linus Walleij