SoftSW DIP switch support for Draak, Eagle and Ebisu
Subsystems (2)
cover SoftSW DIP switch support for Draak, Eagle and Ebisu
SoftSW DIP switch support for Draak, Eagle and Ebisu
[PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
These patches add support for on-board SoftSW DIP switches to the Draak, Eagle and Ebisu boards via board specific DTS changes.
The GPIOs connecting the DIP switches to the SoC are board specific. There are no on-board pull-ups mounted so internal resistors need to be enabled as pull-ups for these boards. As expected 2k resistors are used to tie the signals to ground for the case the DIP switch is set to ON.
All keys have been tested by toggling each DIP switch and making sure the interrupt count in /proc/interrupts is changing as expected. The voltage level of each signal has not been measured at this point so there is a small risk that the internal pull-up isn't enabled and the signal is floating.
---
Developed on top of renesas-drivers-2021-06-08-v5.13-rc5
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 43 ++++++++++++++++++++++++ arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts | 42 +++++++++++++++++++++++ arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 42 +++++++++++++++++++++++ 3 files changed, 127 insertions(+)
PATCH 1/3 arm64: dts: renesas: r8a77995: draak: Add SW56 support
From: Magnus Damm <[email protected]>
Add support for SW56 via "gpio-keys" on the R-Car D3 Draak board.
---
arch/arm64/boot/dts/renesas/r8a77995-draak.dts | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm64/boot/dts/renesas/r8a77995-draak.dts +42 -0
@@ -9,6 +9,7 @@ /dts-v1/; #include "r8a77995.dtsi" #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> / { model = "Renesas Draak board based on r8a77995";
@@ -67,6 +68,42 @@ }; }; + keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&keys_pins>; + pinctrl-names = "default"; + + key-1 { + gpios = <&gpio4 12 GPIO_ACTIVE_LOW>; + linux,code = <KEY_1>; + label = "SW56-1"; + wakeup-source; + debounce-interval = <20>; + }; + key-2 { + gpios = <&gpio4 13 GPIO_ACTIVE_LOW>; + linux,code = <KEY_2>; + label = "SW56-2"; + wakeup-source; + debounce-interval = <20>; + }; + key-3 { + gpios = <&gpio4 14 GPIO_ACTIVE_LOW>; + linux,code = <KEY_3>; + label = "SW56-3"; + wakeup-source; + debounce-interval = <20>; + }; + key-4 { + gpios = <&gpio4 15 GPIO_ACTIVE_LOW>; + linux,code = <KEY_4>; + label = "SW56-4"; + wakeup-source; + debounce-interval = <20>; + }; + }; + lvds-decoder { compatible = "thine,thc63lvd1024"; vcc-supply = <®_3p3v>;
@@ -422,6 +459,11 @@ function = "i2c1"; }; + keys_pins: keys { + pins = "GP_4_12", "GP_4_13", "GP_4_14", "GP_4_15"; + bias-pull-up; + }; + pwm0_pins: pwm0 { groups = "pwm0_c"; function = "pwm0";
Re: [PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support
Quoted 5 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add support for SW56 via "gpio-keys" on the R-Car D3 Draak board.
Signed-off-by Magnus Damm <[email protected]>
i.e. will queue in renesas-devel for v5.15.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
PATCH 2/3 arm64: dts: renesas: r8a77970: eagle: Add SW2 support
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.
---
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts | 43 ++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +43 -0
@@ -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";
Re: [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support
Hi Magnus,
Quoted 5 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add support for SW2 via "gpio-keys" on the R-Car V3M Eagle board.
Signed-off-by Magnus Damm <[email protected]>
Thanks for your patch!
Quoted 55 lines
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900 renamed from arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +38
-0@@ -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";
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900 line 239
Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900 renamed from arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +2
-0@@ -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.
Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a77970-eagle.dts 2021-06-19 19:26:28.399714892 +0900 renamed from arch/arm64/boot/dts/renesas/r8a77970-eagle.dts +3
-0+ bias-pull-up; + }; + qspi0_pins: qspi0 { groups = "qspi0_ctrl", "qspi0_data4";function = "qspi0";
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
PATCH 3/3 arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
In reply to Magnus DammFrom: Magnus Damm <[email protected]>
Add support for SW4 via "gpio-keys" on the R-Car E3 Ebisu board.
---
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
arch/arm64/boot/dts/renesas/r8a77990-ebisu.dts +42 -0
@@ -8,6 +8,7 @@ /dts-v1/; #include "r8a77990.dtsi" #include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/input/input.h> / { model = "Renesas Ebisu board based on r8a77990";
@@ -80,6 +81,42 @@ }; }; + keys { + compatible = "gpio-keys"; + + pinctrl-0 = <&keys_pins>; + pinctrl-names = "default"; + + key-1 { + gpios = <&gpio5 10 GPIO_ACTIVE_LOW>; + linux,code = <KEY_1>; + label = "SW4-1"; + wakeup-source; + debounce-interval = <20>; + }; + key-2 { + gpios = <&gpio5 11 GPIO_ACTIVE_LOW>; + linux,code = <KEY_2>; + label = "SW4-2"; + wakeup-source; + debounce-interval = <20>; + }; + key-3 { + gpios = <&gpio5 12 GPIO_ACTIVE_LOW>; + linux,code = <KEY_3>; + label = "SW4-3"; + wakeup-source; + debounce-interval = <20>; + }; + key-4 { + gpios = <&gpio5 13 GPIO_ACTIVE_LOW>; + linux,code = <KEY_4>; + label = "SW4-4"; + wakeup-source; + debounce-interval = <20>; + }; + }; + lvds-decoder { compatible = "thine,thc63lvd1024"; vcc-supply = <®_3p3v>;
@@ -540,6 +577,11 @@ function = "intc_ex"; }; + keys_pins: keys { + pins = "GP_5_10", "GP_5_11", "GP_5_12", "GP_5_13"; + bias-pull-up; + }; + pwm3_pins: pwm3 { groups = "pwm3_b"; function = "pwm3";
Re: [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
Quoted 5 lines · Magnus Damm
From: Magnus Damm <[email protected]>
Add support for SW4 via "gpio-keys" on the R-Car E3 Ebisu board.
Signed-off-by Magnus Damm <[email protected]>
i.e. will queue in renesas-devel for v5.15.
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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
Hi Magnus,
Quoted 8 lines · Magnus Damm
SoftSW DIP switch support for Draak, Eagle and Ebisu
[PATCH 1/3] arm64: dts: renesas: r8a77995: draak: Add SW56 support [PATCH 2/3] arm64: dts: renesas: r8a77970: eagle: Add SW2 support [PATCH 3/3] arm64: dts: renesas: r8a77990: ebisu: Add SW4 support
These patches add support for on-board SoftSW DIP switches to the Draak, Eagle and Ebisu boards via board specific DTS changes.
Thanks for your series!
Quoted 9 lines
The GPIOs connecting the DIP switches to the SoC are board specific. There are no on-board pull-ups mounted so internal resistors need to be enabled as pull-ups for these boards. As expected 2k resistors are used to tie the signals to ground for the case the DIP switch is set to ON.
All keys have been tested by toggling each DIP switch and making sure the interrupt count in
/proc/interruptsis changing as expected. The voltage level of each signal has not been measured at this point so there is a small risk that the internal pull-up isn't enabled and the signal is floating.
Fortunately the reset state of the PUEN/PUD registers has all pull-ups enabled for all GPIO lines connected to these DIP switches. To make sure Linux enforces this configuration, you need to apply "[PATCH 00/12] pinctrl: renesas: Add more bias pinconf support"
https://lore.kernel.org/linux-gpio/[email protected]/
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] 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