Skip to contentSkip to conversation

enable gpio-keys

PATCH Superseded Brad Bishop 3 participants 11 messages Apr 12, 2017 – Apr 19, 2017 1 message not in the archive

Subsystems (3)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover enable gpio-keys

Enable the gpio-keys and evdev drivers on ast24xx generally.

Bind gpio-key events to the checkstop and air-water cooled gpios on the Witherspoon system.

Brad Bishop (2):
ARM: configs: aspeed: Enable keyboard-gpio
ARM: dts: Enable checkstop and cooling gpio keys

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 17 +++++++++++++++++
 arch/arm/configs/aspeed_g4_defconfig             |  8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig             |  8 +++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/2 ARM: configs: aspeed: Enable keyboard-gpio

Some OpenBMC systems will be using keyboard-gpio so enable it in our configs.

---
 arch/arm/configs/aspeed_g4_defconfig | 8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/configs/aspeed_g4_defconfig +7 -1
index 552297b..4350f67 100644
@@ -103,7 +103,12 @@ CONFIG_FTGMAC100=y
 CONFIG_BROADCOM_PHY=y
 CONFIG_REALTEK_PHY=y
 # CONFIG_WLAN is not set
-# CONFIG_INPUT is not set
+# CONFIG_INPUT_LEDS is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -138,6 +143,7 @@ CONFIG_SENSORS_ADM1275=y
 CONFIG_SENSORS_LM25066=y
 CONFIG_SENSORS_UCD9000=y
 CONFIG_SENSORS_TMP421=y
+# CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
arch/arm/configs/aspeed_g5_defconfig +7 -1
index c5e7295..b6b3ca0 100644
@@ -102,7 +102,12 @@ CONFIG_FTGMAC100=y
 CONFIG_BROADCOM_PHY=y
 CONFIG_REALTEK_PHY=y
 # CONFIG_WLAN is not set
-# CONFIG_INPUT is not set
+# CONFIG_INPUT_LEDS is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -135,6 +140,7 @@ CONFIG_PMBUS=y
 CONFIG_SENSORS_LM25066=y
 CONFIG_SENSORS_UCD9000=y
 CONFIG_SENSORS_TMP421=y
+# CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 2/2 ARM: dts: Enable checkstop and cooling gpio keys

In reply to Brad Bishop

Enable gpio-keys events for the checkstop and water/air cooled gpios for use by applications on the Witherspoon system.

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +17 -0
index e3a7b77..dbf64f5 100644
@@ -2,6 +2,7 @@
 
 #include "aspeed-g5.dtsi"
 #include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/input/input.h>
 
 / {
 	model = "Witherspoon BMC";
@@ -31,6 +32,22 @@
 		};
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		air-water {
+			label = "air-water";
+			gpios = <&gpio ASPEED_GPIO(B, 5) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_1>;
+		};
+
+		checkstop {
+			label = "checkstop";
+			gpios = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_2>;
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
Signature · 1 line
1.8.3.1

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: [PATCH linux dev-4.7 2/2] ARM: dts: Enable checkstop and cooling gpio keys

Cc'ing the list as it got sent privately.

Quoted 49 lines · Andrew Jeffery
Quoted 38 lines · Brad Bishop

Enable gpio-keys events for the checkstop and water/air cooled gpios for use by applications on the Witherspoon system.

Quoted 1 line

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 17
+++++++++++++++++

 1 file changed, 17 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..dbf64f5 100644
@@ -2,6 +2,7 @@


 #include "aspeed-g5.dtsi"
 #include <dt-bindings/gpio/aspeed-gpio.h>
+#include <dt-bindings/input/input.h>

 / {

Quoted 1 line

  model = "Witherspoon BMC";

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
@@ -31,6 +32,22 @@
 >  		};
 >  	};
 

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 36

