diff mbox series

[2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support

Message ID 162416648909.11444.15000511904887495628.sendpatchset@octo (mailing list archive)
State Under Review
Delegated to: Geert Uytterhoeven
Headers show
Series SoftSW DIP switch support for Draak, Eagle and Ebisu | expand

Commit Message

Magnus Damm June 20, 2021, 5:21 a.m. UTC
From: Magnus Damm <damm+renesas@opensource.se>

Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 arch/arm64/boot/dts/renesas/r8a77970-eagle.dts |   43 ++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

Comments

Geert Uytterhoeven June 21, 2021, 11:03 a.m. UTC | #1
Hi Magnus,

On Sun, Jun 20, 2021 at 8:01 AM Magnus Damm <damm@opensource.se> wrote:
> From: Magnus Damm <damm+renesas@opensource.se>
>
> Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.
>
> Signed-off-by: Magnus Damm <damm+renesas@opensource.se>

Thanks for your patch!

> --- 0001/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
> +++ work/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900
> @@ -8,6 +8,8 @@
>
>  /dts-v1/;
>  #include "r8a77970.dtsi"
> +#include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/input/input.h>
>
>  / {
>         model = "Renesas Eagle board based on r8a77970";
> @@ -43,6 +45,42 @@
>                 };
>         };
>
> +       keys {
> +               compatible = "gpio-keys";
> +
> +               pinctrl-0 = <&keys_pins>;
> +               pinctrl-names = "default";
> +
> +               key-1 {
> +                       gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_1>;
> +                       label = "SW2-1";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-2 {
> +                       gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_2>;
> +                       label = "SW2-2";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-3 {
> +                       gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_3>;
> +                       label = "SW2-3";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +               key-4 {
> +                       gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
> +                       linux,code = <KEY_4>;
> +                       label = "SW2-4";
> +                       wakeup-source;
> +                       debounce-interval = <20>;
> +               };
> +       };
> +
>         lvds-decoder {
>                 compatible = "thine,thc63lvd1024";
>
> @@ -196,6 +234,11 @@

>                 function = "i2c0";
>         };
>
> +       keys_pins: keys {
> +               pins = "GP_1_21", "GP_1_22", "GP_1_23", "GP_1_24";

While Section 2.11 ("GPIO Interfaces for Debugging") of the "R-CarV3M
System Evaluation Board / Eagle Hardware Manual" (Rev 0.08) says:

    When using the software switches, enable the internal pull-up
    functions of GP1_21, GP1_22, GP1_23, and GP1_24.

I think GP_1_21 should be dropped, as it's already pulled-up by R427.

Furthermore, as the Eagle DTS has CANFD enabled, SW2-1 and SW2-2
are not available, so both should be dropped.

Presumably you have SW32=on, so SW2-2 works, and CANFD doesn't?
Probably we should document this in the DTS.

> +               bias-pull-up;
> +       };
> +
>         qspi0_pins: qspi0 {
>                 groups = "qspi0_ctrl", "qspi0_data4";
>                 function = "qspi0";

Gr{oetje,eeting}s,

                        Geert
diff mbox series

Patch

--- 0001/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts
+++ work/arch/arm64/boot/dts/renesas/r8a77970-eagle.dts	2021-06-19 19:26:28.399714892 +0900
@@ -8,6 +8,8 @@ 
 
 /dts-v1/;
 #include "r8a77970.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Renesas Eagle board based on r8a77970";
@@ -43,6 +45,42 @@ 
 		};
 	};
 
+	keys {
+		compatible = "gpio-keys";
+
+		pinctrl-0 = <&keys_pins>;
+		pinctrl-names = "default";
+
+		key-1 {
+			gpios = <&gpio1 21 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_1>;
+			label = "SW2-1";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-2 {
+			gpios = <&gpio1 22 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_2>;
+			label = "SW2-2";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-3 {
+			gpios = <&gpio1 23 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_3>;
+			label = "SW2-3";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+		key-4 {
+			gpios = <&gpio1 24 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_4>;
+			label = "SW2-4";
+			wakeup-source;
+			debounce-interval = <20>;
+		};
+	};
+
 	lvds-decoder {
 		compatible = "thine,thc63lvd1024";
 
@@ -196,6 +234,11 @@ 
 		function = "i2c0";
 	};
 
+	keys_pins: keys {
+		pins = "GP_1_21", "GP_1_22", "GP_1_23", "GP_1_24";
+		bias-pull-up;
+	};
+
 	qspi0_pins: qspi0 {
 		groups = "qspi0_ctrl", "qspi0_data4";
 		function = "qspi0";