From: Biju Das <biju.das.jz@bp.renesas.com>
To: Marc Zyngier <maz@kernel.org>
Cc: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>,
Linus Walleij <linus.walleij@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Philipp Zabel <p.zabel@pengutronix.de>,
"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
Phil Edworthy <phil.edworthy@renesas.com>
Subject: RE: [PATCH v3 5/5] pinctrl: renesas: pinctrl-rzg2l: Add IRQ domain to handle GPIO interrupt
Date: Mon, 16 May 2022 07:20:47 +0000 [thread overview]
Message-ID: <OS0PR01MB5922C5E362A582509A814C1586CF9@OS0PR01MB5922.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <87pmkfm0v3.wl-maz@kernel.org>
Hi Marc,
Thanks for the feedback.
> Subject: Re: [PATCH v3 5/5] pinctrl: renesas: pinctrl-rzg2l: Add IRQ domain
> to handle GPIO interrupt
>
> On Sun, 15 May 2022 06:13:22 +0100,
> Biju Das <biju.das.jz@bp.renesas.com> wrote:
> >
> > Hi Prabhakar,
> >
> > Thanks for the example.
> >
> > > Subject: Re: [PATCH v3 5/5] pinctrl: renesas: pinctrl-rzg2l: Add IRQ
> > > domain to handle GPIO interrupt
> > >
> > > > But "offset" is a number from the GPIO offset space (0-122), while
> > >
> > > The "offset" reported by kernel is 120-511:
> > >
> > > root@smarc-rzg2l:~# cat /sys/kernel/debug/gpio
> > > gpiochip0: GPIOs 120-511, parent: platform/11030000.pinctrl,
> > > 11030000.pinctrl:
> > > gpio-120 (P0_0 )
> > > gpio-121 (P0_1 )
> > > gpio-122 (P0_2 )
> > > gpio-123 (P0_3 )
> > > gpio-124 (P0_4 )
> > > .....
> > > gpio-507 (P48_3 )
> > > gpio-508 (P48_4 )
> > > gpio-509 (P48_5 )
> > > gpio-510 (P48_6 )
> > > gpio-511 (P48_7 )
> > >
> > > > irq_find_mapping() expects a number from the domain's IRQ space,
> > > > which is only 0-31?
> > > >
> > > Nope, let me demonstrate with an example, I have configured the gpio
> > > pins as GPIO keys in DTS:
> > >
> > > + keyboard {
> > > + compatible = "gpio-keys";
> > > + status = "okay";
> > > +
> > > + key-1 {
> > > + gpios = <&pinctrl RZG2L_GPIO(43, 0)
> > > GPIO_ACTIVE_HIGH>;
> > > + linux,code = <KEY_1>;
> > > + linux,input-type = <EV_KEY>;
> > > + wakeup-source;
> > > + label = "SW1";
> > > + };
> > > +
> > > + key-2 {
> > > + gpios = <&pinctrl RZG2L_GPIO(41, 0)
> > > GPIO_ACTIVE_HIGH>;
> > > + linux,code = <KEY_2>;
> > > + linux,input-type = <EV_KEY>;
> > > + wakeup-source;
> > > + label = "SW2";
> > > + };
> > > +
> > > + key-3 {
> > > + gpios = <&pinctrl RZG2L_GPIO(43, 1)
> > > GPIO_ACTIVE_HIGH>;
> > > + linux,code = <KEY_3>;
> > > + linux,input-type = <EV_KEY>;
> > > + wakeup-source;
> > > + label = "SW3";
> > > + };
> > > + };
> > >
> > > root@smarc-rzg2l:~# cat /proc/interrupts | grep SW
> > > root@smarc-rzg2l:~# root@smarc-rzg2l:~# insmod gpio_keys.ko [
> > > 925.002720] input: keyboard as
> > > /devices/platform/keyboard/input/input3
> > > root@smarc-rzg2l:~# cat /proc/interrupts | grep SW
> > > 82: 0 0 11030000.pinctrl 344 Edge SW1
> > > 83: 0 0 11030000.pinctrl 328 Edge SW2
> > > 84: 0 0 11030000.pinctrl 345 Edge SW3
> > > root@smarc-rzg2l:~#
> > >
> > > In here 82/83/84 are virq and 344/328/345 are hwirq, which can be
> > > confirmed from sysfs file:
> >
> > From your example, Looks like
> >
> > I believe from interrupt statistics point of view, cat
> > /proc/interrupts should report actual gpioint number (0->122)
> > corresponding to pin index for SW1, SW2 and SW3 ??
>
> No. There is no need for such userspace-visible behaviour. Userspace has no
> business tracking those. The required information is in debugfs, and that
> more than enough.
Ok, So far I used cat /proc/interrupts for debugging, since I don't need to enable DEBUG config for
Enabling Debugfs for irq. This Debugfs irq is new info to me.
Our hardware manual has below info for usb-phy irq
2H0_OBINT 126(InterruptID) SPI 94 IRQ 94 Level
cat /proc/interrupts matches with GICV3 Interrupt ID/ type in the HW manual
113: 0 0 GICv3 126 Level 11c50200.usb-phy
Debugfs is also showing similar info like hwirq and interrupt type. But I don't know which field corresponds to number
of interrupts?
root@smarc-rzg2l:~# cat /sys/kernel/debug/irq/irqs/113
handler: handle_fasteoi_irq
device: (null)
status: 0x00000104
istate: 0x00000000
ddepth: 0
wdepth: 0
dstate: 0x13402204
IRQ_TYPE_LEVEL_HIGH
IRQD_LEVEL
IRQD_ACTIVATED
IRQD_IRQ_STARTED
IRQD_SINGLE_TARGET
IRQD_DEFAULT_TRIGGER_SET
IRQD_HANDLE_ENFORCE_IRQCTX
node: 0
affinity: 0-1
effectiv: 0
domain: :soc:interrupt-controller@11900000-1
hwirq: 0x7e
chip: GICv3
flags: 0x15
IRQCHIP_SET_TYPE_MASKED
IRQCHIP_MASK_ON_SUSPEND
IRQCHIP_SKIP_SET_WAKE
Now coming to current case,
Currently GPIO INT 0-122(123 interrupts) corresponding to 120-511(291 interrupts) with same invalid lines.
From a debugging point, If user has put same irq name for gpioints(cat /proc/interrupts case), then how do we distinguish these interrupts??
(using hwirq??)
For using Debugfs, Do we need to first execute cat /proc/interrupts to get virq and from there we need to use virq to get statistics, right?
Cheers,
Biju
next prev parent reply other threads:[~2022-05-16 7:20 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 18:32 [PATCH v3 0/5] Renesas RZ/G2L IRQC support Lad Prabhakar
2022-05-11 18:32 ` [PATCH v3 1/5] dt-bindings: interrupt-controller: Add Renesas RZ/G2L Interrupt Controller Lad Prabhakar
2022-05-12 6:14 ` Biju Das
2022-05-12 6:43 ` Geert Uytterhoeven
2022-05-12 17:58 ` Lad, Prabhakar
2022-05-11 18:32 ` [PATCH v3 2/5] irqchip: Add RZ/G2L IA55 Interrupt Controller driver Lad Prabhakar
2022-05-11 19:25 ` Biju Das
2022-05-12 18:01 ` Lad, Prabhakar
2022-05-12 7:05 ` Geert Uytterhoeven
2022-05-12 7:23 ` Marc Zyngier
2022-05-12 7:26 ` Geert Uytterhoeven
2022-05-12 18:08 ` Lad, Prabhakar
2022-05-11 18:32 ` [PATCH v3 3/5] gpio: gpiolib: Allow free() callback to be overridden Lad Prabhakar
2022-05-12 7:06 ` Geert Uytterhoeven
2022-05-12 11:19 ` Marc Zyngier
2022-05-12 12:48 ` Lad, Prabhakar
2022-05-12 13:24 ` Marc Zyngier
2022-05-12 13:50 ` Lad, Prabhakar
2022-05-12 16:26 ` Marc Zyngier
2022-05-12 17:55 ` Lad, Prabhakar
2022-05-12 22:24 ` Marc Zyngier
2022-05-11 18:32 ` [PATCH v3 4/5] gpio: gpiolib: Add ngirq member to struct gpio_irq_chip Lad Prabhakar
2022-05-12 7:29 ` Geert Uytterhoeven
2022-05-18 18:30 ` Lad, Prabhakar
2022-05-13 20:47 ` Linus Walleij
2022-05-18 18:36 ` Lad, Prabhakar
2022-05-19 13:21 ` Linus Walleij
2022-05-11 18:32 ` [PATCH v3 5/5] pinctrl: renesas: pinctrl-rzg2l: Add IRQ domain to handle GPIO interrupt Lad Prabhakar
2022-05-12 5:35 ` Biju Das
2022-05-12 17:43 ` Lad, Prabhakar
2022-05-12 17:59 ` Biju Das
2022-05-13 6:12 ` Biju Das
2022-05-13 13:42 ` Lad, Prabhakar
2022-05-12 7:39 ` Geert Uytterhoeven
2022-05-12 17:36 ` Lad, Prabhakar
2022-05-13 6:53 ` Geert Uytterhoeven
2022-05-13 13:55 ` Lad, Prabhakar
2022-05-13 14:29 ` Geert Uytterhoeven
2022-05-13 18:13 ` Lad, Prabhakar
2022-05-15 5:13 ` Biju Das
[not found] ` <87pmkfm0v3.wl-maz@kernel.org>
2022-05-16 7:20 ` Biju Das [this message]
[not found] ` <87pmkd6gda.wl-maz@kernel.org>
2022-05-16 8:33 ` Biju Das
[not found] ` <87o7zx6ckp.wl-maz@kernel.org>
2022-05-16 9:56 ` Biju Das
2022-05-16 7:13 ` Geert Uytterhoeven
2022-05-18 19:04 ` Lad, Prabhakar
2022-05-12 11:15 ` Marc Zyngier
2022-05-12 17:46 ` Lad, Prabhakar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=OS0PR01MB5922C5E362A582509A814C1586CF9@OS0PR01MB5922.jpnprd01.prod.outlook.com \
--to=biju.das.jz@bp.renesas.com \
--cc=brgl@bgdev.pl \
--cc=devicetree@vger.kernel.org \
--cc=geert@linux-m68k.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=maz@kernel.org \
--cc=p.zabel@pengutronix.de \
--cc=phil.edworthy@renesas.com \
--cc=prabhakar.csengg@gmail.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.