Skip to contentSkip to conversation

arm64: tegra210-smaug: Add gpio-key nodes

PATCH New Rhyland Klein 3 participants 5 messages Mar 3, 2016 – Mar 4, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64: tegra210-smaug: Add gpio-key nodes

Add gpio-key nodes for the volumn controls, lid switch, tablet mode and power button.

---
 arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 43 +++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +43 -0
index 750e85c45135..9c0ec3031e98 100644
@@ -1,5 +1,7 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
+
 #include "tegra210.dtsi"
 
 / {
@@ -76,6 +78,47 @@
 		};
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+		gpio-keys,name = "gpio-keys";
+
+		power {
+			label = "Power";
+			gpios = <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_POWER>;
+			debounce-interval = <30>;
+			gpio-key,wakeup;
+		};
+
+		lid {
+			label = "Lid";
+			gpios = <&gpio TEGRA_GPIO(B, 4) GPIO_ACTIVE_LOW>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <0>; /* SW_LID */
+			gpio-key,wakeup;
+		};
+
+		tablet_mode {
+			label = "Tablet Mode";
+			gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <1>; /* SW_TABLET_MODE */
+			gpio-key,wakeup;
+		};
+
+		volume_down {
+			label = "Volume Down";
+			gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEDOWN>;
+		};
+
+		volume_up {
+			label = "Volume Up";
+			gpios = <&gpio TEGRA_GPIO(M, 4) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_VOLUMEUP>;
+		};
+	};
+
 	psci {
 		compatible = "arm,psci-1.0";
 		method = "smc";
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 arm64: tegra210-smaug: Add gpio-key nodes

Rhyland,

Quoted 4 lines · Rhyland Klein

Add gpio-key nodes for the volumn controls, lid switch, tablet mode and power button.

Quoted 67 lines
---
 arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 43 +++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +43 -1
index 750e85c45135..9c0ec3031e98 100644
@@ -1,5 +1,7 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
+
 #include "tegra210.dtsi"
 
 / {
@@ -76,6 +78,47 @@
                };
        };
 
+       gpio-keys {
+               compatible = "gpio-keys";
+               gpio-keys,name = "gpio-keys";
+
+               power {
+                       label = "Power";
+                       gpios = <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+                       debounce-interval = <30>;
+                       gpio-key,wakeup;
+               };
+
+               lid {
+                       label = "Lid";
+                       gpios = <&gpio TEGRA_GPIO(B, 4) GPIO_ACTIVE_LOW>;
+                       linux,input-type = <5>; /* EV_SW */
+                       linux,code = <0>; /* SW_LID */
+                       gpio-key,wakeup;
+               };
+
+               tablet_mode {
+                       label = "Tablet Mode";
+                       gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
+                       linux,input-type = <5>; /* EV_SW */
+                       linux,code = <1>; /* SW_TABLET_MODE */
+                       gpio-key,wakeup;
+               };
+
+               volume_down {
+                       label = "Volume Down";
+                       gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEDOWN>;
+               };
+
+               volume_up {
+                       label = "Volume Up";
+                       gpios = <&gpio TEGRA_GPIO(M, 4) GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_VOLUMEUP>;
+               };
+       };
+
        psci {
                compatible = "arm,psci-1.0";
                method = "smc";
--

1.9.1

#2 lore raw

PATCH 1/1 arm64: tegra210-smaug: Add gpio-key nodes

In reply to Rhyland Klein
Quoted 24 lines · Rhyland Klein

Add gpio-key nodes for the volumn controls, lid switch, tablet mode and power button.

---
 arch/arm64/boot/dts/nvidia/tegra210-smaug.dts | 43 +++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +2 -0
index 750e85c45135..9c0ec3031e98 100644
@@ -1,5 +1,7 @@
 /dts-v1/;
 
+#include <dt-bindings/input/input.h>
+
 #include "tegra210.dtsi"
 
 / {
@@ -76,6 +78,47 @@
 		};
 	};
 

arch/arm64/boot/dts/nvidia/tegra210-smaug.dts line 90

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +10 -0
+	gpio-keys {
+		compatible = "gpio-keys";
+		gpio-keys,name = "gpio-keys";
+
+		power {
+			label = "Power";
+			gpios = <&gpio TEGRA_GPIO(X, 5) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_POWER>;
+			debounce-interval = <30>;
+			gpio-key,wakeup;

This property was recently deprecated in favour of the standard generic wakeup-source property.

arch/arm64/boot/dts/nvidia/tegra210-smaug.dts line 97

Quoted 7 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +7 -0
+		};
+
+		lid {
+			label = "Lid";
+			gpios = <&gpio TEGRA_GPIO(B, 4) GPIO_ACTIVE_LOW>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <0>; /* SW_LID */

The dt-bindings/input/input.h header defines the symbolic names for these in upstream versions of the Linux kernel.

arch/arm64/boot/dts/nvidia/tegra210-smaug.dts line 105

Quoted 8 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +8 -0
+			gpio-key,wakeup;
+		};
+
+		tablet_mode {
+			label = "Tablet Mode";
+			gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <1>; /* SW_TABLET_MODE */

Same here.

I've made all the above changes when applying, so no need to resend.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160304/4587fb98/attachment.sig>

#3 lore raw

PATCH 1/1 arm64: tegra210-smaug: Add gpio-key nodes

In reply to Rhyland Klein
Quoted 1 line · Rhyland Klein
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +0 -0

[...]

Quoted 5 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +5 -0
+		lid {
+			label = "Lid";
+			gpios = <&gpio TEGRA_GPIO(B, 4) GPIO_ACTIVE_LOW>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <0>; /* SW_LID */

arch/arm64/boot/dts/nvidia/tegra210-smaug.dts line 107

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +10 -0
+			gpio-key,wakeup;
+		};
+
+		tablet_mode {
+			label = "Tablet Mode";
+			gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <1>; /* SW_TABLET_MODE */
+			gpio-key,wakeup;
+		};

Is there a way to trigger these on a DVT device? Power and volume controls work fine, but I haven't found a way to test these two.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160304/1b26017c/attachment.sig>

#4 lore raw

PATCH 1/1 arm64: tegra210-smaug: Add gpio-key nodes

Quoted 15 lines · Thierry Reding

* PGP Signed by an unknown key

Quoted 1 line · Rhyland Klein
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +0 -0

[...]

Quoted 10 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +10 -0
+		lid {
+			label = "Lid";
+			gpios = <&gpio TEGRA_GPIO(B, 4) GPIO_ACTIVE_LOW>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <0>; /* SW_LID */
+			gpio-key,wakeup;
+		};
+
+		tablet_mode {
+			label = "Tablet Mode";
Quoted 8 lines

arch/arm64/boot/dts/nvidia/tegra210-smaug.dts line 107

Quoted 5 lines
arch/arm64/boot/dts/nvidia/tegra210-smaug.dts +5 -0
+			gpios = <&gpio TEGRA_GPIO(Z, 2) GPIO_ACTIVE_HIGH>;
+			linux,input-type = <5>; /* EV_SW */
+			linux,code = <1>; /* SW_TABLET_MODE */
+			gpio-key,wakeup;
+		};

Is there a way to trigger these on a DVT device? Power and volume controls work fine, but I haven't found a way to test these two.

First of all, thanks for catching the deprecated property and changes in the input.h.

As for testing, both can be triggered with magnets. The lid switch is near the camera on the top of the display. For me, the tablet-mode sensor is around 1/3 up from the bottom (assuming camera is the top) on the back side of the device. Not sure how that would line up for you though...

-rhyland

Signature · 1 line
nvpublic