Skip to contentSkip to conversation

enable gpio-keys

PATCH Superseded Brad Bishop 3 participants 10 messages Apr 19, 2017 – Apr 21, 2017

Subsystems (3)

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v3 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.

v3:
Drop phandle and flags from linux,code.
Assign gpios to their own evdev.
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 | 20 ++++++++++++++++++++
 arch/arm/configs/aspeed_g4_defconfig             |  8 +++++++-
 arch/arm/configs/aspeed_g5_defconfig             |  8 +++++++-
 3 files changed, 34 insertions(+), 2 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v3 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 v3 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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +20 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
 		};
 	};
 
+	gpio-keys@0 {
+		compatible = "gpio-keys";
+
+		air-water {
+			label = "air-water";
+			gpios = <&gpio ASPEED_GPIO(B, 5) GPIO_ACTIVE_LOW>;
+			linux,code = <ASPEED_GPIO(B, 5)>;
+		};
+	};
+
+	gpio-keys@1 {
+		compatible = "gpio-keys";
+
+		checkstop {
+			label = "checkstop";
+			gpios = <&gpio ASPEED_GPIO(J, 2) GPIO_ACTIVE_LOW>;
+			linux,code = <ASPEED_GPIO(J, 2)>;
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
Signature · 1 line
1.8.3.1
#3 lore raw

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

Hi Brad,

If you do future revisions of these patches, can you please Cc me?

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.

Quoted 1 line

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

 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
 >  		};
 >  	};

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

Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
+	gpio-keys@0 {

does the @0 give us a stable device name for userspace to open?

Do we really want to go this way? We now have useful unique codes for the "key"s, why not use the one node? Or is your concern we've now tied the function to a value that might vary across platforms? If so, are you relying on always specifying "air-water" in @0? If you are, I think I'd prefer the arbitrary codes, rather than this.

Andrew

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

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

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

+

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

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

+

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

Quoted 6 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 = <ASPEED_GPIO(J, 2)>;
+		};
+	};

+

Quoted 2 lines

  leds {
  compatible = "gpio-leds";

#4 lore raw

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

Quoted 6 lines · Andrew Jeffery

Hi Brad,

If you do future revisions of these patches, can you please Cc me?

will do.

Quoted 15 lines · Brad Bishop
Quoted 13 lines

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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
Quoted 6 lines

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

Quoted 4 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
 >  		};
 >  	};
 
+	gpio-keys@0 {

does the @0 give us a stable device name for userspace to open?

No it doesn’t. This is my lack of DT skillz showing. I was looking into how we can give userspace a stable device name. I was going down the udev path but I can’t find any any of the information from these DT nodes in the udev event.

Quoted 3 lines

Do we really want to go this way? We now have useful unique codes for the "key"s, why not use the one node? Or is your concern we've now tied

Each gpio will have an application waiting for its state to change. My concern was waking up x number of applications every time any gpio changes state. Is that a valid concern?

Quoted 1 line

the function to a value that might vary across platforms? If so, are

No, not worried about this. Applications will be getting their gpio number on the command line anyway.

Quoted 26 lines

you relying on always specifying "air-water" in @0? If you are, I think I'd prefer the arbitrary codes, rather than this.

Andrew

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

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

Quoted 3 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3 -0
+			linux,code = <ASPEED_GPIO(B, 5)>;
+		};
+	};

+

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

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

+

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

Quoted 6 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 = <ASPEED_GPIO(J, 2)>;
+		};
+	};

+

