* [PATCH v2 1/3] gpiolib: debugfs: display gpios requested as irq only
2015-05-20 10:30 [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Grygorii Strashko
@ 2015-05-20 10:30 ` Grygorii Strashko
2015-06-01 12:50 ` Linus Walleij
2015-05-20 10:30 ` [PATCH v2 2/3] gpiolib: debugfs: show linux irq number for gpios requested as irq Grygorii Strashko
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Grygorii Strashko @ 2015-05-20 10:30 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko, Johan Hovold
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 <johan@kernel.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/3] gpiolib: debugfs: display gpios requested as irq only
2015-05-20 10:30 ` [PATCH v2 1/3] gpiolib: debugfs: display gpios requested as irq only Grygorii Strashko
@ 2015-06-01 12:50 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2015-06-01 12:50 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<grygorii.strashko@linaro.org> 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 <johan@kernel.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
OK why not.
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 2/3] gpiolib: debugfs: show linux irq number for gpios requested as irq
2015-05-20 10:30 [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Grygorii Strashko
2015-05-20 10:30 ` [PATCH v2 1/3] gpiolib: debugfs: display gpios requested as irq only Grygorii Strashko
@ 2015-05-20 10:30 ` Grygorii Strashko
2015-06-01 12:51 ` Linus Walleij
2015-05-20 10:30 ` [PATCH v2 3/3] gpiolib: debugfs: identify gpios requested as irq only Grygorii Strashko
2015-05-21 4:02 ` [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Alexandre Courbot
3 siblings, 1 reply; 8+ messages in thread
From: Grygorii Strashko @ 2015-05-20 10:30 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko, Johan Hovold
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 <johan@kernel.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/3] gpiolib: debugfs: show linux irq number for gpios requested as irq
2015-05-20 10:30 ` [PATCH v2 2/3] gpiolib: debugfs: show linux irq number for gpios requested as irq Grygorii Strashko
@ 2015-06-01 12:51 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2015-06-01 12:51 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<grygorii.strashko@linaro.org> 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 <johan@kernel.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 3/3] gpiolib: debugfs: identify gpios requested as irq only
2015-05-20 10:30 [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Grygorii Strashko
2015-05-20 10:30 ` [PATCH v2 1/3] gpiolib: debugfs: display gpios requested as irq only Grygorii Strashko
2015-05-20 10:30 ` [PATCH v2 2/3] gpiolib: debugfs: show linux irq number for gpios requested as irq Grygorii Strashko
@ 2015-05-20 10:30 ` Grygorii Strashko
2015-06-01 12:52 ` Linus Walleij
2015-05-21 4:02 ` [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Alexandre Courbot
3 siblings, 1 reply; 8+ messages in thread
From: Grygorii Strashko @ 2015-05-20 10:30 UTC (permalink / raw)
To: Linus Walleij, Alexandre Courbot
Cc: linux-gpio, linux-kernel, Grygorii Strashko, Johan Hovold
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 <johan@kernel.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
---
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/3] gpiolib: debugfs: identify gpios requested as irq only
2015-05-20 10:30 ` [PATCH v2 3/3] gpiolib: debugfs: identify gpios requested as irq only Grygorii Strashko
@ 2015-06-01 12:52 ` Linus Walleij
0 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2015-06-01 12:52 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold
On Wed, May 20, 2015 at 12:30 PM, Grygorii Strashko
<grygorii.strashko@linaro.org> 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 <johan@kernel.org>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@linaro.org>
Patch applied.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq
2015-05-20 10:30 [PATCH v2 0/3] gpiolib: debugfs: update to show more info for gpios requested as irq Grygorii Strashko
` (2 preceding siblings ...)
2015-05-20 10:30 ` [PATCH v2 3/3] gpiolib: debugfs: identify gpios requested as irq only Grygorii Strashko
@ 2015-05-21 4:02 ` Alexandre Courbot
3 siblings, 0 replies; 8+ messages in thread
From: Alexandre Courbot @ 2015-05-21 4:02 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Linus Walleij, linux-gpio, Linux Kernel Mailing List, Johan Hovold
On Wed, May 20, 2015 at 7:30 PM, Grygorii Strashko
<grygorii.strashko@linaro.org> 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 <acourbot@nvidia.com>
^ permalink raw reply [flat|nested] 8+ messages in thread