Quoted 2 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2 -0
+	gpio-keys {
+		compatible = "gpio-keys";

+

Quoted 4 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3 -0
+		air-water {
+			label = "air-water";
+			gpios = <&gpio ASPEED_GPIO(B, 5)

GPIO_ACTIVE_LOW>;

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 41

Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
+			linux,code = <KEY_1>;

What do you think of the idea of using the GPIO index instead of linearly assigning keycodes as needed? So:

			linux,code = <ASPEED_GPIO(B, 5)>;

That way at least the assignment isn't completely arbitrary.

Andrew

maintainer
#5 lore raw
In reply to Brad Bishop

Hi Brad,

Quoted 4 lines · Brad Bishop

Enable the gpio-keys and evdev drivers on ast24xx generally.

Bind gpio-key events to the checkstop and air-water cooled gpios on the Witherspoon system.

Thanks for the patches. It looks like something went wrong in your git-send-email invocation:

From: Brad Bishop <[email protected]>
To: "[email protected]" <[email protected]>

Did you intend to send it to me as well as the list?

Cheers,

Joel

Quoted 12 lines

Brad Bishop (2):
ARM: configs: aspeed: Enable keyboard-gpio
ARM: dts: Enable checkstop and cooling gpio keys

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 17 +++++++++++++++++
 arch/arm/configs/aspeed_g4_defconfig             |  8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig             |  8 +++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

--
1.8.3.1

#6 lore raw
Quoted 9 lines

Hi Brad,

Quoted 4 lines · Brad Bishop

Enable the gpio-keys and evdev drivers on ast24xx generally.

Bind gpio-key events to the checkstop and air-water cooled gpios on the Witherspoon system.

Quoted 7 lines

Thanks for the patches. It looks like something went wrong in your git-send-email invocation:

From: Brad Bishop <[email protected]>
To: "[email protected]" <[email protected]>

Did you intend to send it to me as well as the list?

I did. Sorry about that.

Quoted 17 lines

Cheers,

Joel

Quoted 12 lines

Brad Bishop (2):
ARM: configs: aspeed: Enable keyboard-gpio
ARM: dts: Enable checkstop and cooling gpio keys

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 17 +++++++++++++++++
 arch/arm/configs/aspeed_g4_defconfig             |  8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig             |  8 +++++++-
 3 files changed, 31 insertions(+), 2 deletions(-)

--
1.8.3.1

#7 lore raw

v2 cover enable gpio-keys

In reply to Brad Bishop

Enable the gpio-keys and evdev drivers on ast24xx generally.

Bind gpio-key events to the checkstop and air-water cooled gpios on the Witherspoon system.

v2:
Use gpio numbers for keycodes.

Brad Bishop (2):
ARM: configs: aspeed: Enable keyboard-gpio
ARM: dts: Enable checkstop and cooling gpio keys

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 16 ++++++++++++++++
 arch/arm/configs/aspeed_g4_defconfig             |  8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig             |  8 +++++++-
 3 files changed, 30 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#8 lore raw

PATCH v2 1/2 ARM: configs: aspeed: Enable keyboard-gpio

Some OpenBMC systems will be using keyboard-gpio so enable it in our configs.

---
 arch/arm/configs/aspeed_g4_defconfig | 8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)
arch/arm/configs/aspeed_g4_defconfig +7 -1
index 552297b..4350f67 100644
@@ -103,7 +103,12 @@ CONFIG_FTGMAC100=y
 CONFIG_BROADCOM_PHY=y
 CONFIG_REALTEK_PHY=y
 # CONFIG_WLAN is not set
-# CONFIG_INPUT is not set
+# CONFIG_INPUT_LEDS is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -138,6 +143,7 @@ CONFIG_SENSORS_ADM1275=y
 CONFIG_SENSORS_LM25066=y
 CONFIG_SENSORS_UCD9000=y
 CONFIG_SENSORS_TMP421=y
+# CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
arch/arm/configs/aspeed_g5_defconfig +7 -1
index c5e7295..b6b3ca0 100644
@@ -102,7 +102,12 @@ CONFIG_FTGMAC100=y
 CONFIG_BROADCOM_PHY=y
 CONFIG_REALTEK_PHY=y
 # CONFIG_WLAN is not set
-# CONFIG_INPUT is not set
+# CONFIG_INPUT_LEDS is not set
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_KEYBOARD_ATKBD is not set
+CONFIG_KEYBOARD_GPIO=y
+# CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
 # CONFIG_LEGACY_PTYS is not set
@@ -135,6 +140,7 @@ CONFIG_PMBUS=y
 CONFIG_SENSORS_LM25066=y
 CONFIG_SENSORS_UCD9000=y
 CONFIG_SENSORS_TMP421=y
+# CONFIG_HID is not set
 # CONFIG_USB_SUPPORT is not set
 CONFIG_NEW_LEDS=y
 CONFIG_LEDS_CLASS=y
Signature · 1 line
1.8.3.1
#9 lore raw

PATCH v2 2/2 ARM: dts: Enable checkstop and cooling gpio keys

In reply to Brad Bishop

Enable gpio-keys events for the checkstop and water/air cooled gpios for use by applications on the Witherspoon system.

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +16 -0
index e3a7b77..4a68b30 100644
@@ -31,6 +31,22 @@
 		};
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+
+		air-water {
+			label = "air-water";
+			gpios = <&gpio ASPEED_GPIO(B, 5) GPIO_ACTIVE_LOW>;
+			linux,code = <&gpio ASPEED_GPIO(B, 5) GPIO_ACTIVE_LOW>;
+		};
+
+		checkstop {
+			label = "checkstop";
+			gpios = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_LOW>;
+			linux,code = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_LOW>;
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
Signature · 1 line
1.8.3.1
#10 lore raw

Re: [PATCH linux dev-4.7 v2 2/2] ARM: dts: Enable checkstop and cooling gpio keys

Hi Brad,

Quoted 16 lines · Brad Bishop

Enable gpio-keys events for the checkstop and water/air cooled gpios for use by applications on the Witherspoon system.

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..4a68b30 100644
@@ -31,6 +31,22 @@
 		};
 	};

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 42

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +7 -0
 
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               air-water {
+                       label = "air-water";
+                       gpios = <&gpio ASPEED_GPIO(B, 5)
 GPIO_ACTIVE_LOW>;
+                       linux,code = <&gpio ASPEED_GPIO(B, 5)
 GPIO_ACTIVE_LOW>;

This doesn't look right to me. linux,code doesn't appear to be anything more than a single value cell in the documentation:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/input/gpio-keys.txt?id=refs/tags/v4.11-rc6

I expect you just want the macro, and not phandle or gpio flags. I was expecting to see:

linux,code = <ASPEED_GPIO(B, 5)>;

Is there a reason you've done it this way? Have you checked reading values from userspace gives the expected value?

Andrew

Quoted 16 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +6 -0
+               };
+
+               checkstop {
+                       label = "checkstop";
+                       gpios = <&gpio ASPEED_GPIO(J, 2)
 GPIO_ACTIVE_LOW>;
+                       linux,code = <&gpio ASPEED_GPIO(J, 2)

GPIO_ACTIVE_LOW>;

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3 -0
+               };
+       };
+
 	leds {
 		compatible = "gpio-leds";
Signature · 2 lines
-- 
1.8.3.1
#11 lore raw

Re: [PATCH linux dev-4.7 v2 2/2] ARM: dts: Enable checkstop and cooling gpio keys

Andrew

Thanks for looking.

Quoted 35 lines · Andrew Jeffery

Hi Brad,

Quoted 16 lines · Brad Bishop

Enable gpio-keys events for the checkstop and water/air cooled gpios for use by applications on the Witherspoon system.

---
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 16 ++++++++++++++++

1 file changed, 16 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..4a68b30 100644
@@ -31,6 +31,22 @@
 		};
 	};

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 42