Quoted 2 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
 	leds {
 		compatible = "gpio-leds";
#5 lore raw

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

Quoted 38 lines · Brad Bishop
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Andrew Jeffery

Hi Brad,

If you do future revisions of these patches, can you please Cc me?

will do.

Quoted 16 lines · Brad Bishop
Quoted 14 lines

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 | 20 ++++++++++++++++++++

 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
Quoted 7 lines

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

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
 > > > > >  		};
 >  	};
 

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
+	gpio-keys@0 {

does the @0 give us a stable device name for userspace to open?

No it doesn’t.  This is my lack of DT skillz showing.  I was looking into how we can give userspace a stable device name.  I was going down the udev path but I can’t find any any of the information from these DT nodes in the udev event.

Quoted 1 line
Quoted 6 lines
Quoted 2 lines

Do we really want to go this way? We now have useful unique codes for the "key"s, why not use the one node? Or is your concern we've now tied

Each gpio will have an application waiting for its state to change.  My concern was waking up x number of applications every time any gpio changes state.  Is that a valid concern?

How many applications do we expect to be reading the evdev? What are our expected interrupt rates? What are the worst expected cases?

It's hard to judge without knowing the numbers, but considering the chips we run on I agree we should generally favour performance if design is getting in the way. But to make that trade off we should be clear on the performance numbers.

Andrew

#6 lore raw

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

Quoted 45 lines · Andrew Jeffery
Quoted 41 lines · Brad Bishop
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Andrew Jeffery

Hi Brad,

If you do future revisions of these patches, can you please Cc me?

will do.

Quoted 16 lines · Brad Bishop
Quoted 14 lines

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 | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
Quoted 7 lines

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

Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
 >>>>>  		};
 >  	};
 
 
+	gpio-keys@0 {

does the @0 give us a stable device name for userspace to open?

No it doesn’t. This is my lack of DT skillz showing. I was looking into how we can give userspace a stable device name. I was going down the udev path but I can’t find any any of the information from these DT nodes in the udev event.

Quoted 3 lines

Do we really want to go this way? We now have useful unique codes for the "key"s, why not use the one node? Or is your concern we've now tied

Quoted 6 lines
Quoted 3 lines

Each gpio will have an application waiting for its state to change. My concern was waking up x number of applications every time any gpio changes state. Is that a valid concern?

How many applications do we expect to be reading the evdev? What are our expected interrupt rates? What are the worst expected cases?

For Witherspoon/Zaius or any OpenBMC platform? I obviously can’t say for the latter case. On a bigger/enterprise systems I can see on the order of 10 to 100 applications looking at these. I don’t have a good sense of how often.

On Witherspoon/Zaius, sure, we only have a handful of applications and the interrupt rate should be very infrequent.

I think you typically see all the gpio keys mapped to a single device because the usual thing to do is have a single application (Xorg) treat it like a keyboard.

We aren’t structured that way so rethinking the usual approach seems reasonable. Another reason I went for per gpio devices because it prevents applications from reacting to each others events without any special library code.

I’m not saying there aren’t disadvantages to this approach - I just don’t know what they are?

Quoted 4 lines

It's hard to judge without knowing the numbers, but considering the chips we run on I agree we should generally favour performance if design is getting in the way. But to make that trade off we should be

Again, what exactly is being traded-off ?

Quoted 3 lines

clear on the performance numbers.

Andrew

#7 lore raw

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

Quoted 45 lines · Brad Bishop
Quoted 45 lines
Quoted 1 line
Quoted 1 line · Andrew Jeffery
Quoted 42 lines · Brad Bishop
Quoted 5 lines
Quoted 1 line
Quoted 1 line · Andrew Jeffery

Hi Brad,

If you do future revisions of these patches, can you please Cc me?

will do.

Quoted 16 lines · Brad Bishop
Quoted 14 lines

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 | 20 ++++++++++++++++++++

 1 file changed, 20 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
index e3a7b77..aa1708e 100644
@@ -31,6 +31,26 @@
Quoted 8 lines

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

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0 -0
 > > > > >  		};
Quoted 2 lines

  };

arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1 -0
+	gpio-keys@0 {

does the @0 give us a stable device name for userspace to open?

No it doesn’t.  This is my lack of DT skillz showing.  I was looking into how we can give userspace a stable device name.  I was going down the udev path but I can’t find any any of the information from these DT nodes in the udev event.

Quoted 3 lines

Do we really want to go this way? We now have useful unique codes for the "key"s, why not use the one node? Or is your concern we've now tied

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Each gpio will have an application waiting for its state to change.  My concern was waking up x number of applications every time any gpio changes state.  Is that a valid concern?

How many applications do we expect to be reading the evdev? What are our expected interrupt rates? What are the worst expected cases?

For Witherspoon/Zaius or any OpenBMC platform?

Yes, this is what I was asking about, given they are concrete systems.

Quoted 2 lines

 I obviously can’t say for the
latter case.

Yep.

Quoted 2 lines

 On a bigger/enterprise systems I can see on the order of 10 to 100 applications looking at these.

Okay; having 10-100 processes woken is something we'd want to avoid.

Quoted 4 lines

 I don’t have a good sense of how often.

On Witherspoon/Zaius, sure, we only have a handful of applications and the interrupt rate should be very infrequent.

That was my thought, which was why I wanted to check. While it might be low, if we're waking up to 100 applications it's not ideal.

Quoted 5 lines

I think you typically see all the gpio keys mapped to a single device because the usual thing to do is have a single application (Xorg) treat it like a keyboard.

We aren’t structured that way so rethinking the usual approach seems reasonable.

Sure; I was never against rethinking it. I just wanted a clear explanation of why we would choose this route.

Quoted 6 lines


Another reason I went for per gpio devices because it prevents applications from reacting to each others events without any special library code.

I’m not saying there aren’t disadvantages to this approach - I just don’t know what they are?

It's a bit strange from a design perspective as we now have two unique identifiers for an event; the input device *and* the keycode emitted by the event on the input device, which is the *only* keycode emitted by the device.

For someone new to the system I expect this would seem a strange redundancy if they weren't aware of the performance implications inherent to the distributed nature of the application design.

Quoted 7 lines
Quoted 5 lines

It's hard to judge without knowing the numbers, but considering the chips we run on I agree we should generally favour performance if design is getting in the way. But to make that trade off we should be

Again, what exactly is being traded-off ?

The "oddity" in the design with respect to the "redundancy" I described above.

Anyway, I think what you have outlined is reasonable.

Cheers,

Andrew

maintainer
#8 lore raw

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

In reply to Brad Bishop

Hi Brad,

Quoted 11 lines · Brad Bishop
Quoted 6 lines
Quoted 3 lines

Each gpio will have an application waiting for its state to change. My concern was waking up x number of applications every time any gpio changes state. Is that a valid concern?

How many applications do we expect to be reading the evdev? What are our expected interrupt rates? What are the worst expected cases?

For Witherspoon/Zaius or any OpenBMC platform? I obviously can’t say for the latter case. On a bigger/enterprise systems I can see on the order of 10 to 100 applications looking at these. I don’t have a good sense of how often.

Quoted 5 lines

On Witherspoon/Zaius, sure, we only have a handful of applications and the interrupt rate should be very infrequent.

I think you typically see all the gpio keys mapped to a single device because the usual thing to do is have a single application (Xorg) treat it like a keyboard.

I've been following the discussion you've been having. I went to merge the patches today, but first decided to satisfy myself that this was the right way to go. I didn't arrive at the same conclusion as you and Andrew.

The userspace use cases you've presented would be served well by a single node. We have the flexibility to revisit this decision when someone builds a machine that has 100 GPIOs they want to monitor; in addition I think we would revisit the decision to have 100 userspace programs.

By having separate nodes, you're creating a new instance of the kernel driver for each node.

The driver, and the binding, is designed to support your use case - multiple key events generated by the hardware.

Finally, I looked at the other machines in the tree. None of them have separate gpio-keys nodes

arch/arm/boot/dts/armada-xp-netgear-rn2120.dts:

        gpio-keys {
                compatible = "gpio-keys";
                pinctrl-0 = <&power_button_pin &reset_button_pin>;
                pinctrl-names = "default";

                power-button {
                        label = "Power Button";
                        linux,code = <KEY_POWER>;
                        gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
                };

                reset-button {
                        label = "Reset Button";
                        linux,code = <KEY_RESTART>;
                        gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
                };
        };

arch/arm/boot/dts/at91sam9261ek.dts

        gpio_keys {
                compatible = "gpio-keys";

                button_0 {
                        label = "button_0";
                        gpios = <&pioA 27 GPIO_ACTIVE_LOW>;
                        linux,code = <256>;
                        wakeup-source;
                };

                button_1 {
                        label = "button_1";
                        gpios = <&pioA 26 GPIO_ACTIVE_LOW>;
                        linux,code = <257>;
                        wakeup-source;
                };

                button_2 {
                        label = "button_2";
                        gpios = <&pioA 25 GPIO_ACTIVE_LOW>;
                        linux,code = <258>;
                        wakeup-source;
                };

                button_3 {
                        label = "button_3";
                        gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
                        linux,code = <259>;
                        wakeup-source;
                };
        };

Cheers,

Joel

Quoted 18 lines

We aren’t structured that way so rethinking the usual approach seems reasonable. Another reason I went for per gpio devices because it prevents applications from reacting to each others events without any special library code.

I’m not saying there aren’t disadvantages to this approach - I just don’t know what they are?

Quoted 4 lines

It's hard to judge without knowing the numbers, but considering the chips we run on I agree we should generally favour performance if design is getting in the way. But to make that trade off we should be

Again, what exactly is being traded-off ?

Quoted 3 lines

clear on the performance numbers.

Andrew

#9 lore raw

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

Quoted 35 lines · Joel Stanley

Hi Brad,

Quoted 11 lines · Brad Bishop
Quoted 6 lines
Quoted 3 lines

Each gpio will have an application waiting for its state to change. My concern was waking up x number of applications every time any gpio changes state. Is that a valid concern?

How many applications do we expect to be reading the evdev? What are our expected interrupt rates? What are the worst expected cases?

For Witherspoon/Zaius or any OpenBMC platform? I obviously can’t say for the latter case. On a bigger/enterprise systems I can see on the order of 10 to 100 applications looking at these. I don’t have a good sense of how often.

Quoted 5 lines

On Witherspoon/Zaius, sure, we only have a handful of applications and the interrupt rate should be very infrequent.

I think you typically see all the gpio keys mapped to a single device because the usual thing to do is have a single application (Xorg) treat it like a keyboard.

I've been following the discussion you've been having. I went to merge the patches today, but first decided to satisfy myself that this was the right way to go. I didn't arrive at the same conclusion as you and Andrew.

The userspace use cases you've presented would be served well by a single node. We have the flexibility to revisit this decision when someone builds a machine that has 100 GPIOs they want to monitor; in addition I think we would revisit the decision to have 100 userspace programs.

Quoted 5 lines

By having separate nodes, you're creating a new instance of the kernel driver for each node.

The driver, and the binding, is designed to support your use case - multiple key events generated by the hardware.

Honestly I’m OK with either approach. I think we will have userspace configurable enough that switching back and forth would be pretty trivial, if this would need to be revisited. v5 en-route.

Quoted 3 lines

Finally, I looked at the other machines in the tree. None of them have separate gpio-keys nodes

Yeah I noticed this too. I chalked it up to my previously mentioned user-is-probably-Xorg logic, but standard practices are not usually a hard sell for me….

Quoted 78 lines

arch/arm/boot/dts/armada-xp-netgear-rn2120.dts:

       gpio-keys {
               compatible = "gpio-keys";
               pinctrl-0 = <&power_button_pin &reset_button_pin>;
               pinctrl-names = "default";

               power-button {
                       label = "Power Button";
                       linux,code = <KEY_POWER>;
                       gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
               };

               reset-button {
                       label = "Reset Button";
                       linux,code = <KEY_RESTART>;
                       gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
               };
       };

arch/arm/boot/dts/at91sam9261ek.dts

       gpio_keys {
               compatible = "gpio-keys";

               button_0 {
                       label = "button_0";
                       gpios = <&pioA 27 GPIO_ACTIVE_LOW>;
                       linux,code = <256>;
                       wakeup-source;
               };

               button_1 {
                       label = "button_1";
                       gpios = <&pioA 26 GPIO_ACTIVE_LOW>;
                       linux,code = <257>;
                       wakeup-source;
               };

               button_2 {
                       label = "button_2";
                       gpios = <&pioA 25 GPIO_ACTIVE_LOW>;
                       linux,code = <258>;
                       wakeup-source;
               };

               button_3 {
                       label = "button_3";
                       gpios = <&pioA 24 GPIO_ACTIVE_LOW>;
                       linux,code = <259>;
                       wakeup-source;
               };
       };

Cheers,

Joel

Quoted 18 lines

We aren’t structured that way so rethinking the usual approach seems reasonable. Another reason I went for per gpio devices because it prevents applications from reacting to each others events without any special library code.

I’m not saying there aren’t disadvantages to this approach - I just don’t know what they are?

Quoted 4 lines

It's hard to judge without knowing the numbers, but considering the chips we run on I agree we should generally favour performance if design is getting in the way. But to make that trade off we should be

Again, what exactly is being traded-off ?

Quoted 3 lines

clear on the performance numbers.

Andrew