ARM: dts: exynos: Add power button for Odroid XU3/4
authorBrian Kim <brian.kim@hardkernel.com>
Tue, 12 Sep 2017 11:57:54 +0000 (13:57 +0200)
committerKrzysztof Kozlowski <krzk@kernel.org>
Mon, 18 Sep 2017 18:35:44 +0000 (20:35 +0200)
The power button (SW2) on Odroid XU3/4 is connected to the PWRON pin
of the S2MPS11 PMIC.

The S2MPS11 datasheet says that ONOB pin operates as 'PWRON key active
low signal'. In fact, S2MPS11 PMIC acts as a 16ms debouce filter and
signal inverter, thus effectively repeating PWRON (active high) to ONOB
pin (active low).

ONOB PMIC pin is then connected to XEINT3 SoC pin, so we get the state
of the power button on the gpx0-3 GPIO.

This patch adds device-tree bindings for the power button of Odroid
XU3/4 boards.

Signed-off-by: Brian Kim <brian.kim@hardkernel.com>
[mszyprow: extended commit message, added comments and fixed minor
 issues in the dts]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Reviewed-by: Anand Moon <linux.amoon@gmail.com>
Tested-by: Anand Moon <linux.amoon@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
arch/arm/boot/dts/exynos5422-odroidxu3-common.dtsi

index 0418f20d9f5b543501c949e1bf58b20ffd073d54..7d2b95c6970ff2a1221056febc1920a1a277fa9c 100644 (file)
@@ -13,6 +13,7 @@
 */
 
 #include <dt-bindings/clock/samsung,s2mps11.h>
+#include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 #include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/sound/samsung-i2s.h>
                };
        };
 
+       gpio_keys {
+               compatible = "gpio-keys";
+               pinctrl-names = "default";
+               pinctrl-0 = <&power_key>;
+
+               power_key {
+                       /*
+                        * The power button (SW2) is connected to the PWRON
+                        * pin (active high) of the S2MPS11 PMIC, which acts
+                        * as a 16ms debouce filter and signal inverter with
+                        * output on ONOB pin (active low). ONOB PMIC pin is
+                        * then connected to XEINT3 SoC pin.
+                        */
+                       gpios = <&gpx0 3 GPIO_ACTIVE_LOW>;
+                       linux,code = <KEY_POWER>;
+                       label = "power key";
+                       debounce-interval = <0>;
+                       wakeup-source;
+               };
+       };
+
        emmc_pwrseq: pwrseq {
                pinctrl-0 = <&emmc_nrst_pin>;
                pinctrl-names = "default";
 };
 
 &pinctrl_0 {
+       power_key: power-key {
+               samsung,pins = "gpx0-3";
+               samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;
+               samsung,pin-pud = <EXYNOS_PIN_PULL_NONE>;
+               samsung,pin-drv = <EXYNOS5420_PIN_DRV_LV1>;
+       };
+
        hdmi_hpd_irq: hdmi-hpd-irq {
                samsung,pins = "gpx3-7";
                samsung,pin-function = <EXYNOS_PIN_FUNC_INPUT>;