Skip to contentSkip to conversation

Add GPIO keys polled for pca955x

PATCH Applied Christopher Bostic 2 participants 7 messages Jul 18, 2017 – Jul 20, 2017

Subsystems (3)

v2 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add GPIO keys polled for pca955x

Define gpio keys polled devices in the device tree for fan presence lines off of the pca955x. Enable GPIO keys polled config option.

Christopher Bostic (2):
ARM: dts: aspeed: Add gpio-keys-polled for fan presence
ARM: configs: aspeed: Add GPIO_KEYS_POLLED

 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++
 arch/arm/configs/aspeed_g5_defconfig             | 1 +
 2 files changed, 35 insertions(+)
Signature · 1 line
1.8.2.2
#1 lore raw

PATCH v2 1/2 ARM: dts: aspeed: Add gpio-keys-polled for fan presence

Define gpio-keys-polled. Add pca-955x chip IO as GPIO source.

---
v2 - Change 'linux,code' from a unique global value to a local one
for all the gpio-keys-polled devices.

---
 arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +34 -0
index 34c5dfc..f574d7b3 100644
@@ -62,6 +62,38 @@
 		};
 	};
 
+	gpio-keys-polled {
+		compatible = "gpio-keys-polled";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		#poll-interval = <100>;
+		autorepeat;
+
+		fan0-presence {
+			label = "fan0-presence";
+			gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
+			linux,code = <4>;
+		};
+
+		fan1-presence {
+			label = "fan1-presence";
+			gpios = <&pca0 5 GPIO_ACTIVE_LOW>;
+			linux,code = <5>;
+		};
+
+		fan2-presence {
+			label = "fan2-presence";
+			gpios = <&pca0 6 GPIO_ACTIVE_LOW>;
+			linux,code = <6>;
+		};
+
+		fan3-presence {
+			label = "fan3-presence";
+			gpios = <&pca0 7 GPIO_ACTIVE_LOW>;
+			linux,code = <7>;
+		};
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -224,6 +256,8 @@
 		reg = <0x60>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		gpio-controller;
+		#gpio-cells = <2>;
 
 		fan0: led@0 {
 			label = "fan0";
Signature · 1 line
1.8.2.2
maintainer
#2 lore raw

Re: [PATCH v2 1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence

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

Quoted 6 lines · Christopher Bostic
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5 -0
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               #poll-interval = <100>;

Are you sure that this needs to be polled this often?

We should consider how much traffic this generates on the bus (how often it is contended), and how that fits in with other devices on that master. If you've done these calculations then please amend your commit message with that information.

Quoted 1 line

+ autorepeat;

None of the other gpio-keys nodes have this set. Can you expand your commit message to explain why you set this please.

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

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2 -0
@@ -224,6 +256,8 @@
                reg = <0x60>;
                #address-cells = <1>;
                #size-cells = <0>;
+               gpio-controller;
+               #gpio-cells = <2>;

This appears to be an unrelated change?

Cheers,

Joel

#3 lore raw

Re: [PATCH v2 1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence

Quoted 7 lines · Joel Stanley

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

Quoted 5 lines · Christopher Bostic
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5 -0
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               #poll-interval = <100>;
Quoted 6 lines

Are you sure that this needs to be polled this often?

We should consider how much traffic this generates on the bus (how often it is contended), and how that fits in with other devices on that master. If you've done these calculations then please amend your commit message with that information.

Discussed with Brad Bishop and Matt Spinler - agreed to increase period to 1 second.

Quoted 4 lines
Quoted 2 lines

+ autorepeat;

None of the other gpio-keys nodes have this set. Can you expand your commit message to explain why you set this please.

This isn't necessary. Will remove.

Quoted 6 lines

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

Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2 -0
@@ -224,6 +256,8 @@
                 reg = <0x60>;
                 #address-cells = <1>;
                 #size-cells = <0>;
+               gpio-controller;
+               #gpio-cells = <2>;

Will remove.

Thanks,
Chris

Quoted 6 lines

This appears to be an unrelated change?

Cheers,

Joel

maintainer
#4 lore raw

Re: [PATCH v2 1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence

Quoted 15 lines · Christopher Bostic
Quoted 12 lines · Joel Stanley

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

Quoted 6 lines · Christopher Bostic
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5 -0
+       gpio-keys-polled {
+               compatible = "gpio-keys-polled";
+               #address-cells = <1>;
+               #size-cells = <0>;
+               #poll-interval = <100>;

Are you sure that this needs to be polled this often?

Quoted 7 lines
Quoted 4 lines

We should consider how much traffic this generates on the bus (how often it is contended), and how that fits in with other devices on that master. If you've done these calculations then please amend your commit message with that information.

Discussed with Brad Bishop and Matt Spinler - agreed to increase period to 1 second.

Okay. You forgot to add this to the commit message.

Cheers,

Joel

#5 lore raw

PATCH v2 2/2 ARM: configs: aspeed: Add GPIO_KEYS_POLLED

In reply to Christopher Bostic

Configure to build gpio_keys_polled device driver.

---
 arch/arm/configs/aspeed_g5_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/aspeed_g5_defconfig +1 -0
index ad121ed..1868442 100644
@@ -106,6 +106,7 @@ CONFIG_REALTEK_PHY=y
 CONFIG_INPUT_EVDEV=y
 # CONFIG_KEYBOARD_ATKBD is not set
 CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_GPIO_POLLED=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
Signature · 1 line
1.8.2.2
maintainer Applied
#6 lore raw

Re: [PATCH v2 2/2] ARM: configs: aspeed: Add GPIO_KEYS_POLLED

Quoted 4 lines · Christopher Bostic

Configure to build gpio_keys_polled device driver.

Applied to dev-4.10.

Cheers,

Joel

Quoted 19 lines
---
 arch/arm/configs/aspeed_g5_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/aspeed_g5_defconfig +1 -1
index ad121ed..1868442 100644
@@ -106,6 +106,7 @@ CONFIG_REALTEK_PHY=y
 CONFIG_INPUT_EVDEV=y
 # CONFIG_KEYBOARD_ATKBD is not set
 CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_GPIO_POLLED=y
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_SERIO is not set
 # CONFIG_VT is not set
--

1.8.2.2