linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys
@ 2023-12-27 13:08 Claudiu
  2024-01-12 13:55 ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Claudiu @ 2023-12-27 13:08 UTC (permalink / raw)
  To: geert+renesas, magnus.damm, robh+dt, krzysztof.kozlowski+dt, conor+dt
  Cc: linux-renesas-soc, devicetree, linux-kernel, claudiu.beznea,
	Claudiu Beznea

From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

RZ SMARC Carrier II board has 3 user buttons called USER_SW1, USER_SW2,
USER_SW3. Add a DT node in device tree to propertly instantiate the
gpio-keys driver for these buttons.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
---
 arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi | 53 ++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
index 214520137230..deb2ad37bb2e 100644
--- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
@@ -6,6 +6,7 @@
  */
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
 
 / {
@@ -14,6 +15,37 @@ aliases {
 		mmc1 = &sdhi1;
 	};
 
+	keys {
+		compatible = "gpio-keys";
+
+		key-1 {
+			interrupts = <RZG2L_GPIO(18, 0) IRQ_TYPE_EDGE_FALLING>;
+			interrupt-parent = <&pinctrl>;
+			linux,code = <KEY_1>;
+			label = "USER_SW1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+
+		key-2 {
+			interrupts = <RZG2L_GPIO(0, 1) IRQ_TYPE_EDGE_FALLING>;
+			interrupt-parent = <&pinctrl>;
+			linux,code = <KEY_2>;
+			label = "USER_SW2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+
+		key-3 {
+			interrupts = <RZG2L_GPIO(0, 3) IRQ_TYPE_EDGE_FALLING>;
+			interrupt-parent = <&pinctrl>;
+			linux,code = <KEY_3>;
+			label = "USER_SW3";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+	};
+
 	vcc_sdhi1: regulator-vcc-sdhi1 {
 		compatible = "regulator-fixed";
 		regulator-name = "SDHI1 Vcc";
@@ -35,6 +67,27 @@ vccq_sdhi1: regulator-vccq-sdhi1 {
 };
 
 &pinctrl {
+	key-1-gpio-hog {
+		gpio-hog;
+		gpios = <RZG2L_GPIO(18, 0) GPIO_ACTIVE_LOW>;
+		input;
+		line-name = "key-1-gpio-irq";
+	};
+
+	key-2-gpio-hog {
+		gpio-hog;
+		gpios = <RZG2L_GPIO(0, 1) GPIO_ACTIVE_LOW>;
+		input;
+		line-name = "key-2-gpio-irq";
+	};
+
+	key-3-gpio-hog {
+		gpio-hog;
+		gpios = <RZG2L_GPIO(0, 3) GPIO_ACTIVE_LOW>;
+		input;
+		line-name = "key-3-gpio-irq";
+	};
+
 	scif0_pins: scif0 {
 		pinmux = <RZG2L_PORT_PINMUX(6, 3, 1)>, /* RXD */
 			 <RZG2L_PORT_PINMUX(6, 4, 1)>; /* TXD */
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys
  2023-12-27 13:08 [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys Claudiu
@ 2024-01-12 13:55 ` Geert Uytterhoeven
  2024-01-12 15:38   ` claudiu beznea
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2024-01-12 13:55 UTC (permalink / raw)
  To: Claudiu
  Cc: geert+renesas, magnus.damm, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux-renesas-soc, devicetree, linux-kernel,
	Claudiu Beznea

Hi Claudiu,

On Wed, Dec 27, 2023 at 2:08 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> RZ SMARC Carrier II board has 3 user buttons called USER_SW1, USER_SW2,
> USER_SW3. Add a DT node in device tree to propertly instantiate the
> gpio-keys driver for these buttons.
>
> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> @@ -6,6 +6,7 @@
>   */
>
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
>  #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
>
>  / {
> @@ -14,6 +15,37 @@ aliases {
>                 mmc1 = &sdhi1;
>         };
>
> +       keys {

Do you mind if I s/keys/keypad/ while applying? ...

> +               compatible = "gpio-keys";
> +
> +               key-1 {
> +                       interrupts = <RZG2L_GPIO(18, 0) IRQ_TYPE_EDGE_FALLING>;

Oh, the horror of interrupt controllers that don't support generating
interrupts on both edges...

> +                       interrupt-parent = <&pinctrl>;

... and move these one level up, to avoid duplication?

> +                       linux,code = <KEY_1>;
> +                       label = "USER_SW1";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +
> +               key-2 {
> +                       interrupts = <RZG2L_GPIO(0, 1) IRQ_TYPE_EDGE_FALLING>;
> +                       interrupt-parent = <&pinctrl>;
> +                       linux,code = <KEY_2>;
> +                       label = "USER_SW2";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +
> +               key-3 {
> +                       interrupts = <RZG2L_GPIO(0, 3) IRQ_TYPE_EDGE_FALLING>;
> +                       interrupt-parent = <&pinctrl>;
> +                       linux,code = <KEY_3>;
> +                       label = "USER_SW3";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +       };
> +
>         vcc_sdhi1: regulator-vcc-sdhi1 {
>                 compatible = "regulator-fixed";
>                 regulator-name = "SDHI1 Vcc";

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
i.e. will queue in renesas-devel for v6.9, with the above fixed.

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] 5+ messages in thread

* Re: [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys
  2024-01-12 13:55 ` Geert Uytterhoeven
@ 2024-01-12 15:38   ` claudiu beznea
  2024-01-12 16:20     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: claudiu beznea @ 2024-01-12 15:38 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: geert+renesas, magnus.damm, robh+dt, krzysztof.kozlowski+dt,
	conor+dt, linux-renesas-soc, devicetree, linux-kernel,
	Claudiu Beznea

Hi, Geert,

On 12.01.2024 15:55, Geert Uytterhoeven wrote:
> Hi Claudiu,
> 
> On Wed, Dec 27, 2023 at 2:08 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>
>> RZ SMARC Carrier II board has 3 user buttons called USER_SW1, USER_SW2,
>> USER_SW3. Add a DT node in device tree to propertly instantiate the
>> gpio-keys driver for these buttons.
>>
>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> 
> Thanks for your patch!
> 
>> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
>> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
>> @@ -6,6 +6,7 @@
>>   */
>>
>>  #include <dt-bindings/gpio/gpio.h>
>> +#include <dt-bindings/input/input.h>
>>  #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
>>
>>  / {
>> @@ -14,6 +15,37 @@ aliases {
>>                 mmc1 = &sdhi1;
>>         };
>>
>> +       keys {
> 
> Do you mind if I s/keys/keypad/ while applying? ...

Is not actually a keypad... there are 3 buttons in a corner of the board...

I see only 2 entries in arm64 and arm DTS directory following this pattern
for gpio-keys compatible node:

 arch/arm/boot/dts/renesas/r8a7779-marzen.dts
 arch/arm/boot/dts/renesas/r8a7779-marzen.dts

But if you prefer it like this, I have nothing against.

Just asking, do you have a particular reason for naming it like this?

> 
>> +               compatible = "gpio-keys";
>> +
>> +               key-1 {
>> +                       interrupts = <RZG2L_GPIO(18, 0) IRQ_TYPE_EDGE_FALLING>;
> 
> Oh, the horror of interrupt controllers that don't support generating
> interrupts on both edges...

Yes.

> 
>> +                       interrupt-parent = <&pinctrl>;
> 
> ... and move these one level up, to avoid duplication?

Moving it just near compatible will make the schema validation to fail with
this (driver is working, though):

arch/arm64/boot/dts/renesas/r9a08g045s33-smarc.dtb: keys:
'interrupt-parent' does not match any of the regexes:
'^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$',
'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/input/gpio-keys.yaml#

Thank  you,
Claudiu Beznea

> 
>> +                       linux,code = <KEY_1>;
>> +                       label = "USER_SW1";
>> +                       wakeup-source;
>> +                       debounce-interval = <20>;
>> +               };
>> +
>> +               key-2 {
>> +                       interrupts = <RZG2L_GPIO(0, 1) IRQ_TYPE_EDGE_FALLING>;
>> +                       interrupt-parent = <&pinctrl>;
>> +                       linux,code = <KEY_2>;
>> +                       label = "USER_SW2";
>> +                       wakeup-source;
>> +                       debounce-interval = <20>;
>> +               };
>> +
>> +               key-3 {
>> +                       interrupts = <RZG2L_GPIO(0, 3) IRQ_TYPE_EDGE_FALLING>;
>> +                       interrupt-parent = <&pinctrl>;
>> +                       linux,code = <KEY_3>;
>> +                       label = "USER_SW3";
>> +                       wakeup-source;
>> +                       debounce-interval = <20>;
>> +               };
>> +       };
>> +
>>         vcc_sdhi1: regulator-vcc-sdhi1 {
>>                 compatible = "regulator-fixed";
>>                 regulator-name = "SDHI1 Vcc";
> 
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> i.e. will queue in renesas-devel for v6.9, with the above fixed.
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys
  2024-01-12 15:38   ` claudiu beznea
@ 2024-01-12 16:20     ` Geert Uytterhoeven
  2024-01-13 10:13       ` claudiu beznea
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2024-01-12 16:20 UTC (permalink / raw)
  To: claudiu beznea
  Cc: magnus.damm, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	linux-renesas-soc, devicetree, linux-kernel, Claudiu Beznea

Hi Claudiu,

On Fri, Jan 12, 2024 at 4:38 PM claudiu beznea <claudiu.beznea@tuxon.dev> wrote:
> On 12.01.2024 15:55, Geert Uytterhoeven wrote:
> > On Wed, Dec 27, 2023 at 2:08 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
> >> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> >>
> >> RZ SMARC Carrier II board has 3 user buttons called USER_SW1, USER_SW2,
> >> USER_SW3. Add a DT node in device tree to propertly instantiate the
> >> gpio-keys driver for these buttons.
> >>
> >> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
> >
> > Thanks for your patch!
> >
> >> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> >> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
> >> @@ -14,6 +15,37 @@ aliases {
> >>                 mmc1 = &sdhi1;
> >>         };
> >>
> >> +       keys {
> >
> > Do you mind if I s/keys/keypad/ while applying? ...
>
> Is not actually a keypad... there are 3 buttons in a corner of the board...
>
> I see only 2 entries in arm64 and arm DTS directory following this pattern
> for gpio-keys compatible node:
>
>  arch/arm/boot/dts/renesas/r8a7779-marzen.dts
>  arch/arm/boot/dts/renesas/r8a7779-marzen.dts
>
> But if you prefer it like this, I have nothing against.
>
> Just asking, do you have a particular reason for naming it like this?

See the discussion in [1], and the resulting patch[2], which added the
(so far) single user in arch/arm/boot/dts/renesas/r8a7779-marzen.dts

[1] https://lore.kernel.org/all/20231023144134.1881973-1-geert+renesas@glider.be
[2] https://lore.kernel.org/all/eec1ccfb75c6215428609fdcaf3a37c75fe1fc87.1698228163.git.geert+renesas@glider.be
>
> >> +                       interrupt-parent = <&pinctrl>;
> >
> > ... and move these one level up, to avoid duplication?
>
> Moving it just near compatible will make the schema validation to fail with
> this (driver is working, though):
>
> arch/arm64/boot/dts/renesas/r9a08g045s33-smarc.dtb: keys:
> 'interrupt-parent' does not match any of the regexes:
> '^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$',
> 'pinctrl-[0-9]+'
>         from schema $id: http://devicetree.org/schemas/input/gpio-keys.yaml#

Oops, I had completely forgotten r8a7779-marzen.dts triggers this, too...
Let's keep it for now.

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] 5+ messages in thread

* Re: [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys
  2024-01-12 16:20     ` Geert Uytterhoeven
@ 2024-01-13 10:13       ` claudiu beznea
  0 siblings, 0 replies; 5+ messages in thread
From: claudiu beznea @ 2024-01-13 10:13 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: magnus.damm, robh+dt, krzysztof.kozlowski+dt, conor+dt,
	linux-renesas-soc, devicetree, linux-kernel, Claudiu Beznea

Hi, Geert,

On 12.01.2024 18:20, Geert Uytterhoeven wrote:
> Hi Claudiu,
> 
> On Fri, Jan 12, 2024 at 4:38 PM claudiu beznea <claudiu.beznea@tuxon.dev> wrote:
>> On 12.01.2024 15:55, Geert Uytterhoeven wrote:
>>> On Wed, Dec 27, 2023 at 2:08 PM Claudiu <claudiu.beznea@tuxon.dev> wrote:
>>>> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>>>
>>>> RZ SMARC Carrier II board has 3 user buttons called USER_SW1, USER_SW2,
>>>> USER_SW3. Add a DT node in device tree to propertly instantiate the
>>>> gpio-keys driver for these buttons.
>>>>
>>>> Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>>>
>>> Thanks for your patch!
>>>
>>>> --- a/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
>>>> +++ b/arch/arm64/boot/dts/renesas/rzg3s-smarc.dtsi
>>>> @@ -14,6 +15,37 @@ aliases {
>>>>                 mmc1 = &sdhi1;
>>>>         };
>>>>
>>>> +       keys {
>>>
>>> Do you mind if I s/keys/keypad/ while applying? ...
>>
>> Is not actually a keypad... there are 3 buttons in a corner of the board...
>>
>> I see only 2 entries in arm64 and arm DTS directory following this pattern
>> for gpio-keys compatible node:
>>
>>  arch/arm/boot/dts/renesas/r8a7779-marzen.dts
>>  arch/arm/boot/dts/renesas/r8a7779-marzen.dts
>>
>> But if you prefer it like this, I have nothing against.
>>
>> Just asking, do you have a particular reason for naming it like this?
> 
> See the discussion in [1], and the resulting patch[2], which added the
> (so far) single user in arch/arm/boot/dts/renesas/r8a7779-marzen.dts
> 
> [1] https://lore.kernel.org/all/20231023144134.1881973-1-geert+renesas@glider.be

Ah, I remember part of this discussion. Good for me to rename it as you
proposed.

> [2] https://lore.kernel.org/all/eec1ccfb75c6215428609fdcaf3a37c75fe1fc87.1698228163.git.geert+renesas@glider.be
>>
>>>> +                       interrupt-parent = <&pinctrl>;
>>>
>>> ... and move these one level up, to avoid duplication?
>>
>> Moving it just near compatible will make the schema validation to fail with
>> this (driver is working, though):
>>
>> arch/arm64/boot/dts/renesas/r9a08g045s33-smarc.dtb: keys:
>> 'interrupt-parent' does not match any of the regexes:
>> '^(button|event|key|switch|(button|event|key|switch)-[a-z0-9-]+|[a-z0-9-]+-(button|event|key|switch))$',
>> 'pinctrl-[0-9]+'
>>         from schema $id: http://devicetree.org/schemas/input/gpio-keys.yaml#
> 
> Oops, I had completely forgotten r8a7779-marzen.dts triggers this, too...
> Let's keep it for now.
> 
> Gr{oetje,eeting}s,
> 
>                         Geert
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-01-13 10:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27 13:08 [PATCH] arm64: dts: renesas: rzg3s-smarc: Add gpio keys Claudiu
2024-01-12 13:55 ` Geert Uytterhoeven
2024-01-12 15:38   ` claudiu beznea
2024-01-12 16:20     ` Geert Uytterhoeven
2024-01-13 10:13       ` 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).