Hi Geert, > -----Original Message----- > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> > Sent: 02 July 2025 08:01 > Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys > > Hi Biju, > > On Tue, 1 Jul 2025 at 16:59, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote: > > > From: Biju Das > > > > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> On Tue, 1 Jul 2025 > > > > at 13:40, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote: > > > > > > From: Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> On Mon, 14 Apr > > > > > > 2025 at 17:38, Biju Das <biju.das.jz@xxxxxxxxxxxxxx> wrote: > > > > > > > RZ/G3E SMARC EVK has 3 user buttons called USER_SW1, > > > > > > > USER_SW2 and USER_SW3. Add a DT node in device tree to > > > > > > > instantiate the gpio-keys driver for these buttons. > > > > > > > > > > > > > > Signed-off-by: Biju Das <biju.das.jz@xxxxxxxxxxxxxx> > > > > > > > > > > > --- a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi > > > > > > > +++ b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi > > > > > > > @@ -12,8 +12,13 @@ > > > > > > > * SW_SDIO_M2E: > > > > > > > * 0 - SMARC SDIO signal is connected to uSD1 > > > > > > > * 1 - SMARC SDIO signal is connected to M.2 Key E connector > > > > > > > + * > > > > > > > + * GPIO keys are enabled by default. Use PMOD_GPIO macros > > > > > > > + to disable them > > > > > > > + * if needed. > > > > > > > */ > > > > > > > > > > > > > > +#include <dt-bindings/input/input.h> > > > > > > > + > > > > > > > / { > > > > > > > model = "Renesas RZ SMARC Carrier-II Board"; > > > > > > > compatible = "renesas,smarc2-evk"; @@ -27,6 +32,31 > > > > > > > @@ aliases { > > > > > > > serial3 = &scif0; > > > > > > > mmc1 = &sdhi1; > > > > > > > }; > > > > > > > + > > > > > > > + keys: keys { > > > > > > > + compatible = "gpio-keys"; > > > > > > > + > > > > > > > + key-1 { > > > > > > > + interrupts-extended = <&pinctrl > > > > > > > + KEY_1_GPIO IRQ_TYPE_EDGE_FALLING>; > > > > > > > > > > > > So you are using them as interrupts. Don't you need to > > > > > > configure pin control for that (function 15 = IRQ14)? > > > > > > > > > > The same pin can be configured as TINT or IRQ15, currently it is configured as TINT IRQ. > > > > > Is it ok? > > > > > > > > OK. > > > > > > > > > > Alternatively, can't you use them as gpios with interrupt facilities? > > > > > > > > > > interrupts-extended = <&pinctrl KEY_1_GPIO > > > > > IRQ_TYPE_EDGE_FALLING>; > > > > > > > > > > The TINT IRQ will provide the same right? Am I missing anything here? > > > > > > > > When you use interrupts directly, the system will detect only key > > > > presses, and fake (timer-based) key releases. > > > > When you use GPIOs with interrupt-capability, the system can detect both key presses and > releases. > > > > > > > > See also commit cab3511ea7a0b1fc ("ARM: dts: marzen: Add slide switches"). > > > > > > As per [1], for GPIOs with interrupt-capability, IRQ controller needs to support both edges. > > > But TINT supports Rising or Falling edge, but not both. So, we cannot use this. > > > > > > That is the reason using interrupt directly. > > > > > > [1] > > > https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/input/keyb > > > oard/gpio_keys.c#L980 > > > > This is the error message I get if set gpio with irq capability > > > > [ 2.191819] genirq: Setting trigger mode 3 for irq 51 failed (rzg2l_gpio_irq_set_type+0x0/0x14) > > [ 2.204168] gpio-keys keys: Unable to claim irq 51; error -22 > > [ 2.210018] gpio-keys keys: probe with driver gpio-keys failed with error -22 > > So interrupts = <...> it shall be... OK. Thanks, Biju