[v2,3/5] arm64: tegra: Add gpio-keys nodes for Darcy

Message ID 20190109012420.6755-4-markz@nvidia.com
State Superseded
Headers show
Series
  • NVIDIA Shield TV device tree patch set
Related show

Commit Message

Mark Zhang Jan. 9, 2019, 1:24 a.m.
Add gpio-keys nodes for the power button.

Signed-off-by: Mark Zhang <markz@nvidia.com>
---
 arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

Comments

Thierry Reding Jan. 10, 2019, 3:37 p.m. | #1
On Wed, Jan 09, 2019 at 09:24:18AM +0800, Mark Zhang wrote:
> Add gpio-keys nodes for the power button.
> 
> Signed-off-by: Mark Zhang <markz@nvidia.com>
> ---
>  arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
> index ac52286ab9ab..b21902a98f11 100644
> --- a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
> +++ b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
> @@ -1,5 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  
> +#include <dt-bindings/input/input.h>
>  #include "tegra210.dtsi"
>  
>  / {
> @@ -52,6 +53,19 @@
>  		};
>  	};
>  
> +	gpio-keys {
> +		compatible = "gpio-keys";
> +		status = "okay";
> +
> +		power {
> +			label = "Power";
> +			gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
> +			linux,code = <KEY_POWER>;
> +			wakeup-source;

I think if you have wakeup-source you also need wakeup-event-action, see
Documentation/devicetree/bindings/input/gpio-keys.txt.

Thierry
Mark Zhang Jan. 11, 2019, 2:48 a.m. | #2
On 1/10/2019 11:37 PM, Thierry Reding wrote:
> On Wed, Jan 09, 2019 at 09:24:18AM +0800, Mark Zhang wrote:
>> Add gpio-keys nodes for the power button.
>>
>> Signed-off-by: Mark Zhang <markz@nvidia.com>
>> ---
>>  arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi | 14 ++++++++++++++
>>  1 file changed, 14 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
>> index ac52286ab9ab..b21902a98f11 100644
>> --- a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
>> +++ b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
>> @@ -1,5 +1,6 @@
>>  // SPDX-License-Identifier: GPL-2.0
>>  
>> +#include <dt-bindings/input/input.h>
>>  #include "tegra210.dtsi"
>>  
>>  / {
>> @@ -52,6 +53,19 @@
>>  		};
>>  	};
>>  
>> +	gpio-keys {
>> +		compatible = "gpio-keys";
>> +		status = "okay";
>> +
>> +		power {
>> +			label = "Power";
>> +			gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
>> +			linux,code = <KEY_POWER>;
>> +			wakeup-source;
> 
> I think if you have wakeup-source you also need wakeup-event-action, see
> Documentation/devicetree/bindings/input/gpio-keys.txt.

Done. Thanks for pointing out.

Mark

> 
> Thierry
>

Patch

diff --git a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
index ac52286ab9ab..b21902a98f11 100644
--- a/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra210-p2894.dtsi
@@ -1,5 +1,6 @@ 
 // SPDX-License-Identifier: GPL-2.0
 
+#include <dt-bindings/input/input.h>
 #include "tegra210.dtsi"
 
 / {
@@ -52,6 +53,19 @@ 
 		};
 	};
 
+	gpio-keys {
+		compatible = "gpio-keys";
+		status = "okay";
+
+		power {
+			label = "Power";
+			gpios = <&gpio TEGRA_GPIO(X, 7) GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_POWER>;
+			wakeup-source;
+			debounce-interval = <30>;
+		};
+	};
+
 	cpus {
 		cpu@0 {
 			enable-method = "psci";