* [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
@ 2025-04-14 15:38 Biju Das
2025-05-05 12:34 ` Geert Uytterhoeven
0 siblings, 1 reply; 12+ messages in thread
From: Biju Das @ 2025-04-14 15:38 UTC (permalink / raw)
To: Geert Uytterhoeven, Magnus Damm, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Biju Das, linux-renesas-soc, devicetree, Prabhakar Mahadev Lad,
Biju Das
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@bp.renesas.com>
---
.../boot/dts/renesas/r9a09g047e57-smarc.dts | 27 +++++++++++++++++
.../boot/dts/renesas/renesas-smarc2.dtsi | 30 +++++++++++++++++++
2 files changed, 57 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
index 5d7983812c70..246327a19527 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
@@ -8,9 +8,18 @@
/dts-v1/;
/* Switch selection settings */
+#define SW_LCD_EN 0
#define SW_SD0_DEV_SEL 0
#define SW_SDIO_M2E 0
+#define PMOD_GPIO4 0
+#define PMOD_GPIO6 0
+#define PMOD_GPIO7 0
+
+#define KEY_1_GPIO RZG3E_GPIO(3, 1)
+#define KEY_2_GPIO RZG3E_GPIO(8, 4)
+#define KEY_3_GPIO RZG3E_GPIO(8, 5)
+
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/pinctrl/renesas,r9a09g047-pinctrl.h>
#include "r9a09g047e57.dtsi"
@@ -33,6 +42,24 @@ vqmmc_sd1_pvdd: regulator-vqmmc-sd1-pvdd {
};
};
+&keys{
+#if PMOD_GPIO4
+ /delete-node/ key-1;
+#endif
+
+#if SW_LCD_EN || PMOD_GPIO6
+ /delete-node/ key-2;
+#endif
+
+#if SW_LCD_EN || PMOD_GPIO7
+ /delete-node/ key-3;
+#endif
+};
+
+#if SW_LCD_EN && PMOD_GPIO4 && PMOD_GPIO6 && PMOD_GPIO7
+ /delete-node/ keys;
+#endif
+
&pinctrl {
scif_pins: scif {
pins = "SCIF_TXD", "SCIF_RXD";
diff --git a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
index fd82df8adc1e..84fb955ad77b 100644
--- 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>;
+ linux,code = <KEY_1>;
+ label = "USER_SW1";
+ debounce-interval = <20>;
+ };
+
+ key-2 {
+ interrupts-extended = <&pinctrl KEY_2_GPIO IRQ_TYPE_EDGE_FALLING>;
+ linux,code = <KEY_2>;
+ label = "USER_SW2";
+ debounce-interval = <20>;
+ };
+
+ key-3 {
+ interrupts-extended = <&pinctrl KEY_3_GPIO IRQ_TYPE_EDGE_FALLING>;
+ linux,code = <KEY_3>;
+ label = "USER_SW3";
+ debounce-interval = <20>;
+ };
+ };
};
&scif0 {
--
2.43.0
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-04-14 15:38 [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys Biju Das
@ 2025-05-05 12:34 ` Geert Uytterhoeven
2025-07-01 11:40 ` Biju Das
0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2025-05-05 12:34 UTC (permalink / raw)
To: Biju Das
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc, devicetree, Prabhakar Mahadev Lad, Biju Das
Hi Biju,
On Mon, 14 Apr 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
Thanks for your patch, which conflicts with your CANFD patch that
I have just applied.
> --- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
> +++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
> @@ -8,9 +8,18 @@
> /dts-v1/;
>
> /* Switch selection settings */
> +#define SW_LCD_EN 0
> #define SW_SD0_DEV_SEL 0
> #define SW_SDIO_M2E 0
>
> +#define PMOD_GPIO4 0
> +#define PMOD_GPIO6 0
> +#define PMOD_GPIO7 0
> +
> +#define KEY_1_GPIO RZG3E_GPIO(3, 1)
> +#define KEY_2_GPIO RZG3E_GPIO(8, 4)
> +#define KEY_3_GPIO RZG3E_GPIO(8, 5)
Please drop the extra spaces after the define keywords.
> +
> #include <dt-bindings/gpio/gpio.h>
> #include <dt-bindings/pinctrl/renesas,r9a09g047-pinctrl.h>
> #include "r9a09g047e57.dtsi"
> @@ -33,6 +42,24 @@ vqmmc_sd1_pvdd: regulator-vqmmc-sd1-pvdd {
> };
> };
>
> +&keys{
> +#if PMOD_GPIO4
> + /delete-node/ key-1;
> +#endif
> +
> +#if SW_LCD_EN || PMOD_GPIO6
> + /delete-node/ key-2;
> +#endif
> +
> +#if SW_LCD_EN || PMOD_GPIO7
> + /delete-node/ key-3;
> +#endif
> +};
> +
> +#if SW_LCD_EN && PMOD_GPIO4 && PMOD_GPIO6 && PMOD_GPIO7
"PMOD_GPIO4 && (SW_LCD_EN || (PMOD_GPIO6 && PMOD_GPIO7))"?
> + /delete-node/ keys;
> +#endif
> +
> &pinctrl {
> scif_pins: scif {
> pins = "SCIF_TXD", "SCIF_RXD";
> diff --git a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
> index fd82df8adc1e..84fb955ad77b 100644
> --- 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)?
Alternatively, can't you use them as gpios with interrupt facilities?
> + linux,code = <KEY_1>;
> + label = "USER_SW1";
> + debounce-interval = <20>;
> + };
> +
> + key-2 {
> + interrupts-extended = <&pinctrl KEY_2_GPIO IRQ_TYPE_EDGE_FALLING>;
> + linux,code = <KEY_2>;
> + label = "USER_SW2";
> + debounce-interval = <20>;
> + };
> +
> + key-3 {
> + interrupts-extended = <&pinctrl KEY_3_GPIO IRQ_TYPE_EDGE_FALLING>;
> + linux,code = <KEY_3>;
> + label = "USER_SW3";
> + debounce-interval = <20>;
> + };
> + };
> };
>
> &scif0 {
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-05-05 12:34 ` Geert Uytterhoeven
@ 2025-07-01 11:40 ` Biju Das
2025-07-01 11:49 ` Geert Uytterhoeven
0 siblings, 1 reply; 12+ messages in thread
From: Biju Das @ 2025-07-01 11:40 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Geert,
Thanks for the feedback.
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: 05 May 2025 13:34
> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>
> Hi Biju,
>
> On Mon, 14 Apr 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
>
> Thanks for your patch, which conflicts with your CANFD patch that I have just applied.
OK.
>
> > --- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
> > +++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
> > @@ -8,9 +8,18 @@
> > /dts-v1/;
> >
> > /* Switch selection settings */
> > +#define SW_LCD_EN 0
> > #define SW_SD0_DEV_SEL 0
> > #define SW_SDIO_M2E 0
> >
> > +#define PMOD_GPIO4 0
> > +#define PMOD_GPIO6 0
> > +#define PMOD_GPIO7 0
> > +
> > +#define KEY_1_GPIO RZG3E_GPIO(3, 1)
> > +#define KEY_2_GPIO RZG3E_GPIO(8, 4)
> > +#define KEY_3_GPIO RZG3E_GPIO(8, 5)
>
> Please drop the extra spaces after the define keywords.
OK.
>
> > +
> > #include <dt-bindings/gpio/gpio.h>
> > #include <dt-bindings/pinctrl/renesas,r9a09g047-pinctrl.h>
> > #include "r9a09g047e57.dtsi"
> > @@ -33,6 +42,24 @@ vqmmc_sd1_pvdd: regulator-vqmmc-sd1-pvdd {
> > };
> > };
> >
> > +&keys{
> > +#if PMOD_GPIO4
> > + /delete-node/ key-1;
> > +#endif
> > +
> > +#if SW_LCD_EN || PMOD_GPIO6
> > + /delete-node/ key-2;
> > +#endif
> > +
> > +#if SW_LCD_EN || PMOD_GPIO7
> > + /delete-node/ key-3;
> > +#endif
> > +};
> > +
> > +#if SW_LCD_EN && PMOD_GPIO4 && PMOD_GPIO6 && PMOD_GPIO7
>
> "PMOD_GPIO4 && (SW_LCD_EN || (PMOD_GPIO6 && PMOD_GPIO7))"?
OK.
>
> > + /delete-node/ keys;
> > +#endif
> > +
> > &pinctrl {
> > scif_pins: scif {
> > pins = "SCIF_TXD", "SCIF_RXD"; diff --git
> > a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
> > b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
> > index fd82df8adc1e..84fb955ad77b 100644
> > --- 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?
> 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?
Cheers,
Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-01 11:40 ` Biju Das
@ 2025-07-01 11:49 ` Geert Uytterhoeven
2025-07-01 14:38 ` Biju Das
0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2025-07-01 11:49 UTC (permalink / raw)
To: Biju Das
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Biju,
On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > On Mon, 14 Apr 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> > > --- 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").
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-01 11:49 ` Geert Uytterhoeven
@ 2025-07-01 14:38 ` Biju Das
2025-07-01 14:59 ` Biju Das
2025-07-03 7:17 ` Claudiu Beznea
0 siblings, 2 replies; 12+ messages in thread
From: Biju Das @ 2025-07-01 14:38 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Geert,
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> Sent: 01 July 2025 12:50
> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>
> Hi Biju,
>
> On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr 2025
> > > at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
>
> > > > --- 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
Cheers,
Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-01 14:38 ` Biju Das
@ 2025-07-01 14:59 ` Biju Das
2025-07-02 7:00 ` Geert Uytterhoeven
2025-07-03 7:17 ` Claudiu Beznea
1 sibling, 1 reply; 12+ messages in thread
From: Biju Das @ 2025-07-01 14:59 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
> -----Original Message-----
> From: Biju Das
> Sent: 01 July 2025 15:39
> Subject: RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>
> Hi Geert,
>
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > Sent: 01 July 2025 12:50
> > Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio
> > keys
> >
> > Hi Biju,
> >
> > On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr
> > > > 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> >
> > > > > --- 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
key-1 {
gpios = <&pinctrl KEY_1_GPIO GPIO_ACTIVE_LOW >;
linux,code = <KEY_1>;
label = "USER_SW1";
wakeup-source;
debounce-interval = <20>;
};
Cheers,
Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-01 14:59 ` Biju Das
@ 2025-07-02 7:00 ` Geert Uytterhoeven
2025-07-02 8:27 ` Biju Das
0 siblings, 1 reply; 12+ messages in thread
From: Geert Uytterhoeven @ 2025-07-02 7:00 UTC (permalink / raw)
To: Biju Das
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Biju,
On Tue, 1 Jul 2025 at 16:59, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > From: Biju Das
> > > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > > On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr
> > > > > 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> > >
> > > > > > --- 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@linux-m68k.org
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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-02 7:00 ` Geert Uytterhoeven
@ 2025-07-02 8:27 ` Biju Das
2025-07-02 8:30 ` Biju Das
0 siblings, 1 reply; 12+ messages in thread
From: Biju Das @ 2025-07-02 8:27 UTC (permalink / raw)
To: Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Geert,
> -----Original Message-----
> From: Geert Uytterhoeven <geert@linux-m68k.org>
> 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@bp.renesas.com> wrote:
> > > From: Biju Das
> > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Tue, 1 Jul 2025
> > > > at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr
> > > > > > 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> > > >
> > > > > > > --- 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
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-02 8:27 ` Biju Das
@ 2025-07-02 8:30 ` Biju Das
0 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2025-07-02 8:30 UTC (permalink / raw)
To: Biju Das, Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
> -----Original Message-----
> From: Biju Das <biju.das.jz@bp.renesas.com>
> Sent: 02 July 2025 09:27
> To: Geert Uytterhoeven <geert@linux-m68k.org>
> Cc: Magnus Damm <magnus.damm@gmail.com>; Rob Herring <robh@kernel.org>; Krzysztof Kozlowski
> <krzk+dt@kernel.org>; Conor Dooley <conor+dt@kernel.org>; linux-renesas-soc@vger.kernel.org;
> devicetree@vger.kernel.org; Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>;
> biju.das.au <biju.das.au@gmail.com>
> Subject: RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>
> Hi Geert,
>
> > -----Original Message-----
> > From: Geert Uytterhoeven <geert@linux-m68k.org>
> > 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@bp.renesas.com> wrote:
> > > > From: Biju Das
> > > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Tue, 1 Jul
> > > > > 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> > > > > > > From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14
> > > > > > > Apr
> > > > > > > 2025 at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> > > > >
> > > > > > > > --- 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/ke
> > > > yb
> > > > 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.
I will be sending next version with support got KEY_SLEEP. When user presses
SLEEP button, system enters into STR state and wake up is done by POWER button.
Cheers,
Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-01 14:38 ` Biju Das
2025-07-01 14:59 ` Biju Das
@ 2025-07-03 7:17 ` Claudiu Beznea
2025-07-03 7:42 ` Biju Das
1 sibling, 1 reply; 12+ messages in thread
From: Claudiu Beznea @ 2025-07-03 7:17 UTC (permalink / raw)
To: Biju Das, Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi, Biju,
On 01.07.2025 17:38, Biju Das wrote:
> Hi Geert,
>
>> -----Original Message-----
>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>> Sent: 01 July 2025 12:50
>> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>>
>> Hi Biju,
>>
>> On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
>>>> From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr 2025
>>>> at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
>>
>>>>> --- 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.
If I clearly understand it, this has been solved on RZ/G3S SMARC Carrier-II
by defining these pins as gpio hogs:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi#n141
Thank you,
Claudiu
>
> That is the reason using interrupt directly.
>
> [1]
> https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/input/keyboard/gpio_keys.c#L980
>
>
> Cheers,
> Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-03 7:17 ` Claudiu Beznea
@ 2025-07-03 7:42 ` Biju Das
2025-07-03 8:35 ` Claudiu Beznea
0 siblings, 1 reply; 12+ messages in thread
From: Biju Das @ 2025-07-03 7:42 UTC (permalink / raw)
To: Claudiu.Beznea, Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi Claudiu,
> -----Original Message-----
> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
> Sent: 03 July 2025 08:17
> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>
> Hi, Biju,
>
> On 01.07.2025 17:38, Biju Das wrote:
> > Hi Geert,
> >
> >> -----Original Message-----
> >> From: Geert Uytterhoeven <geert@linux-m68k.org>
> >> Sent: 01 July 2025 12:50
> >> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add
> >> gpio keys
> >>
> >> Hi Biju,
> >>
> >> On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
> >>>> From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr 2025
> >>>> at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
> >>
> >>>>> --- 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.
>
> If I clearly understand it, this has been solved on RZ/G3S SMARC Carrier-II by defining these pins as
> gpio hogs:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/renesas/rz
> g3s-smarc.dtsi#n141
Looks like it is redundant, you may need to take out the gpio hog node as
pinctrl driver already configure the pin as input pin[1].
As per [2], still it is not GPIOs with interrupt-capability.
[1]
https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/pinctrl/renesas/pinctrl-rzg2l.c#L2534
[2]
https://elixir.bootlin.com/linux/v6.16-rc4/source/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi#L30
Cheers,
Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
2025-07-03 7:42 ` Biju Das
@ 2025-07-03 8:35 ` Claudiu Beznea
0 siblings, 0 replies; 12+ messages in thread
From: Claudiu Beznea @ 2025-07-03 8:35 UTC (permalink / raw)
To: Biju Das, Geert Uytterhoeven
Cc: Magnus Damm, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org,
Prabhakar Mahadev Lad, biju.das.au
Hi, Biju,
On 03.07.2025 10:42, Biju Das wrote:
> Hi Claudiu,
>
>> -----Original Message-----
>> From: Claudiu Beznea <claudiu.beznea@tuxon.dev>
>> Sent: 03 July 2025 08:17
>> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys
>>
>> Hi, Biju,
>>
>> On 01.07.2025 17:38, Biju Das wrote:
>>> Hi Geert,
>>>
>>>> -----Original Message-----
>>>> From: Geert Uytterhoeven <geert@linux-m68k.org>
>>>> Sent: 01 July 2025 12:50
>>>> Subject: Re: [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add
>>>> gpio keys
>>>>
>>>> Hi Biju,
>>>>
>>>> On Tue, 1 Jul 2025 at 13:40, Biju Das <biju.das.jz@bp.renesas.com> wrote:
>>>>>> From: Geert Uytterhoeven <geert@linux-m68k.org> On Mon, 14 Apr 2025
>>>>>> at 17:38, Biju Das <biju.das.jz@bp.renesas.com> 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@bp.renesas.com>
>>>>
>>>>>>> --- 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.
>>
>> If I clearly understand it, this has been solved on RZ/G3S SMARC Carrier-II by defining these pins as
>> gpio hogs:
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/renesas/rz
>> g3s-smarc.dtsi#n141
>
> Looks like it is redundant, you may need to take out the gpio hog node as
> pinctrl driver already configure the pin as input pin[1].
The pinctrl support wasn't there at the moment gpio hog was introduced.
>
> As per [2], still it is not GPIOs with interrupt-capability.
OK, the I must have been wrong. I haven't looked in deep over this thread.
Sorry for the noise,
Claudiu
>
> [1]
> https://elixir.bootlin.com/linux/v6.16-rc4/source/drivers/pinctrl/renesas/pinctrl-rzg2l.c#L2534
> [2]
> https://elixir.bootlin.com/linux/v6.16-rc4/source/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi#L30
>
>
> Cheers,
> Biju
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2025-07-03 8:35 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-14 15:38 [PATCH] arm64: dts: renesas: r9a09g047e57-smarc: Add gpio keys Biju Das
2025-05-05 12:34 ` Geert Uytterhoeven
2025-07-01 11:40 ` Biju Das
2025-07-01 11:49 ` Geert Uytterhoeven
2025-07-01 14:38 ` Biju Das
2025-07-01 14:59 ` Biju Das
2025-07-02 7:00 ` Geert Uytterhoeven
2025-07-02 8:27 ` Biju Das
2025-07-02 8:30 ` Biju Das
2025-07-03 7:17 ` Claudiu Beznea
2025-07-03 7:42 ` Biju Das
2025-07-03 8:35 ` Claudiu Beznea
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).