From a1cc46b96711ee7fb27c0188616dedf967dc2bef Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Wed, 21 Feb 2018 15:14:02 +0100
Subject: [PATCH] Switch polarity for the wakeup-uart4 key

The wakeup gpio-code is there mostly to enable using uart4 as a wakeup
source. Due to SoC limitation uart4 cannot be directly used as a wakeup
source, but the pins can be used to wakeup the system when used in gpio
mode. Hence the device-tree re-muxes the uart pins as gpio pins when
going into sleep at which point they're also exposed as a gpio key
(which is enabled as a wakeup-source) to the kernel.

This all works nicely to wake up the device from suspend on keyboard
activity. However it does trigger key presses of KEY_WAKEUP on resume,
which is also fine. However the way it was reported makes it appear to
user-space as if the KEY_WAKEUP is being held down, which in turn
confuses our version of Gtk+ on wayland (and isn't very nice in general).

To sort that out flip the polarity of the gpio such that a high signal
means key press and low key depressed, the latter being the case when
the pins are muxed back to uart mode. Also drop the debounce-interval
and use the default, which results in just a single KEY_WAKEUP press
being triggered after suspend rather then multiple

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---
 arch/arm/boot/dts/am335x-sl50.dts | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/am335x-sl50.dts b/arch/arm/boot/dts/am335x-sl50.dts
index 71747e50b65d..812fe68d0969 100644
--- a/arch/arm/boot/dts/am335x-sl50.dts
+++ b/arch/arm/boot/dts/am335x-sl50.dts
@@ -45,9 +45,8 @@
 		wakeup-uart4 {
 			label = "wakeup-uart4";
 			linux,code = <143>;	/* KEY_WAKEUP */
-			gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
+			gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
 			wakeup-source;
-			debounce-interval = <0>;
 		};
 	};
 
-- 
GitLab