Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/keyboard/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...

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux