Add GPIO keys polled for pca955x
Subsystems (3)
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
PATCH 1/2 ARM: dts: aspeed: Add gpio-keys-polled for fan presence
Define gpio-keys-polled. Add pca-955x chip IO as GPIO source.
--- 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
@@ -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 = <232>; + }; + + fan1-presence { + label = "fan1-presence"; + gpios = <&pca0 5 GPIO_ACTIVE_LOW>; + linux,code = <233>; + }; + + fan2-presence { + label = "fan2-presence"; + gpios = <&pca0 6 GPIO_ACTIVE_LOW>; + linux,code = <234>; + }; + + fan3-presence { + label = "fan3-presence"; + gpios = <&pca0 7 GPIO_ACTIVE_LOW>; + linux,code = <235>; + }; + }; + 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
Re: [PATCH linux dev-4.10 1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence
Quoted 25 lines · Christopher Bostic
Define gpio-keys-polled. Add pca-955x chip IO as GPIO source.
Quoted 1 line
Signed-off-by Christopher Bostic <[email protected]>---
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++1 file changed, 34 insertions(+)arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0
-0@@ -62,6 +62,38 @@ > }; > };arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 70
Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +6
-0+ gpio-keys-polled { + compatible = "gpio-keys-polled"; + #address-cells = <1>; + #size-cells = <0>; + #poll-interval = <100>; + autorepeat;+
Quoted 3 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3
-0+ fan0-presence { + label = "fan0-presence"; + gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 75
Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1
-0+ linux,code = <232>;
I think I replied about your choice of codes in the previous series. The thought that I eventually came to (after replying IIRC) was what has sort-of happened naturally here by way of the PCA card being unable to provide interrupts, forcing you to define a separate node using gpio-keys-polled.
Anyway, the thought was to have one gpio-keys{,-polled} node per gpiochip device. That gives us the namespacing that the gpiochip phandle provides - i.e. all keys in a node must use the same gpiochip phandle. This isolates the keys behind separate input devices, and thus their codes don't need to be globally unique.
So in this case I'm suggesting:
fan0-presence {
label = "fan0-presence";
gpios = <&pca0 4 GPIO_ACTIVE_LOW>;
linux,code = <4>;
}And likewise for the nodes below.
Cheers,
Andrew
Quoted 33 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2
-0+ }; +arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 82
Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5
-0+ fan1-presence { + label = "fan1-presence"; + gpios = <&pca0 5 GPIO_ACTIVE_LOW>; + linux,code = <233>; + };+
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 88
Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5
-0+ fan2-presence { + label = "fan2-presence"; + gpios = <&pca0 6 GPIO_ACTIVE_LOW>; + linux,code = <234>; + };+
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 95
Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +6
-0+ fan3-presence { + label = "fan3-presence"; + gpios = <&pca0 7 GPIO_ACTIVE_LOW>; + linux,code = <235>; + }; + };+
Quoted 2 lines
leds {
compatible = "gpio-leds";arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0
-0@@ -224,6 +256,8 @@ > reg = <0x60>; > #address-cells = <1>; > #size-cells = <0>; > + gpio-controller; > + #gpio-cells = <2>;Quoted 2 lines
Quoted 1 line
fan0: led@0 {
label = "fan0";
Re: [PATCH linux dev-4.10 1/2] ARM: dts: aspeed: Add gpio-keys-polled for fan presence
Quoted 41 lines · Andrew Jeffery
Quoted 25 lines · Christopher Bostic
Define gpio-keys-polled. Add pca-955x chip IO as GPIO source.
Quoted 1 line
Signed-off-by Christopher Bostic <[email protected]>--- arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts | 34 ++++++++++++++++++++++++ 1 file changed, 34 insertions(+)arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0
-0@@ -62,6 +62,38 @@ > }; > }; > + gpio-keys-polled { > + compatible = "gpio-keys-polled"; > + #address-cells = <1>;arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 70
Quoted 3 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3
-0+ #size-cells = <0>; + #poll-interval = <100>; + autorepeat;+
Quoted 3 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +3
-0+ fan0-presence { + label = "fan0-presence"; + gpios = <&pca0 4 GPIO_ACTIVE_LOW>;arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 75
Quoted 1 line
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +1
-0+ linux,code = <232>;I think I replied about your choice of codes in the previous series. The thought that I eventually came to (after replying IIRC) was what has sort-of happened naturally here by way of the PCA card being unable to provide interrupts, forcing you to define a separate node using gpio-keys-polled.
Anyway, the thought was to have one gpio-keys{,-polled} node per gpiochip device. That gives us the namespacing that the gpiochip phandle provides - i.e. all keys in a node must use the same gpiochip phandle. This isolates the keys behind separate input devices, and thus their codes don't need to be globally unique.
So in this case I'm suggesting:
Quoted 7 lines
fan0-presence { label = "fan0-presence"; gpios = <&pca0 4 GPIO_ACTIVE_LOW>; linux,code = <4>; }And likewise for the nodes below.
Hi Andrew,
I'll update per your suggestion.
Thanks for the input,
Chris
Quoted 38 lines
Cheers,
Andrew
Quoted 33 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +2
-0+ }; +arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 82
Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5
-0+ fan1-presence { + label = "fan1-presence"; + gpios = <&pca0 5 GPIO_ACTIVE_LOW>; + linux,code = <233>; + };+
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 88
Quoted 5 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +5
-0+ fan2-presence { + label = "fan2-presence"; + gpios = <&pca0 6 GPIO_ACTIVE_LOW>; + linux,code = <234>; + };+
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts line 95
Quoted 6 lines
arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +6
-0+ fan3-presence { + label = "fan3-presence"; + gpios = <&pca0 7 GPIO_ACTIVE_LOW>; + linux,code = <235>; + }; + };+
Quoted 2 lines
leds { compatible = "gpio-leds";arch/arm/boot/dts/aspeed-bmc-opp-witherspoon.dts +0
-0@@ -224,6 +256,8 @@ > reg = <0x60>; > #address-cells = <1>; > #size-cells = <0>; > + gpio-controller; > + #gpio-cells = <2>;Quoted 2 lines
Quoted 1 line
fan0: led@0 {label = "fan0";
PATCH 2/2 ARM: configs: aspeed: Add GPIO_KEYS_POLLED
In reply to Christopher BosticConfigure 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
@@ -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
Re: [PATCH linux dev-4.10 2/2] ARM: configs: aspeed: Add GPIO_KEYS_POLLED
Quoted 3 lines · Christopher Bostic
Configure to build
gpio_keys_polleddevice driver.Signed-off-by Christopher Bostic <[email protected]>
Quoted 16 lines
---
arch/arm/configs/aspeed_g5_defconfig | 1 +1 file changed, 1 insertion(+)arch/arm/configs/aspeed_g5_defconfig +0
-0@@ -106,6 +106,7 @@ CONFIG_REALTEK_PHY=yCONFIG_INPUT_EVDEV=y
#CONFIG_KEYBOARD_ATKBDis not set
CONFIG_KEYBOARD_GPIO=y
+CONFIG_KEYBOARD_GPIO_POLLED=y
#CONFIG_INPUT_MOUSEis not set
#CONFIG_SERIOis not set
#CONFIG_VTis not set