Quoted 10 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +7 -0
 
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               air-water {
+                       label = "air-water";
+                       gpios = <&gpio ASPEED_GPIO(B, 5)
 GPIO_ACTIVE_LOW>;
+                       linux,code = <&gpio ASPEED_GPIO(B, 5)
 GPIO_ACTIVE_LOW>;

This doesn't look right to me. linux,code doesn't appear to be anything more than a single value cell in the documentation:

Quoted 6 lines

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/input/gpio-keys.txt?id=refs/tags/v4.11-rc6

I expect you just want the macro, and not phandle or gpio flags. I was expecting to see:

linux,code = <ASPEED_GPIO(B, 5)>;

Agreed and fixed.

Quoted 3 lines

Is there a reason you've done it this way? Have you checked reading values from userspace gives the expected value?

No and No. Busted. I fully exercised v3 on a Palmetto ( I can’t easily control the state of these specific Witherspoon gpios ).

Quoted 19 lines

Andrew

Quoted 16 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +6 -0
+               };
+
+               checkstop {
+                       label = "checkstop";
+                       gpios = <&gpio ASPEED_GPIO(J, 2)
 GPIO_ACTIVE_LOW>;
+                       linux,code = <&gpio ASPEED_GPIO(J, 2)

GPIO_ACTIVE_LOW>;

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3 -0
+               };
+       };
+
	leds {
		compatible = "gpio-leds";
Signature · 1 line
1.8.3.1