From 4fc30b61eb00fe1c9a02fece1e7e516719a03a91 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 2 Dec 2017 12:28:17 +0100 Subject: [PATCH] three pulled gpio buttons (for pins without irq) --- device-tree/gpio-3-buttons.dts | 61 ++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 device-tree/gpio-3-buttons.dts diff --git a/device-tree/gpio-3-buttons.dts b/device-tree/gpio-3-buttons.dts new file mode 100644 index 0000000..450325d --- /dev/null +++ b/device-tree/gpio-3-buttons.dts @@ -0,0 +1,61 @@ +/dts-v1/; +/plugin/; + +/ { + compatible = "allwinner,sun4i-a10", "allwinner,sun7i-a20", "allwinner,sun50i-a64", "allwinner,sun50i-h5"; + + /* + * This fragment is needed only for the internal pull-up activation, + * external pull-up resistor is highly recommended if using long wires + */ + + fragment@0 { + target = <&pio>; + __overlay__ { + gpio_button_0: gpio_button_0 { + pins = "PG9","PG10","PG11"; + function = "gpio_in"; + bias-pull-up; + }; + }; + }; + + fragment@1 { + target-path = "/"; + __overlay__ { + gpio-3-buttons { + /* + * Use "gpio-keys" for EINT capable pins, "gpio-keys-polled" for other pins + * add "poll-interval" property if using "gpio-keys-polled" + */ +/* + compatible = "gpio-keys"; +*/ + compatible = "gpio-keys-polled"; + poll-interval = <100>; + autorepeat; + + pinctrl-names = "default"; + pinctrl-0 = <&gpio_button_0>; + + up { + label = "button-up"; + linux,code = <103>; /* KEY_UP, see include/uapi/linux/input-event-codes.h */ + gpios = <&pio 6 9 1>; /* PG9 GPIO_ACTIVE_LOW */ + }; + + down { + label = "button-down"; + linux,code = <108>; /* KEY_DOWN, see include/uapi/linux/input-event-codes.h */ + gpios = <&pio 6 10 1>; /* PG10 GPIO_ACTIVE_LOW */ + }; + + enter { + label = "button-enter"; + linux,code = <28>; /* KEY_DOWN, see include/uapi/linux/input-event-codes.h */ + gpios = <&pio 6 11 1>; /* PG11 GPIO_ACTIVE_LOW */ + }; + }; + }; + }; +}; -- 2.20.1